None of the allegedly automatic methods actually, you know, work. Automatically, that is. So I hacked this together. It grabs the last-known address and the actual dynamic address then compares them. If in sync, it exits: if not, it sends update requests. Not sure what interval to run it on but I guess I’ll just pick one and crank it up or down until I see minimal disruptions in service; ie notes to the logfile that the addresses got out of sync.
#!/usr/local/bin/bash
export THEN=`dnsip mail.thistledew.org` # hostname you're monitoring
#export THEN=`nslookup ${HOME} | tail -1 | awk -F" " '{ print $3 }'` # alternate method w/o djbdns
export NOW=`http://wget -qO- icanhazip.com` # what the internet thinks your address is
if [ ${NOW} != ${THEN} ]; then
# echo "ping"
logger "ip addresses out of sync: updating"
/usr/local/bin/update-afraidns.sh # your various update methods go here
/usr/local/bin/dyndns.sh > /dev/null 2>&1
else
# echo "pong"
exit 0
fi
Update: at the month mark, this seems to be working. I get notified when it needs to sync addresses (usually at just past 4AM) and it’s not too often. It runs every 5 minutes (not sure when I changed it to that: used to be once per hour but that seemed miss some of the IP address fluctuations). I could use some of the other client software I see (OpenDNS recommends one but I never got on with it) but this seems to work. Just enough to get the job done, not enough to be truly useful anywhere else, except as a model of how not to do it, perhaps.
Update, July 5, 2011: If I had thought this through, I would have tested the DNS servers I use more carefully. Turns out one of the four, between two providers, was constantly flaky.
$ host mail.thistledew.org ns1.afraid.org
mail.thistledew.org has address 174.21.112.113
$ host mail.thistledew.org ns3.afraid.org
mail.thistledew.org has address 174.21.112.113
$ host mail.thistledew.org ns9.zoneedit.com
mail.thistledew.org has address 174.21.112.113
$ host mail.thistledew.org ns15.zoneedit.com
mail.thistledew.org has address 174.21.122.16
Someone got voted off the island.