My current Internet connection does not have a static IP. This means that my address changes a few times per day. It poses a problem, because I want to SSH into my home box from time to time.
Fortunately, there is a simple solution: Dynamic DNS. Here’s the gist: you create a DNS record, install a program to update it regularly, and forget about it! You will no longer have to remember your IP, but a nice name of your choice, like mybloodyownbox.homelinux.org, instead ;)
Here is a detailed description of the steps to take:
- Create a free acount at DynDNS (or some other service).
- Using your account, configure a host. You may set any IP to it, you will change it later anyway. Here you get the chance to select a name and a domain. DynDNS gives you lots of nice options here.
- Install ddclient on your local Linux machine. In *Ubuntu you do:
sudo aptitude install ddclient
- The post-install configuration process will ask you a couple of things: your provider, username, password and the DNS name you chose. It may also ask you what interface it should work with. You may specify anything (e.g.
eth0) here, because you will change this setting later.
- There’s one more thing. I learned this the hard way. By default,
ifconfigprogram to detect your IP. This is a problem if you’re behind NAT, as it will just find
192.168.xxx.yyyand update the DNS record to this local address, rendering it utterly useless. You need to configure
ddclientto use a web server for determining your IP.
rootand change the line that says
- Now you’re done! To make sure everything went right, you may do a manual
sudo ddclient -v
and read the detailed output.
ddclientwill update the DNS record automatically from now on.
NOTE: The script must always be running on your system. Ubuntu takes care of this automatically by adding an entry to
/etc/init.d. You may need to do this yourself on other distros, I can’t say for sure.