Once again, if your ISP already gives you a static IP address, you don’t need to worry about this section.
We’ve already set up a static internal IP address for the Raspberry Pi, which means computers inside your local network will always know where to find your Pi. But what about projects that require Raspberry Pi to be connected to the Internet? If you want to build a Web server with your Raspberry Pi, people outside your network need to know where your Pi lives, which means setting a public IP that always looks the same.
I say “looks the same” because we’re really setting up a pseudo-static IP. Your ISP will continue to change the address as usual. So every time somebody connects to your Pi, the script we’re about to write will say, “Looks like the Pi has moved! Let me redirect you to the new address.”
First sign up for a free dynamic host service like DNS Dynamic. Follow the instructions and create a new nameserver like Yourserver.dnsdynamic.com.
Now go to the command line on your Raspberry Pi and install DDClient with the following line:
sudo apt-get install ddclient
We need to edit the DDClient configuration with our DDNS’s new name server:
sudo nano /etc/ddclient/ddclient.conf
Every service will have slightly different configuration, but the DDNS website should tell you what you need to do to configure this file. A standard configuration for DNS Dynamic, for example, goes like this. Copy and paste it in.