ddclient is a program for Linux that negotiates with http://dyndns.com to allow systems with dynamic tcp/ip addresses to have static DNS names. This was originally written in 2011, and revisited in 2013. dyndns abandoned their free product some time ago, possibly as a result of being bought by Oracle. I marked the page is ‘deprecated’ on 4th Feb 2019. The rest of this article comprise my notes on how to install ddclient on an AMI. 

2013

I made a new Amazon machine. Don’t muck around, install ddclient using apt-get. The post install script now takes you through the critical configuration questions and writes a .conf file.

If you make the AMI first, you have the AWS public IP address from the public ip name. The curl command below also still works

  1. Make a dns name at dyndns.org, use the AMI public ip address
  2. Install ddclient using apt-get
  3. Choose www.dyndns.com
  4. Provide your login/password
  5. Select checkip.dyndns.com
  6. Use select from list
  7. Select your domain name
  8. Wait for the name to propagate <- most imortant

2011

I decided to use ddclient to keep a constant name on my Amazon EC2 Machine. This was an Ubuntu image. I therefore have the choice of using the package manager or a tarball install, although the latter is not automated.

Obtaining the Package from dyndns

I originally downloaded it from dyndns.com and installed it on my, now defunct, Cobalt Qube.

This section was written in 2011 when I replaced my Cobalt Qube with an AMI.

I used wget to pull down http://cdn.dyndns.com/ddclient.tar.gz. This was version 3.7.3. It has a README which documents how to install the client. I used update-rd.d to install the start/stop script which I called rc.ddclient. I used the debian sample as my model. This required the addition of the LSB Init Headers. I added the login credentials to the appropriate configuration file.

  • The guys at ddclient say I didn’t look hard enough for an LSB compliant script.
  • The default configuration file is held at /etc/ddclient/ddclient.conf.

ddclient needs a directory, /var/cache/ddclient, it doesn’t make it in the initialisation scripts, so this needs to be done by hand.

I have an Ubuntu image so I needed to install the PERL SSL libraries.

sudo apt-get install libio-socket-ssl-perl

other distros may have this already, and using the package manager does this for you.

N.B. ddclient tries to mail its messages. My server doesn’t have sendmail configured. This seems to be configurable using parameters in the config file. <say more here>

Using an Ubuntu package

ddclient is available as a package and can be installed the usual way

apt-get install ddclient

It doesn’t have an EC2 option and the post install script is interactive. I chose the simplest I could and then edited the config files by hand.

It locates stuff in different places as Ubuntu usually does.

It has a script conf file in /etc/default/ddclient, this is a shell and impacts the initscript. It has three switches which determine if it runs as a daemon and how frequently it polls.

The default conf file is /etc/ddclient.conf not /etc/ddclient/ddclient.conf. I have linked this location to my conf file in /etc/ddclient. So I now meet both standards, and I hope can use apt-get to keep the package up to date.

Discovering the instance public address

In addition to the instructions in the ddclient README, I needed to look at the instructions documented at Amazon EC2 – What You May Not Have Known a blog article at codesta.com. This details the magic runes required to make ddclient work for an amazon ec2 instance. It clearly needs the public ip address and uses the ddclient -cmd tool to get it.

use=cmd, cmd='curl http://169.254.169.254/2007-08-29//meta-data/public-ipv4'
protocol=dyndns2
server=members.dyndns.org
wildcard=YES
custom=yes, your.server1.com, your.server2.com

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.