dd-wrt has built-in support for a whole list of Dynamic DNS services. Unfortunately, they only support HTTP-based services. I use a standard RFC2136 DNS update. Here’s how to add nsupdate support to dd-wrt.
Installing
I again used the openwrt modules, nsupdate is contained within bind-client. There are, however, several dependencies:
- libbind9.so.40.0.3, libdns.so.43.0.0, libisc.so.41.1.0, libisccc.so.40.0.0, libisccfg.so.40.0.3, liblwres.so.40.0.0 (and symlinks) from bind-libs
- libcrypto.so.0.9.8 from libopenssl
These are some serious libraries, takeing up 2.7MB of free space…
Configuring
I tried to use SIG(0), but that failed. nsupdate complains about a missing symbol ‘flockfile’. So I settled for TSIG authentication. Since this is a post about dd-wrt, I’ll assume the sever is already set up and tested, so I’ll go straight to the config files:
/jffs/etc/ddns.key:
fqdn.of.key. 0huPr3nqFnxUETlrM/VxGg==
/jffs/etc/config/ddns-update.wanup:
#!/bin/sh # wanup scripts seem to run without LD_LIBRARY_PATH set export LD_LIBRARY_PATH='/lib:/usr/lib:/jffs/lib:/jffs/usr/lib:/jffs/usr/local/lib:/mmc/lib:/mmc/usr/lib:/opt/lib:/opt/usr/lib' # wanup scripts have the IPLOCAL variable set, but cron does not if [ -z "$IPLOCAL" ]; then IPLOCAL=`ip addr sh dev ppp0 | grep 'inet ' | cut '-d ' -f6` fi sleep 30 # wait for IPv6, DNS, … to stabilize echo -e "server ddns.master.server.fqdn\nkey `cat /jffs/etc/ddns.key`\n update delete fqdn.to.set A\nupdate delete fqdn.te.set TXT\n update add fqdn.to.set 300 A $IPLOCAL\nupdate add fqdn.to.set 300 TXT `date "+%Y-%m-%d_%H:%M:%S"`\n send" | /jffs/bin/nsupdate
I cut that last echo-line into pieces for readability, make sure that it’s one single line (from echo all the way to nsupdate).
I added the following line to the Additional cron jobs on the webinterface. Contrary to the dd-wrt wiki page, /jffs/etc/crontab does not seem to work. This will run the ddns-update script every hour, at 5 minutes past the hour:
5 * * * * root /jffs/etc/config/ddns-update.wanup