Custom DDNS

A few years ago, I set up a home server. It runs a few services - mostly MythTV and an FTP server. When I first set it up, I gave it DDNS through DynamicDNS (it was I became fed up with their policies fairly quickly - especially their expiration rules, and replaced them with DNS. offered free DNS, but the service also has an expiration. I missed a deadline, and my lovely domain ( went dark. But now, I have my very own address:, and all of its derivatives. I've wanted to give the home server the address for a while, and now I have time to fiddle.

Every computer on the internet has an IP address which identifies it uniquely. But you browse using names, which aren't directly linked to machines. Essentially, when you type an address into the URL bar, various servers recursively evaluate it, looking for an IP address to connect to. For my URL,, the request is first passed to a root server. That server looks at the net portion of the URL, and forwards the request for home.nitkin. to the root net server. That server resolves nitkin to a machine owned by IMeanWebHosting, and asks that server to resolve the last part of the URL: home. home resolves to the IP address of my home server, which is returned to you.

(In reality, there's tons of caching going on. As likely as not, searches like are common enough that the first server you ask has the IP saved.)

To assign the name, I just needed to add an A (address) record to the nameserver. Adding the record is trivial. Keeping it up to date is harder.

See, there are two kinds of IP addresses, static and dynamic. Most web servers run on static IP's, which means that they're assigned to the same address day after day, year after year. Most homes run on dynamic IP's, which are allowed to change at the operators convenience. My home IP has been stable for months, but isn't guaranteed to remain so.

So, I need some mechanism to update the records. I found some code online, but it

Warning: Invalid argument supplied for foreach() in /home/nitkinne/public_html/ddns/ddns.php on line 35

no worky so good. At a guess, it was for an old version of CPanel. Or something.

Without further ado, I looked up the CPanel API (CPanel is the administrative backend I use). Their documentation is a mess. There's an internal and an external API, and the external one supports both JSON and XML. And they don't explain enough.

I'm going to throw in the towel for now. It looks like, to set DNS records, I need API calls for WHM, not CPanel. I can only log into CPanel for now, so that's that.

Regardless, the server's online until my home IP changes, which will probably be many months.