2010年12月14日星期二

GoDaddy Domain + DynDNS

GoDaddy Domain + DynDNS

I host a number of servers and applications, including this blog, on my home network.  I had a static IP address through my cable provider and my domain name,bunkerhollow.com, was registered with GoDaddy.  I use GoDaddy's TotalDNS Control to point my Root ARecord (@) to my static IP.  This directs all traffic on any port, using any protocol, to my home network.  I then configure my mail MX records and setup various subdomains to use as shortcuts (blog.bunkerhollow.com redirects tohttp://www.bunkerhollow.com/blogs/matt/).

The problem is I'm moving to a new area at the end of the month and the local ISP only offers static IP addresses at the "Business Plan" level.  So instead of paying twice what I'm paying now, I've figured out how to achieve the same result using a dynamic DNS service.

Register with a Dynamic DNS Service

  1. I registered with DynDNS, for free, and acquired a hostname of mddubs.getmyip.com.
  2. I then setup my network to automatically update my dynamic hostname when my IP address changes.  Most routers and firewalls have this functionality built-in and/or most dynamic DNS services provide a Windows Service utility which will run on a desktop and accomplish the same task.
Now I've got a domain name which will always take me where I want to go, regardless of how often my system's IP address changes.  The next step is to associate my GoDaddy DNS settings with this new dynamic hostname.  If I could just set the Root ARecord (@) to mddubs.getmyip.com I'd be done but, of course, life isn't that easy.  The TotalDNS Control only allows you to assign ARecords to IP addresses.  You are, however, allowed to assign CNAME Aliases to other hostnames.

Assign CNAME Aliases in GoDaddy's TotalDNS Control

  1. In my case, I created some new CNAME Aliases named wwwmailroot, and assigned them all tomddubs.getmyip.com.
  2. Once the changes have been processed, browsing to http://www.bunkerhollow.com will take me to the correct IP address.

After setting up my CNAMES I'm in pretty good shape.  There's just one caveat, I must always use a CNAME!  This turned out to be a major hassle since I used my domain root (bunkerhollow.com) for just about everything.  I had to change all my systems to use new CNAMES (www.bunkerhollow.com, mail.bunkerhollow.com, root.bunkerhollow.com, etc) which all point to the same place, mddubs.getmyip.com.

Once that was straightened out only a single problem remained, browsing to http://bunkerhollow.com failed.  And so it should, it's still set to a static IP address which I no longer own.  This isn't critical, but I think it's best practice to have http://domain.com and http://www.domain.com always take you to the same place.  I accomplished this using a bit of a hack:

Redirect a Root Web Request to the Correct Location

  1. I setup a free hosting plan for my domain.  During setup, I was given the choice to leave my DNS settings unchanged, which I did.
  2. Once setup was complete, I went to the GoDaddy Hosting Control Panel to obtain the IP address of where my website is located and I set my Root ARecord (@) to this IP.
  3. Then I uploaded a small index.html file which redirects to the correct website:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Redirecting...</title>
    <meta http-equiv="REFRESH" content="0;url=http://www.bunkerhollow.com">
    </head>
    </html>
And it all works as it should!

没有评论: