I have been using Linode for a long time. More than 2 years, actually – that’s how good their service is. Excellent packages, unrestricted access to your machine, outstanding support and community are just a few of Linode‘s advantages when compared to other VPS (virtual private server) providers. Yes, they’re not the cheapest; but as you grow older and smarter, you’ll eventually learn that cheap also means bad quality 🙂 The Internet is already full of good reviews about Linode, so this is my contribution.


For quite a while now, I’ve been also using happily the TomatoUSB firmware for my router. It’s rock solid and easily outperforms any factory provided firmware (have to specify though that I’m using Toastman‘s builds, which are very-very good).

As many other geeks, I like to access my router remotely for various reasons. However, if you don’t have the luxury of a static IP, but you’re given a dynamic IP from your Internet Service Provider instead, you have to rely on Dynamic DNS services to do this. A dynamic DNS update means that whenever your WAN IP is changed, a request is made to a 3-rd party service which attaches your new dynamic IP to a domain name. The service was free from several providers, until recently when most of them started charging for this feature.

So, if you have a Linode account already which includes free DNS hosting, why not use your own Linode hosted domain to take care of dynamic DNS updates ? it’s quite easy and this tutorial will show you how to do it.

First, you have to get the Linode API key. This is found under your Linode “my profile” link and it should look like a long string of digits and letters. Let’s say it is “abc123xyz678cde450” (it’s a much longer string in real life).

Let’s assume you have yourname.com as a domain hosted with Linode and you’ll create the subdomain router.myname.com. Go to the DNS manager and create this subdomain.

Now, you need to retrieve the domain ID and subdomain ID – this is needed so Linode knows what subdomain you’re updating. Remember the API key you retrieved before ? we’ll use it now.

Open a new browser window and enter this URL:


https://api.linode.com/?api_key=abc123xyz678cde450&api_action=domain.list

You will see an array containing all your hosted domains. We’re interested in the DOMAINID value, which is the first one listed in a row. It should look something like this:


{"ERRORARRAY":[],"DATA":
[{"DOMAINID":123456,
"SOA_EMAIL":"vaxxi@vaxxi.net",
"DESCRIPTION":"","TTL_SEC":0,"RETRY_SEC":0,"EXPIRE_SEC":0,"STATUS":1,
"DOMAIN":"myname.com","TYPE":"master","REFRESH_SEC":0,"MASTER_IPS":""},
"ACTION":"domain.list"}

123456 is your domain ID. Write it down and let’s proceed further: retrieving the subdomain ID. Again, open a browser window and enter this URL:


https://api.linode.com/?api_key=abc123xyz678cde450&api_action=domain.resource.list&DomainID=123456

You’ll see now a listing of all resources available under yourname.com. Of course, you’re interested in the “router” entry you created before. Look for a line similar to this one:


{"DOMAINID":123456,"PORT":80,
"RESOURCEID":2998877,"NAME":"router",
"WEIGHT":5,"TTL_SEC":0,
"TARGET":"22.33.44.55","PRIORITY":10,
"PROTOCOL":"","TYPE":"A"}

The Domain ID should be the same, obviously. Write down the resource ID. Now you have the API key, the domain ID and the resource ID. With these, we can build the dynamic DNS update URL.

Go to the TomatoUSB interface and configure it for remote access through SSH and/or WWW. Next, go to Basic > DDNS. Fill out the sections like this:

Dynamic DNS – IP address = Use WAN IP address, Auto refresh every = 1 days
Dynamic DNS 1 – Service = Custom URL

In the URL box, enter this string:


https://api.linode.com/?api_key=abc123xyz678cde450&api_action=domain.resource.update&DomainID=123456&ResourceID=2998877&Target=@IP

Tick the “Force next update” checkbox and press Save. When the page reloads, you should see:

Last IP Address - Sat Mar 31 2012 21:39:02 GMT+0100 (CET): 1.2.3.4
Last Result - Sat Mar 31 2012 21:39:02 GMT+0100 (CET): {"ERRORARRAY":[],"DATA":{"ResourceID":2998877},"ACTION":"domain.resource.update"}

That means everything went well and your router is now accessible at router.myname.com through WWW/SSH/ping and whatever service you might have configured.

Tagged with:
 

3 Responses to dynamic DNS updates with TomatoUSB and Linode

  1. Tudorache Gabriela says:

    Buna ziua,

    Ma iertati ca va deranjez .Vin cu rugamintea la d-voastra sa scrieti un articol pe blogul d-voastra si sa distribuiti mai departe pe facebook despre mama mea, Gabriela Tudorache care este foarte bolnava . Este diagnosticata cu meningiom , o tumoare cerebrala care i-a afectat vederea si trebuie sa se opereze cat mai repede la o clinica din Germania unde ni se cere 35 000 EUR plus cheltuieli de cazare si transport .

    Viata si vederea ei depind de aceasta operatie , iar mie si fratelui meu ne este foarte greu sa o vedem cum indura zilnic cumplitele dureri de cap si ametelile .Timpul nu ne permite sa asteptam si va rugam sa scrieti un articol despre cazul ei . Mai multe detali le gasiti pe http://gabrielatudorache.blogspot.com/. Sau ne puteti contacta la nr de tel. 0724342082. Va rugam , daca sunteti de acord sa ne lasati si un raspuns .
    Va multumesc din inima pentru sprijinul acordat.

    dumitru_gabriela31@yahoo.com

  2. Tim says:

    Thanks for the tip on this! I was busy trying to write something in PHP to make the API calls for me, but not succeeding.

    This turned out to be a heck of a lot easier, and didn’t need any external resources.

    Thanks!!

    • VAXXi says:

      Glad it was useful. It’s a nice trick; I knew most routers have support for commercial sites, but having the custom URL option was indeed clever.

Leave a Reply

Your email address will not be published. Required fields are marked *


Anunţă-mă când sunt comentarii noi. Te poţi abona fără a comenta.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Set your Twitter account name in your settings to use the TwitterBar Section.