OpenWRT Part 1 – Dynamic DNS and wake-on-lan

Have you missed the first ripping instalment of this odyssey? Then read Part 0.

Dynamic DNS

Most home connections don’t have a static IP, this means that if you are trying to run some services from your house such as ownCloud or whatever, you’ll have a hard time staying connected as the IP address jumps around. I’m fortunate in that whilst VirginMedia doesn’t give out static IPs, they’re rather lethargic and, so long as you stay connected, don’t change often. Still, it’s nice to know that things will be kept on-line whilst I’m away – enter OpwnWRT’s dynamic DNS support.

DD-WRT has a similar feature, I daresay other firmwares too, but I never got around to implementing it. My registrar Mythic Beasts also appears to have updated some of their docs and I was in for a pleasant surprise. Those steps get you about 80% of the way there. The first trick is setting your DNS API key which is buried (at the time of writing) in “My Account/My Domains/Settings/Nameservers and DNS/DNS API”. Set a nicely long and bizarre passphrase.

A quick “opkg install luci-app-dns wget ca-certificates” later and I was all set to go. I was a bit puzzled by the Mythic docs being in conflict with the OpenWRT ones and decided to trust the horse’s mouth (i.e. OpenWRT) as well as do things via the web GUI. It’s not that I can’t do things via the CLI, but I’ve just installed a GUI and I’m damned well going to use it! Also, the GUI has some basic validation and stops me being too much of a cretin.

Logging into the router, going to “Services/Dynamic DNS”, typing in “mythic” (or name of your choice) and then clicking “Add” had me at the main config page where I found “Mythic Beasts” as an option in one od the drop-downs. Then it’s really just case of plugging in the values. For Mythic, the hostname is what you want to update (e.g. foo.domain.com) and username the record (e.g. domain.com). Don’t give it your Mythic login username or it won’t work. Not that I did that. Ahem.

A few text entries is all it takes to get Dynamic DNS working.

A few text entries is all it takes to get Dynamic DNS working.

I wanted this secure which is why I installed wget and ca-certificates above. Enabling HTTPS was a single click. Once running I gave the logs a shufty and saw the expected results. Mythic had been contacted over HTTPS and the updated IP sent. After the IP update had propagated, I was able to confirm that I could access my own domain from within the LAN – something that’s not possible on DD-WRT without some rather convoluted iptables re-plumbing.

A few text entries is all it takes to get Dynamic DNS working.

A few text entries is all it takes to get Dynamic DNS working.

Wake-on-LAN

Once nice little feature I liked from DD-WRT was it’s WoL support (this is where you can send a “magic packet”) to wake machines when powered off. Remember to configure them to respect it and, of course, they need to be powered at the wall. The “magic” isn’t actually magic, magic.

opkg install luci-app-wol” will see the web GUI support installed. In DD-WRT this was a table of WoL clients that you could start, which was a sub-set of all the possible clients you’d chosen. In OpenWRT it’s two combo boxes. The first allows you to select the interface, the second the client. Amusingly it allows you to blast magic packets out over the Internet – what use that is I have no idea. Still, it works and which you prefer is personal taste really.

Web GUI Wake-on-Lan

WoL is a simple case of selecting the interface and then the device.

You can also install “wol” which will allow for greater scripting so that, for example, when the router powers on it can automagically bring various computers on-line for you. More in the OpenWRT docs.

Nothing too difficult just yet. The OpenWRT experiment continues.

Related articles

Leave a Reply