In addition to running this website, I also run a home server. For convenience,
I point a subdomain of
cmetcalfe.ca at it so even though it's connected using
a dynamic IP (and actually seems to change fairly frequently), I can get access
to it from anywhere.
As a bit of background, the domain for this website is registered and managed through Namecheap. While they do provide a recommended DDNS client for keeping a domain's DNS updated, it only runs on Windows.
Instead, after enabling DDNS for the domain and reading Namecheap's article
on using the browser to update DDNS I came up with the following
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
It basically checks if the IP returned by a DNS query for the subdomain matches
the current IP of the server (as reported by an OpenDNS resolver) and if it
doesn't, sends a request to update the DNS. The
echo commands are there just
to output some record of the IP changing. Maybe I'll do some analysis of it at
To run the script every 30 minutes and redirect any output from it to the syslog, the following crontab entry can be used:
With the script automatically running every 30 minutes I can now be confident that my subdomain will always be pointing at my home server whenever I need access to it.