I’ve blogged about my server closet in my home office before. I used to have three servers running in my home office and for Internet service I had AT&T DSL with 5 static IP addresses. That all changed by accident when I was looking into current pricing and found I could upgrade my speed and I would get a lower cost. However, someone over at AT&T DSL misread my order and changed me from static to dynamic, so yesterday morning I got knocked offline. I spent over 2 hours on the phone with them and they told me it could take up to 48 hours before they could get me static IP addresses again. So I started looking into getting my blog back online with a dynamic IP.
One of my goals for last year was to outsource most of my home network to external servers because I didn’t like dealing with it. So last year I did outsource email to Google Apps, DNS and some websites to Godaddy, and Subversion to Dreamhost. Because of that I was able to downsize to a single server which I run a few websites on. I also had been having network speed issues so I had just purchased a new router+dsl modem, the D-Link DSL 2540B which happens to support Dynamic DNS.
Setting it up:
- You need to make sure your router supports Dynamic DNS and you need an account with a Dynamic DNS service. I used dyndns.com since they have free accounts. I setup mine to be bryantlikes.dyndns.org.
- Delete the A record for your DNS (if you have one) and then create a new CNAME for your domain that points to the Dynamic DNS name. So, for example, blogs.sqlxml.org has a CNAME that points to bryantlikes.dyndns.org. If you have other CNAME records already (for example, www), then point those to your dynamic DNS entry as well.
- Forward port 80 to your web server in your router settings. This is different for each router, D-Link calls it Virtual Servers under the advanced tab.
At this point your website should be available from the Internet. However, internally you won’t be able to hit it. The port forwarding only happens from the WAN interface and not the LAN one. In order to get it working internally you have to take a couple more steps.
- Setup DNS on your web server if it isn’t already on there. Then add a new domain for the domain that you used in your dynamic DNS. For example, I added the bryantlikes.dyndns.org domain and then created an A record for the root that points to my web server’s local IP address.
- Make sure your DHCP clients all point to your web server as their DNS. It is the only DNS Server that redirects the dynamic DNS entry to your local server.
That’s it! You should now have your dynamic IP serving up web pages both internally and externally. This caused me a bunch of headaches and googling yesterday so I thought it was worth blogging about. I glossed over lots of setup in each of the steps so if you want more information let me know and I’ll try to add it.