Why?

Well, I have a decent sized infrastructure that runs from my apartment, and wanted to be able to reliably access it by URL when remote. I wanted to be able to use my own domain, without CNAME-ing records to one of the relatively odd/weird free dynamic DNS domains out there. Also, I like a challenge.

How?

As mentioned at the top of this article, the backed for this is a PowerDNS Cluster of 2 servers, one of which runs PowerAdmin as the front end. For information on setting these up, see:

I took the provided ‘dynamic_update.php’ from PowerAdmin and modified it slightly into 2 files, one for updating the A record called ‘dynamicupdate.php’, and one for updating the AAAA record called ‘dynamicupdatev6.php’.

On a linux server at my apartment, I run a small program written in Go that makes a call to a file on the PowerAdmin server called ‘checkip.php’. This file returns the IPv4 or IPv6 IP to the Go updater. The Go updater then makes a request to both the A and AAAA record updater files and updates the database with the new IPs.

This updater does the following:

Runs a check to the DNSServer and DNSServerv6 addresses provided in the config file to determine the IPv4 and IPv6 Public IP addresses

Logs these addresses in the same directory that the updater was run from to “lastip” and “lastipv6” files respectively, if they have changed since the last check

If the IPs have changed, it runs an HTTP request to the dynamicupdate.php and dynamicupdatev6.php files on the PowerAdmin server. These files then update the PowerDNS database.

OK, Really, Get to the Goods!

Ok, Ok, here we go.

On the Linux Server to which you’d like the Dynamic DNS record to point:

Download the Updater

I have the updater available in 2 formats, pre-compiled for CentOS 7 x64, and the raw .go file.

Create the config file

Assign Variables

Here’s a description of the variables used in the file, and how you should assign them:

Username – PowerAdmin Username of the User that owns the Domain you wish to update. Cannot be “admin”

Password – PowerAdmin Password for the above-named user

Hostname – Hostname A record to be updated, should be full hostname, for example “dynamic.example.com”

DNSServer – IPv4 Domain Name of your PowerAdmin server. This is used to check the IPv4 address.

DNSServerv6 – IPv6 Domain Name of your PowerAdmin server. This is used to check the IPv6 Address, and can ONLY be reachable over IPv6.

Protocol – Protocol over which your PowerAdmin Server accepts connections, either: “https://” or “http://”. I strongly reccomend using HTTPS as a username and password will be sent to the PowerAdmin server from the updater.

Setup the Cron Job

I use the following Cron, with the compiled updater and configall.json residing in /myscripts/

*/5 * * * * /myscripts/crondyn-x64-linux > /dev/null 2>&1

On the PowerDNS/PowerAdmin Server

Download the Files

You’ll need the following 3 files:

dynamicupdate.php
dynamicupdatev6.php
checkip.php

The 2 dynamic update files are very similar to the dynamic_update.php provided by PowerAdmin, with minor modifications to better suit this updater. All of these files are available from: