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?
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:
- 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.
- 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.
- 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.
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.
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.
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
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.
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.
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.