Ubuntu Dynamic DNS Update for OpenDNS

Let me start by saying that I’m a firm believer in both Ubuntu and OpenDNS.  The problem I had was getting OpenDNS setup to correctly identify the IP address assigned by my ISP.   I have a WiFi router that doesn’t automatically update OpenDNS, so I needed a way to keep OpenDNS updated when my IP address changes.   Keep in mind that in a configuration like this (pretty common) my computer’s IP address is NOT the IP address that OpenDNS needs to identify my computer so scripts running on the computer can’t easily identify the routers external address. 

I tried several of the scripts and suggestions I found online but I never got it to work as easily and quickly as I wanted.  After giving up on the suggestions, I came up with what I think is a pretty good (and easy) solution!   Here’s how I did it….

  1. Set up a Dns-O-Matic account (https://www.dnsomatic.com/) – this service is provided free of charge by the OpenDNS folks. It automatically updates the dynamic dns services you select (OpenDns, dynDNS, No-IP, ZoneEdit, etc).
  2. Set up Dns-O-Matic to update your OpenDNS account (they have good instructions on the Dns-O-Matic site).
  3. Edit your /etc/crontab file.
    Code:
    sudo gedit /etc/crontab
  4. Add the following line to the file (changing the User and Password to your DNS-O-Matic User Id and Password):
    Code:
    0 5 * * * root wget https://user:password@updates.dnsomatic.com/nic/update

Now the dynamic Ip address of your router (or your computer if you connect directly) is published to DNS-O-Matic every morning at 5:00 am and DNS-O-Matic publishes that address to all of the dynamic dns services you have set up on your account.

Here are some other resources / methods you might want to try too:

Epicblog has an article describing the use of ddclient.

[Update] 4/11/2012

Well, it seems that OpenDNS has an even simpler solution.  You don’t even have to register with them to get “Family Shield“.  This is basically the full OpenDNS (phishing and adult content filtering) that most people want without the hassle of registering.  Simply use these dns servers in your router and you should be golden!

  • 208.67.222.123
  • 208.67.220.123

I hope something on this page helps!

4 thoughts on “Ubuntu Dynamic DNS Update for OpenDNS”

  1. The only issue with that cron job is it only makes the connection once per day & your computer has to be on when it is scheduled to run.

    I think it would be better to change the schedule to something like the following.
    0 * * * *

    Then it runs once an hour which if your IP address changes at some time during the day you will not be updated.

    Or you could use the following article to use DDClient.

    http://www.opendns.com/support/article/192

    1. I would like to take your points one at a time:

      The only issue with that cron job is it only makes the connection once per day & your computer has to be on when it is scheduled to run.

      This is absolutely true. However, it’s also the case that the vast majority of broadband connections change IP addresses rarely. I have used both DSL (SWBell) and Cable (Comcast) for many years and months go by without getting a new IP address. I understand that with dial-up, this is not the case and it may not be the case will all broadband suppliers.

      I think it would be better to change the schedule to something like the following.
      0 * * * *

      That should work, unless Open DNS considers that spam (some dynamic IP sites consider it impolite to “update” your IP too often with the same address).

      Or you could use the following article to use DDClient.

      As I stated in my article, my Linux box is behind a firewall. That firewall always provides the Linux box the same IP address. DDClient doesn’t know what the internet facing address of the firewall is UNLESS you specifically configure it to hit an external web site (exactly the same way my example does). Unless DDClient hits that site on some kind of scheduled basis (like cron, maybe), it won’t know that the external address has changed. So, it’s a script doing pretty much the same thing my example is doing or it doesn’t work. 😉

Leave a Reply

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