DDclient is a Perl-based DDNS client used to update dynamic DNS records for domains. DDClient, most commonly used in Linux, Unix and FreeBSD, has the same function with DNS-O-Matic in Windows platform. DDClient supports multiple DDNS services and it can fetch your constantly changing WAN public facing IP address in a few different ways.

This tutorial guides you on how to install DDclient on a CentOS machine. The procedure works also on Red Hat Enterprise Linux (RHEL), Scientific Linux and related distributions.

Prerequisites

DDclient requires Perl and IO::Socket::SSL perl library for ssl-support. Patch is required if you need CloudFlare DDNS support, which is not currently built-into DDclient.

In CentOS or RedHat, install with:

yum install perl perl-Net-IP perl-Net-DNS perl-IO-Socket-INET6 perl-IO-Socket-SSL perl-File-Temp patch

In Ubuntu, install with:

apt-get install libio-socket-ip-perl libio-socket-ssl-perl patch

Method 1: Install from Source

Download DDclient (check out for latest version on SourceForge):

wget http://downloads.sourceforge.net/project/ddclient/ddclient/ddclient-3.8.2/ddclient-3.8.2.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fddclient%2Ffiles%2Flatest%2Fdownload&ts=1421763590&use_mirror=hivelocity

Extract the package (assuming DDclient version 3.8.2):

tar -xvf ddclient-3.8.2.tar.bz2
cd ddclient-3.8.2

If you want to use DDclient to update dynamic IP address to DNS hosted by CloudFlare, patch the executable for the CloudFlare API support.

wget http://blog.peter-r.co.uk/uploads/ddclient-3.8.0-cloudflare-22-6-2014.patch

Make sure that the ddclient binary and the patch is at the same directory. Apply the patch:

patch < ddclient-3.8.0-cloudflare-22-6-2014.patch

Patch DDclient for CloudFlare Support

Note
New version of DDclient released after version 3.8.2 will most likely have CloudFlare support built-in, and thus no longer requires any patch.

Downloaded DDclient package does not have automated installation. So after the patch is successful, copy the DDclient files to their respective directories to make it work:

cp ddclient /usr/sbin/
mkdir /etc/ddclient
mkdir /var/cache/ddclient
cp sample-etc_ddclient.conf /etc/ddclient/ddclient.conf
cp sample-etc_rc.d_init.d_ddclient /etc/init.d/ddclient
update-rc.d ddclient defaults

If you’re using Red Hat / CentOS, the last line above should be:

chkconfig --add ddclient

Modify the /etc/ddclient/ddclient.conf file to enter the dynamic DNS service provider and which “A” record of domain that you want to update once the IP address changed. Several examples are included in the config file itself, or you can refer to the guide for supported protocols.

Once the configuration is done, test the configuration with DDclient running in debug mode:

ddclient -daemon=0 -debug -verbose -noquiet

The IP address of the “A” record for the domain should be changed. When everything is OK, runs DDclient using init script, which runs it as daemon with delay set in the configuration file, so additional cron job is not necessary.

service ddclient stop
service ddclient start

To make sure DDclient starts on boot:

chkconfig ddclient on

Method 2: Using RPM Package

DDclient has a RPM package for CentOS, but it does not come with CentOS base packages. In addition, it appears to have a much older version. If you prefer to install through yum, and does not need CloudFlare dynamic DNS support, you have to install RPMForge (now renamed RepoForge) repository to get it. Install RPMForge with following command (assuming you’re running CentOS 6 on 64-bit processor, different package for other releases and processor architecture can be found here):

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm
Note
If you get the following error on the second command above, it means the key has already been imported:

error: http://apt.sw.be/RPM-GPG-KEY.dag.txt: key 1 import failed.

Install the DDclient:

yum install ddclient

Yum Install DDclient

The installation of DDclient is done. You can now configure /etc/ddclient/ddclient.conf to make DDclient works with the dynamic DNS service provider and the domain that you’re using. Several examples are included in the config file itself, or you can refer to the guide for supported protocols.

If you want DDclient to support DDNS on CloudFlare, download the patch specified in method 1 to /usr/sbin/ directory, and run the patch there.

Other setup for DDclient should have been executed automatically when DDclient was installed by yum. So, once the configuration is done, test the configuration with DDclient running in debug mode:

ddclient -daemon=0 -debug -verbose -noquiet

The IP address of the “A” record for the domain should be changed. When everything is OK, make sure that DDclient is running as daemon using init script. In such case, additional cron job is not necessary.

service ddclient stop
service ddclient start
Tip
If you no longer need to use RPMForge (RepoForge) repository, disable it with:

yum --disablerepo=rpmforge update

To re-enable:

yum --enablerepo=rpmforge update