Wednesday 10 July 2013

Dynamic IPv6 updates using ddclient for records hosted on Hurricane Electric DNS



Overview


I have a small home network with a number of internal servers.  After enabling IPv6, all of the internal machines now have a public, DHCP assigned IP.  It would be nice to have these IPs update automatically in the DNS when they change.







Prerequisites


You'll need the following:

Configuration


DDNS

In this section you will create a new AAAA record in your domain hosted with HE DNS service and set it up for DDNS updates.
  1. Login to on Hurricane Electric Hosted DNS service portal.
  2. Edit the zone for your domain name (e.g. mydomain.me).
  3. Create a new AAAA host record for your host (e.g. myddnshost.mydomain.me).
  4. Make sure to tick the box "Enable entry for dynamic dns".
  5. Click the "refresh" icon in the DDNS column next to your AAAA record.
  6. Click "Generate a key", record it somewhere and click "Submit".

DDClient


The current version of ddclient (3.8.1) does not support updating AAAA records.  You will need to patch it using a patch written by Eduardo TrĂ¡pani.

Since the patch cannot be applied in its current form to the present release of ddclient, I've included a patched copy here so you can update your ddclient installation as follows:
$ cd /tmp  
$ wget https://www.dropbox.com/s/fwkjh1jlt4rlu5p/ddclient.ipv6  
$ cp ddclient.ipv6 /usr/sbin  
$ mv /usr/sbin/ddclient /usr/sbin/ddclient.ipv4  
$ ln -s /usr/sbin/ddclient.ipv6 /usr/sbin/ddclient 
$ chmod 755 /usr/sbin/ddclient.ipv6
$ service ddclient restart  

Next, update your ddclient.conf to include a block to update your DDNS record:
# Configuration file for ddclient  
#  
# /etc/ddclient.conf  
   
daemon=300                  # check every 5 minutes  
syslog=yes                  # log update msgs to syslog  
#mail=root                  # mail all msgs to root  
#mail-failure=root          # mail failed update msgs to root  
pid=/var/run/ddclient.pid   # record PID in file.  
   
usev6=if, if=eth0  
protocol=dyndns2,                            \  
server=dyn.dns.he.net,                       \  
login=myddnshost.mydomain.me                 \  
password=myddnshost.mydomain.me's API key    \  
myddnshost.mydomain.me

Note, you can add multiple hosts to update in your ddclient.conf.


Testing


Renew your DHCP lease and somehow force an IP change or just set your host's IP manually in the HE DNS portal to something other than what it is currently.

Then, run a manual ddclient update as follows:

$ ddclient -force  
 SUCCESS: updating myddnshost.mydomain.me: good: IP address set to 2001:470:890a:bcd::1000  

Check to make sure your AAAA record has been updated:
$ dig aaaa myddnshost.mydomain.me  
...  
;; QUESTION SECTION:  
;myddnshost.mydomain.me.      IN   AAAA  
   
;; ANSWER SECTION:  
myddnshost.mydomain.me. 300   IN   AAAA  2001:470:890a:bcd::1000  


References


I've used the following reference material to prepare the solution described in this article.  Many thanks to the respective authors.


3 comments:

Unknown said...

Thank you very much for this guide. The only thing that seems to be missing is that you need to do a "chmod 755 ddclient.ipv6" to make it work.

belodetek said...

Many thanks, I've updated the post.

-- ab1

yuvi said...

Great post!
thanks!