Dynamic DNS Updater

This script is designed to run as a cronjob.  It will check www.whatismyipaddress.com (to make it NAT-happy) for your external IP and if it is different than the one it has on file, it will update the DNS records.  While the script is currently configured for ZoneEdit, it would be trivial to make it work with other dynamic DNS services such as DynDNS.

#!/bin/bash
# This script will check the current IP against the
# stored IP and if the two are different will force
# a dynDNS update.

loc=/etc/external_ip
stored_ip=$(cat $loc)
curr_ip=$(links2 -dump http://www.whatismyipaddress.com \
          | awk '/Your IP address is/{print $5}')
user_name=
user_password=
domain=

if [ "$stored_ip" != "$curr_ip" ];then
  wget -O - --http-user=$user_name\
		--http-passwd=$user_password\
		'http://dynamic.zoneedit.com/auth/dynamic.html?host='$domain
  echo $curr_ip > $loc
fi