birds like wires


Dead Simple Dynamic DNS Updater

I’d been messing with ddclient, trying to get things to play nicely with DNS-O-Matic, Tunnelbroker and Hurricane Electric’s own dynamic DNS system. Problem was, although everything was configured correctly it still wouldn’t update my DNS! It worked when I told it to, but when the IP genuinely changed, it all went wrong.

It turns out that when my IP changed, ddclient was indeed trying to update things. However, it was trying to do it over the IPv6 tunnel which, due to the altered IP address, was now broken. And I could find no way in the config to specify that the tunnel should be updated first, over IPv4. Hmm.

So, I sacked off ddclient and went for the world’s simplest dynamic DNS client. A bash script and curl.

Easy Peasy

Most of the dynamic DNS services have a simple HTTP method for updating. Some have HTTPS, so you’re not waving your password around in clear text. Switching to an IPv4-only updating mechanism is as simple as this:

Loading ‘ddupd’ from GitHub...

Blam! The script runs through in order, updating the tunnel first. Curl is being told to run over IPv4 (the -4 switch) and not to worry about certificates (the -k switch). Oh, and not to go on about it (the -s switch). There’s a simple little variable length check, just to make sure we’re not being fed something totally bogus for the IP address, and we don’t attempt to update if the IP hasn’t changed. Except for one cheeky ‘heartbeat’ attempt at 5am.

Because I’m running this on Mac OS X Server, I use this launchd job in /Library/LaunchDaemons.

Loading ‘com.ddupd.update.plist’ from GitHub...

It’s very straightforward; just runs every 5 minutes.

And that’s really all there is to it. It took me way longer to write the previous article than to write this script, so I wish I’d not bothered with ddclient from the off. Typically, since setting the script up I think my IP has changed… ooh, once, maybe?

Does this work without playing around with working around IPv6 / tunnelbroker altogether?

I use dnsomatic already with my wrt54g but I recently got an airport extreme 802.11ac. Unfortunately it has a piss-poor implementation of DDNS.

In the end I figure I can just get my OS X server to update my DNSs via dnsomatic. But will it work fine without it, or is there modifications needed for that, and what modifications do I make?

Mike Kormendy left this message 1165 days ago

@Mike Kormendy Sure, there’s no reason you couldn’t leave those out. In fact, the options are right there in the script; just change TBENABLE and HEENABLE from ‘1’ to ‘0’ near the top. Pop your details in for DNS-O-Matic in that section (leaving its enable option set to ‘1’, for obvious reasons!) and you should be good to go. :)

Andy left this message 1160 days ago