Thursday, February 05, 2009

Howto: Setup ddclient + Zoneedit Ubuntu 10.04 - 12.04 (Hardy/Ibex/Jaunty/Karmic/Lucid/Maverick/Narwhal/Ocelot/Precise)

This post explains how to install and setup the dynamic dns client ddclient to sync your dynamic IP address with the dynamic DNS service Zoneedit.com. Most of the howto's I've seen only cover setups for dynamic DNS services like dyndns.com. I prefer Zoneedit.com because it is simple and free.

I am assuming you have a domain name (yourdomain.com), an account with Zoneedit, and that you have setup the appropriate records in your Zoneedit account for your domain. I am also assuming that you have installed/setup Ubuntu.  This Howto has been tested on Ubuntu 8.04  through 12.04 with success.  This Howto may work with other versions of Linux.

For the purpose of this howto, I will use the (A)-record that I've created in Zoneedit called "tux.yourdomain.com". So on with the show:

1.) First you need to install some packages on your Ubuntu machine from the location that you want syncing with Zoneedit. You can use synaptic, apptitude or apt. To use apt, type the following into the terminal:
:~$ sudo apt-get install ddclient ssh libio-socket-ssl-perl
At the prompts you will be asked to select your Dns provider. You need to select Zoneedit here and input the appropriate values, for example:
Fully qualified domain names: tux.yourdomain.com
Username for dynamic DNS service: your-username
Password: your-password
Enter the interface which is used for using dynamic DNS service: web

2.) After the installation is finished, you need to configure /etc/ddclient.conf. You can edit this file with vim or your favorite text editor. To open the file in Gedit, you can type the following into terminal:
:~$ gksu gedit /etc/ddclient.conf
You need to modify the /etc/ddclient.conf and add entries for "daemon", "ssl" and replace "use=if, if=web" with "use=web, web='http://www.zoneedit.com/checkip.html/', web-skip='IP Address'" to match the following example:
# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

daemon=300
pid=/var/run/ddclient.pid
ssl=yes
protocol=zoneedit1
## use=if, if=web
use=web, web='http://www.zoneedit.com/checkip.html/', web-skip='IP Address'
## server=www.zoneedit.com
server=dynamic.zoneedit.com
login=
password='*******
tux.yourdomain.com
Update: It has been recommended in the comments that you change:
www.zoneedit.com/checkip.html
to
legacy.zoneedit.com/checkip.html.

3.) Now open /etc/default/ddclient:
:~$ gksu gedit /etc/default/ddclient
Check that /etc/default/ddclient contains the following lines:
run_ipup="false"
run_daemon="true"
daemon_interval="300"
You can set the interval shorter or longer in /etc/default/ddclient, but if you do, also correct your /etc/ddclient.conf to match.

4) You can now restart ddclient with your new configurations.
:~$ sudo /etc/init.d/ddclient restart
To check the status of the ddclient daemon:
:~$ sudo /etc/init.d/ddclient status
If you do not get an error similar to the following, the ddclient deamon has probably restarted without any issues:
WARNING: file /etc/ddclient.conf, line x
5.) Just because ddclient restarted correctly does NOT mean that it is syncing your IP address correctly with Zoneedit. Since ddclient writes logs to Syslog, you can check to see if the syncing of your Ip is s Success by looking through /var/log/syslog. I use tail to do this in the following way:
:~$ tail -f /var/log/syslog
If you see something at the end of Syslog that looks similar to this:
Feb 5 21:16:36 tux ddclient[12034]: SUCCESS: updating tux.yourdomain.com: IP address set to (200: Update succeeded.)
then ddclient should be working fine. However, if you get something similar to the following, you should check your /etc/ddclient.conf and /etc/default/ddclient configurations:
Feb 5 21:13:44 tux ddclient[11788]: WARNING: caught SIGTERM; exiting
Feb 5 21:13:45 tux ddclient[11894]: FATAL: Error loading the Perl module IO::Socket::SSL needed for SSL connect.
Suggestion: Make note of the single quotes in /etc/ddclient.conf, without them things do not neccessarily work. Also, make sure that you have all the packages installed.

There is another warning being reported with Ubuntu 10.04 and 11.04.
WARNING: file /var/cache/ddclient/ddclient.cache, line 3: Invalid Value for keyword 'ip' = ''
Thanks to DAnny Flack and Florynce, in the comments below, a solution for fixing this warning is suggested. The suggestion is to delete the cache file: /var/cache/ddclient/ddclient.cache and to restart ddclient. This can be done in the following way:

:~$ sudo rm /var/cache/ddclient/ddclient.cache
:~$sudo /etc/init.d/ddclient restart
That is it. Hope this helps.

References:
1) https://help.ubuntu.com/community/DynamicDNS
2) http://www.linuxquestions.org........697495/#post3413085