Linode Forum Index Linode Forum
Linode Community Forums
 


Rolling my own dynamic dns

Click here to go to the original topic

 
       Linode Forum Index -> Linux Networking
Author Message
pratfall



Joined: 10 Feb 2009
Posts: 9

Posted: Thu Apr 16, 2009 10:31 am    Post subject: 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!
Back to top  
caker



Joined: 15 Apr 2003
Posts: 2905
Location: Galloway, NJ

Posted: Thu Apr 16, 2009 10:34 am    Post subject:  

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-Linode;a=blob;f=examples/dyndns.pl

-Chris
Back to top  
pratfall



Joined: 10 Feb 2009
Posts: 9

Posted: Wed Apr 22, 2009 12:51 pm    Post subject:  

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

Code:
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

Code:
$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?
Back to top  
mnordhoff



Joined: 03 May 2008
Posts: 449

Posted: Fri Apr 24, 2009 2:07 am    Post subject:  

You should know that Linode's DNS servers will take up to 15 minutes to reflect changes...
Back to top  
jed



Joined: 28 Mar 2009
Posts: 394
Location: New Jersey

Posted: Fri May 01, 2009 12:31 am    Post subject:  

pratfall wrote: 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.
Back to top  
marmida



Joined: 09 Sep 2009
Posts: 2

Posted: Tue Sep 15, 2009 4:01 pm    Post subject:  

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



Joined: 21 Mar 2009
Posts: 35

Posted: Wed Sep 16, 2009 1:26 am    Post subject: Re: Rolling my own dynamic dns  

pratfall wrote: 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.
Back to top  
dokma



Joined: 09 Nov 2010
Posts: 1

Posted: Tue Nov 09, 2010 3:51 am    Post subject: DynDNS with PowerDNS  

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.
Back to top  
 
       Linode Forum Index -> Linux Networking
Page 1 of 1