Dynamic DNS (DDNS) can give your home’s changing IP a reliable hostname. I recently redid mine with some new tools. Here’s how it went!
When I first had high-speed internet, the ISP had helpfully printed my static IP address on the bottom of the massive cable modem. This consistent, reliable address was convenient for the multiplayer PC games of the time, which often required manually entering an IP to connect. One of my old friends still has that IP memorized!
These days, everyone uses DHCP with finite leases, so your public IP changes from time to time. If you want reliable access from outside, the solution is to use Dynamic DNS. In short, you run a dynamic dns client inside your network, which connects to your domain registrar and automatically updates a record to point to your current IP. Many consumer-grade routers have this capability built-in.
I’ve done this for years, using whichever free service happens to be supported by my router. Recently, I’ve been annoyed by the service’s constant attempts to convert me to a paying customer, so I decided to DIY it with a subdomain I already own.
My existing registrar’s DDNS support looked pretty poor, so I transferred a domain to Google Domains, where support is much better. I chose Google in part because its help page offers settings for a client called inadyn, which I recognized from my router logs. After adding a new “Dynamic DNS” “Synthetic record” to the domain, it was time to reconfigure my router.
Here’s where I hit a speed bump. I’d been using a third-party router firmware called DD-WRT for a few years, mostly for its larger set of supported Dynamic DNS services.
I didn’t get very far. Long story short, even the latest releases of DD-WRT are built with an ancient version of inadyn that won’t work with Google Domains (and, indeed, can’t even use TLS). I was ready to give up and run a client on a computer when a friend suggested I try another router firmware.
I looked around and found that OpenWRT seems to be the most active third-party router firmware, with support for a large set of DDNS services. I restored my router to its factory firmware and then installed OpenWRT.
Adding Dynamic DNS Support to OpenWRT
OpenWRT’s philosophy is to provide a bare-bones platform with optional modules for various features and services. This is fantastic for space-constrained devices (my router has a whopping 8MB of storage!), but it means we need to do a little extra work to enable DDNS.
After an embarrassing amount of troubleshooting (documentation here), I can pass on one simple guideline: Make sure to update the package list, and then install the packages
As I installed packages, I nervously watched the disk usage grow:
After the packages are installed, the configuration will appear in the UI under Services -> Dynamic DNS.
Configuring DDNS within OpenWRT is pretty easy! Just paste the hostname and Google’s randomly-generated credentials into OpenWRT’s UI.
Once you enable the rule, it will attempt to connect. A successful log looks something like this:
012429 : #> /usr/bin/wget -nv -t 1 -O /var/run/ddns/myddns_ipv4.dat -o /var/run/ddns/myddns_ipv4.err --ca-directory=/etc/ssl/certs --no-proxy 'https://foo:firstname.lastname@example.org/nic/update?hostname=subdomain.example.com&myip=XX.XX.XX.XX' 012430 : DDNS Provider answered: good XX.XX.XX.XX 012430 info : Update successful - IP 'XX.XX.XX.XX' send 012430 info : Forced update successful - IP: 'XX.XX.XX.XX' send 012430 : Waiting 600 seconds (Check Interval)
The IP shows up in Google Domains’ UI, and the hostname should start working shortly.
I concede that most people don’t need this, especially in today’s era of laptops, software-as-a-service, and the cloud. If you find yourself wanting external access to something at your house, though, Dynamic DNS might be just the ticket.
For example, you could forward a port and remote in to your desktop computer, if you still have one of those. Or access a network camera, or the media library on your NAS, or your garden watering system.
Or, even if you don’t need DDNS, it might be worth checking out OpenWRT for some of the other cool stuff it can do, like guest networks, VOIP, QOS, and VPN.
Besides, it’s really cool to be able to ssh to your router!