this blog is girtby.net

Posted
22 June 2005

Categories
Nerd Factor X

Tags

9 Comments

Dynamic DNS on the Cheap

Setting yourself up so that you can access your home network using a domain name rather than an IP address is one of those little luxuries you’ll come to wonder how you ever managed without, once you have it.

I’ve been doing this for a while now in various different forms, but I like my current setup the best. You may not. I report, you decide.

Firstly note that I said “cheap”, not “free”. But RegisterFly currently sells .info domains for US$2.99, which is hard to beat. If you find one cheaper elsewhere, good luck to you.

Once the domain is set up with RegisterFly, you need to get them to turn on dynamic updates. This is done from the “manage domains” page. Once you do this you will be given a password, in the form of a sequence of hex digits.

One of the nice things about RegisterFly’s service is that updates are done by HTTP. You get to update your IP address by an HTTP GET request to dynamic.registerfly.com. All you have to do is arrange for this request at the appropriate times. For some people this will be whenever you renew the DHCP lease with your ISP. My ISP gives me a (reasonably) constant IP address, so daily updates are fine.

So I have a FreeBSD box which is running most of the time, which is set up to make this HTTP request using the curl tool. On other unix-alikes this could be done using a cron entry, but I chose to incorporate it into the daily maintenance script that FreeBSD uses. Here is my (edited) /etc/daily.local file:

#!/bin/sh
#
# My stuff to do daily
#

# Update our Dynamic DNS entry. This reflects the external address, which could change
# any time as far as we know/care. So update it daily just to be sure.
/usr/local/bin/curl -s 'http://dynamic.registerfly.com/?domain=<mydomain>&password=<mypassword>&host=@' \
        | grep -o '<strong>.*</strong>'

A few things to note:

  • You don’t need to specify the external IP address to use, RegisterFly will work it out based on the source of the HTTP connection. This is really nice, because it means I can run this script anywhere behind my router without extra what-is-my-external-IP magic.
  • The @ in the host parameter means “this domain”, in kinda the same way that . means “this directory in the filesystem.
  • curl’s output is piped into grep so that I can extract the success/failure text without all the HTML guff. The output of this command is appended to the daily email that FreeBSD sends me.

So there you have it. I guess I’ll migrate it to my new router at some point, but for now I’m happy.

Update: registerfly changed their server, they now use <strong> tags instead of <b> tags. Script above updated to reflect this.

9 Comments

Posted by
Sunny
2005-06-22 21:29:41 -0500
#

what’s wrong with dyndns.org? My router supports it natively, too, so every time the IP changes, it auto-re-negotiates. It’s not even linux based.


Posted by
alastair
2005-06-22 21:29:41 -0500
#

dyndns.org is fine. I used to use a similar service from www.dtdns.com. The only trouble with these services is that you get a hostname within their domains, not a full domain of your own. I want a full domain so I can do things like set up my own (virtual) hosts within that domain, and possibly arrange for reverse IPv6 delegation (when I set it up). And besides, $2.99/year isn’t exactly going to break the bank.


Posted by
Chris
2005-06-22 21:29:41 -0500
#

Thanks!

Working as advertised on my BSD box’s domain name.

I considered one of the Sveasoft/WRT-supported DDNS providers too, but having a vanity domain name was a factor.


Posted by
Garth T Kidd
2005-06-22 21:29:41 -0500
#

What happens if you’re behind a transparent proxy? Does it look for the headers that reveal them?


Posted by
alastair
2005-06-22 21:29:41 -0500
#

Interesting question, but I doubt it. Who uses transparent proxies these days though?

Do the transparent proxies store the original client IP address in their headers anywhere? Without that information in the headers there’s no way for registerfly’s servers to know. I think if you’re behind a transparent proxy you’ll have to explicitly set your IP address.


Posted by
Garth T Kidd
2005-06-22 21:29:41 -0500
#

You’d be surprised: at one stage, somewhere in the region of 80% of pages delivered to Australians at home went through one. Now that HTTP is a dwindling proportion of the overall bandwidth consumption compared to P2P, it’s mainly a way to improve customer experience rather than save money – and many carriers are deploying P2P proxies.


Posted by
Robert McGann
2005-06-22 21:29:41 -0500
#

I use http://www.tzo.com and its been working great for years. Router support in almost every router I’ve used, and rock solid. Great way to run a small family webserver from my cable modem


Posted by
Erik
2005-06-22 21:29:41 -0500
#

Great! I have been running some software on my Windows computer while using dyndns, but have not found anyting useful for Linux and registerfly. One more thing windows lacks....


Posted by
alastair
2005-06-22 21:29:41 -0500
#

Thanks Erik,

Actually curl is available for windows as well.

All you need is a decent scheduler. As in, not the Windows one.