Mar
08

Automatically Synchronize Volatile IP Addresses to Host Names with Dynamic DNS

In my last article about hosting multiple remote desktop sessions from one computer, I provided an example of a Remote Desktop Connection across the Internet from the other side of the world in Tokyo. In that illustration, the Remote Desktop client connected to a static IP address. Unfortunately, most home Internet connections do not work that way. Static IP addresses are usually reserved for business, not consumers. Home Internet users are typically assigned a multiple of dynamic IP addresses via DCHP each year. Sometimes these addresses are released every day, every week, every month, every year, every time the computer/router reboots, or every time the MAC address on the Internet node changes. If a home user wants a static IP address, he or she would have to make a special request to his or her ISP and pay extra. The last time I checked, that price ran around $50 per address! For me, that's paying double for my broadband Internet connection!

Dynamic IP address licensing poses a problem when hosting VPN Connections, Remote Desktop Sessions, or just plain Apache HTTP Web Server Connections. Since you can't anticipate when the ISP will assign a new IP address, you might be stuck in Tokyo trying to connect to your home network using an expired IP address. That's not very pleasant at all! Does this inconvenience justify the static IP address fee? I'm a cheapie. So for me, it does not. Besides, there are just some broadband providers who do not offer static IP addresses, period! What's there to do?

 


Dynamic DNS
Enter Dynamic DNS. Dynamic DNS is a service that assigns a domain or a sub-domain to a continuously-changing IP address Internet node. That way, you only have to remember the host name, not the IP address. This is how it works:

  1. You first register with a FREE dynamic DNS provider and choose a sub-domain. Please never pay for this service! There are so many decent sub-domain dynamic DNS providers out there that it’s not even worth it to throw away your money. You can also buy a domain name with a registrar that also supports and provides dynamic DNS.
  2. Set up your router to contact the dynamic DNS provider every time the DHCP server assigns it a new IP address. If your router does not support that feature, you can program your computer to do the same thing or just schedule it to tell the dynamic DNS provider every hour with the current IP address.
  3. Every time the dynamic DNS provider receives new information from your router or computer, it instantaneously updates the record of the sub-domain or the domain to point to the new IP address.

Different Providers
There are so many different free dynamic DNS providers out there its not even funny. It’s actually kind of hard to choose one when you have so many options! I just used the first one I saw and stuck to it. It's been working great ever since. I mean, if it works, don't change it. Right? My provider is FreeDNS. This non-profit organization offers a plethora of domain names to affix your subdomain.

Computer Syncing
My router's dynamic DNS function is kinda screwy so I have to improvise. There are two ways I synchronize my IP address with FreeDNS. The first way is by automatically updating at startup. The second way is by scheduling (cron for *nix users) a sync every hour. On Windows systems, this requires a sync program. FreeDNS lists some pretty decent ones on their Dynamic DNS Clients page. Some sit on your task tray and update periodically. Personally, I use a DOS console-type program called graburl.exe. Try to find graburl.exe on google or just download it here.

Startup Update
To update at startup, I first extract the graburl executable file to my c:\windows\system32 folder. Then, I add a String Value to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run registry key in regedit. You can call it anything you want. I just called it dyndns. For the value data, I enter

CODE:

  1. graburl.exe http://freedns.afraid.org/dynamic/update.php?CRAZY_STRING

replacing "CRAZY_STRING" with the string assigned by FreeDNS. So, every time any user logs on the computer, graburl will sync with the dynamic DNS provider.

dyndns_regedit1.jpg

Scheduled Update
To schedule an update, again, you have to make sure that the graburl executable file is in the System32 folder. Go to "Scheduled Tasks" on the "Control Panel." When you add the task be sure to enter that same command listed above as your run string.

dyndns_cmd.jpg

Note that these two methods will only work if the computer is on. It's not exactly foolproof. You're out of luck when you're trying to send a WOL Magic Packet to an invalid IP address. Really, you're best bet is purchasing a router that will automatically update whenever the IP address changes.

Good Luck!

If you enjoyed this post, make sure you subscribe to hacker not cracker via RSS feed or email update!



Additional Reading

Comment View Comments from Other Readers

Popular Posts

Featured Posts

Related Posts

Recent Posts

What's Your Reaction?


Subscribe to this Blog:

Reader Reactions Elsewhere


 

2 Responses to “Automatically Synchronize Volatile IP Addresses to Host Names with Dynamic DNS”

  1. Kiltak Says:

    Hey there, glad you're still with us after all this time... 🙂

    Btw, could you update the url of our blog in your blogroll? 🙂

    Cheers

    K.

  2. AMD FAN Says:

    Awesome tip thanks!

 
© 2006 and web design of Allan Ray Barizo from [art] [⁄app].
This site is best viewed with FF and at least 1024x768 resolution.