Using DynDNS to access a server with dynamic IP-addresses

This post describes how you can access your server using a host name instead of the dynamic IP addresses (from DHCP) it has assigned at the moment. I’m going to describe how to use DynDNS, but this also applies to other services like EasyDNS, DSLreports.com and ZoneEdit. This tutorial has been tested on my Ubuntu 9.04 home server. You need to create an account at DynDNS if you are planning to to this.

First you have to install the ddclient package and in debian and Ubuntu you run the command

# aptitude install ddclient

To reconfigure ddclient

# dpkg-reconfigure ddclient

You should validate the config file /etc/ddclient.conf to make sure your settings are right.
This is the content of my config file

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

pid=/var/run/ddclient.pid
protocol=dyndns2
use=if, if=eth2
server=members.dyndns.org
login=username
password='mysecretpassword'
hostname.dyndns.org

You can see that I user network interface eth2 as my internet connection and my login and password is the information I registered at DynDNS.com

Restart the ddclient daemon if you do any changes to the config file

# /etc/init.d/ddclient restart

You are now able to connect to your server using the hostname you defined in the server line in the config file, in my case hostname.dyndns.org