Once you have set up your Raspberry Pi chances are that you want to access it from remote machine or host a little web site on it. The problem is that your provider usually gives you a dynamic IP, which changes every time you connect to the Internet. In Germany most (A|V)DSL provider reset your connection every 24h. The solution for this is a dynamic DNS (DDNS), which automatically updates the name server in the Domain Name System (DNS). Here is how you set it up using the provider DynDNS NoIP.

The first step is obtaining a free subdomain from the provider. Therefor you register an account at NoIP.com and check the little box Create my hostname later. Once you activated the account and logged into the website click on Hosts/Redirects. To create a new subdomain click on Add a Host and get creative. As host type choose DNS Host (A)

After setting up your host you can update your IP using curl:

curl -u $USERNAME:$PASSWORD "http://dynupdate.no-ip.com/nic/update?hostname=$HOSTNAME"`

To update your IP everytime you boot your Raspberry Pi you can set-up a crontab: crontab -e

@reboot curl -u $USERNAME:$PASSWORD "http://dynupdate.no-ip.com/nic/update?hostname=$HOSTNAME"

After you have successfully updated your IP address you have to setup your router to open the desired ports and forward requests to the Raspberry Pi in your local network.

Update: DynDNS no longer offerering free accounts.