dns-sync: a DynDNS client

First, a couple of words about the DynDNS service, quoted from the web site:

DNS was created to make the Internet easier to use. Before DNS, computers connected to the Internet were only reachable by their computer address, called an IP address, written like 63.208.196.66. Internet pioneers created a system called DNS which allowed hostnames like "www.website.com" and "mail.mycompany.com" to be used in place of the numbers. This translation occurs automatically.

DynDNS started with a free Dynamic DNS because some Internet users have IP addresses that change. We created a method that allows users to update the IP address associated with a hostname that we provide, enabling users to serve content or keep connected to their computer.

When you use the service, you will need a client to update the DynDNS registry upon IP change. There are many clients available for free. The reason I wrote my own is because I was too lazy to read the installation instructions for the other clients. Anyway, the client works satisfactorily according to my standards, which are not particularly high. If you want more serious contenders, go there.

The client is written in Rebol and is meant to be run as a cron job under the different flavors of Unix or as a task under the different flavors of Windows. It should also work for the mac and all the other platforms on which a rebol interpreter is available. Personnally, I have set the script to run every five minutes, upon which time it will do the following:

  1. Check how much time passed since the last IP update. If more than 28 days have passed, proceed to a maintenance update on the DynDNS servers to avoid account expiry. If the last IP update goes back to less than an hour, exit to give a chance to the DynDNS registry to be effective.
  2. Otherwise, exit if the IPs match, or proceed to an IP update if there is a discrepancy. If an IP update occurs, the client will send you an email with the return code.

This client was written according to my needs. It might not suit yours. For example, the way the program determines the current IP is by polling the router, but that's just one way of doing it. Another thing is that error handling is very basic: any other return code aside of "good" after an IP update will put the client in safe mode, to avoid further non-succesful updates which would result in the suspension of the account (the DynDNS service is quick to label such behavior as abusive).

The client supports multiple dynamic hosts. After downloading the source code, all you need to do is change the user specific variables that you will find in the first section of the program. Good luck. (If you need help, get in touch and I'll see what I can do.)

Source code: dns-sync.r.

 

about | work | code | silly | cv
home | blog | contact | back