Rolling my own dynamic dns

I have my home system on a cable modem, and my router behind it is running Linux (FreeWRT) with a script that gets called any time my external IP address changes that updates my no-ip account.

What I'd really like to do is use my own domain for this host, rather than no-ip.org, and change my DHCP script to just update the record in my DNS server.

I know BIND can do this, but I chucked BIND a year ago after I saw it was steadily growing to eat 10-20% of the RAM on my Linode, even though I host all of 4 very low-traffic domains. I'm using MaraDNS now, which I very much like, but the only way to add/change a record is to restart the whole server.

I'm looking at a bunch of options, and thought I'd ask the forum what you all are doing. What I've come with so far is:

Option a: continue running Mara as my recursive DNS server, but throw my zone data in LDAP and use ldapdns to resolve my own zones. On the LDAP server, grant write access to only the dynamic hostname(s) zone data, and, on the FreeWRT router, write a script that updates my dynamic IP in LDAP.

Option b: Migrate to Power DNS and use the LDAP backend. I'm looking into PowerDNS, and would particularly like to hear from the forum your impressions of Power DNS vs BIND or Mara, whether you've used the LDAP backend, and how its performance and memory footprint look for a very small site.

Option c: If there's some way I can dynamically push zone data to Linode's DNS system and have it update immediately (TTL notwithstanding), migrate my SOAs to Linode. If there's a way to do this, I'm missing it. Maybe something in the web API?

Option d: Have my script on the router update a file in my Mara config and give it permission to restart Mara. Easy, but viciously ugly, IMO.

Thanks!

7 Replies

The API can do this. There's an example script in Mike's perl bindings:

http://www.linode.com/api/

http://git.thegrebs.com/?p=WebService-L … /dyndns.pl">http://git.thegrebs.com/?p=WebService-Linode;a=blob;f=examples/dyndns.pl

-Chris

This works perfectly. It was sad putting Mara to sleep after serving me so well for so long, but its time to move forward! :D

One question, I want to know if the domainResourceUodate is successful. I tried

my $result = $api->domainResourceUpdate(resourceid => $resourceid, target => $pubip); 
print $result; 

but that just gave me a number that didn't seem to mean anything.

Currently, I'm doing

$api->domainResourceUpdate(resourceid => $resourceid, target => $pubip) or die "Failed updating record";
print "$record.$domain updated"; 

based on the assumption that if there's a problem, the domainResourceUpdate method won't return true. Is there a nicer way to do this?

You should know that Linode's DNS servers will take up to 15 minutes to reflect changes…

@pratfall:

Is there a nicer way to do this?
I'm not sure about the Perl bindings, but in the response you're looking for something in ERRORARRAY. I tried to modify a resource that didn't belong to me, and ERRORARRAY contained 1 element, which contained a message and an error code.

I assumed this to boil down to "if ERRORARRAY has an element, print the message in element 0 (unless you're running batch) to stderr and die". Not sure how you'd do that with the Perl bindings, though.

Nothing to add but: this is awesome; you guys are awesome.

@pratfall:

I have my home system on a cable modem, and my router behind it is running Linux (FreeWRT) with a script that gets called any time my external IP address changes that updates my no-ip account.

What I'd really like to do is use my own domain for this host, rather than no-ip.org, and change my DHCP script to just update the record in my DNS server.

Why not just CNAME the hostname in your domain to whatever the domain name from the dynamic DNS service? That's what I've been doing for years, its simple, and it works.

I think that PowerDNS is a perfect solution for this kind of issues. It comes with MySQL backend and one of the advantages of that is that as soon as you update a record in the database your domain record is updated, no need for a restart of any kind. There is a very simple DynDNS solution for a few domains (not for the public kind of DynDNS service type usage) with source code that you can check out here: DynDNS with PowerDNS. It uses a bit of PHP and a bit of BASH scripting via SSH authenticated using keys. Takes just a few minutes to get rolling on Debian.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct