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

11 comments:

Mitha said...

hi i get this message:
ddclient[6193]: SUCCESS: updating yusufmitha.za.net: IP address set to 198.54.202.146 (201: No records need updating.)

Any idea what this means?

cantormath said...

It means that the IP is already sunk. So there is nothing to do. If you change the IP in Zoneedit to some random Ip address, then it will same something else.

Chris said...

Sweet! Worked on Ubuntu 9.04 like a champ!

DAnny Flack said...

Thanks for the post.

I don't know if it was related to my problem, but I had to delete the cache file: /var/cache/ddclient/ddclient.cache
because I was getting this error after your steps:
WARNING: file /var/cache/ddclient/ddclient.cache, line 3: Invalid Value for keyword 'ip' = ''

after another restart, it's working great.

Anonymous said...

I just did this on Ubuntu 10.4 LTS. Excellent instructions, although I found one change I needed to make.

You list "www.zoneedit.com/checkip.html" for the web lookup. With ZoneEdit's recent look and feel update, that should has to be 'legacy' instead of 'www', as in "legacy.zoneedit.com/checkip.html".

Thanks!

cantormath said...

@Anonymous,

I updated the howto with your suggestion.

Florynce said...

I was having the same error as Danny Flack and his method fixed it for me in Ubuntu 11.04. Thanks for the great guide!

cantormath said...

@Florynce and @DAnny Flack

When did you need to delete
/var/cache/ddclient/ddclient.cache
Does that file show up after install? After you start ddclient? etc.

Thanks much for the input.

Oldarney said...

Epic. Zone edit's user interface is quite convoluted. Once I got the zone thing to work, the updates flowed.

cantormath said...

@Florynce and @DAnny Flack

I added a note at the bottom with Danny's suggestion. Thanks.

ProgressiveOne said...

my fix to the IP issue

on this line:
use=web, web=checkip.dyndns.org, web-skip='Current IP Address: '

for current IP address, I put my IP address given by the router. ie, 192.168.2.103

use=web, web=checkip.dyndns.org, web-skip=192.168.2.103

error is now gone. Good luck.