Using ddclient for Dynamic DNS

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, instead ;)

Here is a detailed description of the steps to take:

  1. Create a free acount at DynDNS (or some other service).
  2. 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.
  3. Install ddclient on your local Linux machine. In *Ubuntu you do:

    sudo aptitude install ddclient

  4. 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.
  5. There’s one more thing. I learned this the hard way. By default, ddclient uses the ifconfig program to detect your IP. This is a problem if you’re behind NAT, as it will just find and update the DNS record to this local address, rendering it utterly useless. You need to configure ddclient to use a web server for determining your IP.
    Edit /etc/ddclient.conf as root and change the line that says

    use=if, if=…

    to read


  6. Now you’re done! To make sure everything went right, you may do a manual

    sudo ddclient -v

    and read the detailed output. ddclient will 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.

3 Responses to Using ddclient for Dynamic DNS

  1. Eugeniu says:


    How did I not figure out to search for this stuff. I wrote myself a bash script that sends me my home pc’s ip every now and then. This is much nicer, I love hostnames.

  2. Constantin says:

    Sometimes it’s cool to reinvent the wheel ;)

  3. […] access to a computer whose IP changes dynamically, ddclient may be the tool for you. Check out this previous article for how to set up ddclient using a free service like DynDNS. Once set up, you will be able to […]

%d bloggers like this: