DNS - Viewing site before DNS change

From DreamHost
Revision as of 01:33, 3 March 2010 by Rlparker (Talk | contribs)

Jump to: navigation, search

Getting Started

Introduction

Transferring domains between registrars can be scary stuff! Minimizing downtime is something pretty important to most of you, so here's the best way to get your account set up at DreamHost to help eliminate downtime during the switch.

Click here for a similar article relating to databases.

Getting Started

First, you need to have an active DreamHost account. Once you've signed up for the service and received your activation e-mails, you'll need to upload your content to the folder created for your domain. You'll receive information on how to access your account via FTP in one of the welcome e-mails sent out to you.

There are two ways to reach your DreamHost site without changing the DNS records:

1) FTP to the server on which your site will live -- find that server's name via the "Account Status" drop-down tab near the top-right of the DreamHost Web Panel, under "Your Web Server". Then FTP to servername.dreamhost.com. E.g. if your server's name is "meatball" you should ftp to "meatball.dreamhost.com".

2) You can also create a free sub-domain of dreamhosters.com and mirror your site there; e.g. if your domain is "yourdomain.com" you can mirror it at "yourdomain.dreamhosters.com", then when the DNS records for that site have updated, you can FTP straight to that address to access your home directory.

Note: in either case, if you have associated a unique user with your domain in your DreamHost panel, you must log in as that user to see the domain's files. Otherwise you will still be able to log in, but the domain's files will be invisible.

These methods will work at any time. Once your domain's DNS records have switched, you may also FTP straight to yourdomain.com.

Setting it all up

Now you need to add a sub-domain to DreamHosters.com (ie: yoursite.dreamhosters.com) for your site and set it to mirror your actual domain. Here's how you do it!

  1. First visit the the Domains >> Manage Domains section of the control panel.
  2. From there, click the Add New Domain/Sub-Domain link found at the top of the page.
  3. On the page that follows, scroll to the 'Mirroring' section and type in what you'd like your DreamHosters.com sub domain to be (yoursite.dreamhosters.com). Note: no sub-sub domains allowed (for example, yoursite.net.dreamhosters.com. Use yoursite.dreamhosters.com instead).
  4. Select the real domain (that was added automatically after signup) from the drop down list below.
  5. Click the 'Mirror with this domain now!' button to set it up!

It may take a couple of hours for this newly-created mirroring to be set up, but once it is you'll be able to access your domain (via this mirror) before you change the name servers for your domain.

NOTE: After testing is complete and you change the name servers for your domain to use ours this mirror won't be necessary any longer and can be deleted from the control panel.

The wrap-up

As you can see, this won't affect the current registration or hosting of your actual domain, but basically provides an alternate method for accessing your domain before (and even after) you flip the DNS switch and move your domain's nameservers over to DreamHost. Diagram of how DNS works: #1

Speaking of nameservers... now that you've confirmed everything's good to go on our side, it's time for the moment of truth. Flipping the DNS switch. You'll need to login to the control panel with your current registrar (or contact their support team) to modify the nameservers to the following:

  • ns1.dreamhost.com 66.33.206.206
  • ns2.dreamhost.com 208.97.182.10
  • ns3.dreamhost.com 66.33.216.216

Flip!

Diagram of how DNS works: #2

Don't hesitate to contact the support team if you need any help with this!

Here's something that will not work

One thing that will not work is trying to access your site directly via its IP address. For example, you might be tempted before flipping the DNS switch (as described above) to give your site one last look by browsing to http://208.97.159.132 (or whatever ip address you see in your control panel for your domain).

That's not going to work. You'll get a bad_httpd_conf error page, and this is normal behavior. Here's the word on it straight from Dreamhost support:
It would be expensive and unnecessary to put each domain on its own IP, so an IP is shared between many sites. So just visiting the IP will give you an error like that since apache doesn't know which site is should give you.

So check out the operation of your site at yoursite.dreamhosters.com, and then be brave and flip that DNS switch.

Changing your hosts file

A trick to view your site before changing your nameservers to point to DreamHost is to temporarily edit your hosts file to force your computer to view the DreamHost-hosted version. After creating your DreamHost account, open the hosts file in your computer. You'll need to get the IP address assigned to your domain. You can view this information by clicking the 'DNS' link that appears under your domain in the Manage Domains portion of the control panel. Look for the 'A' record and the IP address listed next to it. Copy that IP address. Now add the following line to the hosts file, substituting the 192.* address with the one you just wrote down, and 'www.example.org' with your actual domain.

192.168.1.1 www.example.org

Do not forget to remove that line from the hosts file once you point your domain's nameservers to DreamHost or if you want to view the old site.

What happens with this trick is that your system no longer resolves the name to the IP address via your ISPs DNS but instead looks it up from your local hosts file. This bypasses your ISPs DNS completely. The server at Dreamhost will receive the incoming connection with the correct domain name in the URL and it will serve you the pages. Keep in mind that only people that have made this modification will be able to access your domain as hosted on DreamHost prior to pointing your nameservers to DreamHost.

Locating your hosts file

On most Windows systems you can find the hosts file in C:\Windows\System32\Drivers\etc. It might be set to hidden so make sure you have 'show hidden files' turned on. Save the hosts file and flush the DNS cache on your system. Restart your browser and try accessing your domain. If all is well, you should be able to access your site.

On most Linux-based systems, the hosts file can be located in /etc/hosts.

Viewing your MySQL Data Base before DNS change

If you need to access a MySQL databse before DNS changes, you can do much the same thing by using this same process with a "temporary" MySQL host arrangement. More information on that process is available in the Dreamhost WIki article on viewing a Database before DNS changes.

An Even Easier Technique: Switch To or Add DreamHost’s DNS Servers!

Windows, Mac OS (Classic and X), and Unix-based OSes all provide ways to edit the list of DNS servers used by a computer to find any address on the Internet. By simply adding one or more of DreamHost’s DNS servers to the top of the list of DNS servers that your computer uses, then that computer will see now what the rest of the world will see once you flip the DNS switch.

Doing this lets you test all of your DreamHost services exactly as they will appear to the rest of the world after DNS switches are flipped! Any and all of your Websites (whether their DNSes have been flipped or not), plus their related Email (Webmail, POP3, whatever), MySQL (including not-yet-propagated hostnames!), etc.!

You can do this temporarily if you only have access to one computer, or, better yet, do it permanently on one computer at your development location (assuming that you have access to more than one computer at that location). The latter technique lets you leave the rest of your computers set to normal DNS operation (using the DNS server(s) provided by your ISP and thus seeing what the rest of the world sees), while the one computer sees now what the world will see once the DNS switch is flipped. You can designate that one computer as the Official DreamHost Site-Testing Computer. Also, this only has to be done once, and does not need to be done again for each new DreamHost site that you wish to test, unlike editing the Hosts file.

Your DNS servers for your computer may normally be automatically provided by DHCP, BootP, or other automatic network address-assigning protocol. If this is the case, simply specify to use manually assigned DNS servers instead, and set them to the DreamHost servers. If you only have the one computer and are doing it temporarily, then undoing it is as simple as telling your OS to use the automatic DNS servers again.

Windows 2000 or XP

Check your SysTray (the area of the TaskBar where the clock display is, which normally holds status icons for running processes). You may or may not see a network icon there, which looks like two tiny computer connected together, with their monitor screens flickering green as data is transmitted and received. If so, simply click on that (be sure it’s the correct one if you have more than one: you need the one that gives you access to the outside world). This will display a status dialog.

If you don’t see such an icon, then go to your “Network & Dial-Up Connections” (in Control Panel) and find the desired connection icon therein, and double-click on it. This will also display the status dialog.

Once there, click on the “Properties” button. This will display the Properties dialog for that connection. First off, I recommend checking the “Show icon in taskbar when connected” checkbox at the bottom, if it’s not already checked (which would be the case if you saw no such icon in your SysTray ), so that it will be there in the future. It saves you from having to go to the Control Panel interface again.

Now, for the nitty-gritty: you’ll see the Networking Components (Client Services [blue monitor icon with no hand], Server Services [blue monitor icon held in a hand], Protocols [networking cable icon], etc.) installed on your computer, with the ones used by that connection being checked. One of the Protocols will be “Internet Protocol (TCP/IP)” Click it once and then click the “Properties” button, or double-click it.

This will display your “Internet protocol (TCP/IP) Properties” Dialog. At the bottom, you’ll see two radio buttons. Most likely, the top one is selected: “Obtain DNS server address automatically.” If this is the case, simply click “Use the follwing DNS server addresses:” instead, which will enable the two previously-disabled edit boxes below, for Preferred and Alternate DNS server. Simply enter any two of the three DreamHost DNS server IP addresses shown above into these two boxes. If you wish to use all three, you’ll need to click the “Advanced…” button and handle it there. To undo this and restore normal as-the-rest-of-the-world-sees-it Internet operation, simply repeat these steps, but select “Obtain DNS server address automatically.”

If “Use the following DNS server addresses” is already selected, then your system is already using manually-specified DNS addresses. These are probably important, so write them down. Then change them to any two of the three the DreamHost ones. To undo, simply change them back to whatever they were before (you did write them down, right?).

In any case, the changes will not take effect until you click the “OK” button and completely exit the Properties dialog.

New: If you want to be able to access the rest of the Internet other than just DreamHost-hosted services while doing this, you need to append your existing DNS servers after the DreamHost ones. This must be done in Advanced mode.

First, launch the Windows Command Prompt by doing Start / Run (handy shortcut: [Windows Key]+[R]!) and typing “cmd”. One there, type “ipconfig /all”. You will see a display of information for each of your network adapters.

Look for the one that connects you to the outside world (e.g. “Ethernet adapter Local Area Connection”). Towards the bottom of the list, just below “DHCP Server” and just above “Lease obtained”, you should see “DNS Servers”. This will most likely show two lines, but may show only one, or three or more. Leave that window displaying those. These are your ISP’s usual DNS Servers that were obtained by “Obtain DNS server address automatically.”

Now follow the instructions earlier, but when you get to where you would enter DreamHost’s DNS servers (after clicking “Use the follwing DNS server addresses:”), click the “Advanced” button. One at a time, enter the three DreamHost DNS server entries, in order (handy quick typing tip: for each octet of an IP address, if it is three digits long [100–255], do not type the period separator, but if it is only one or two digits long [0–99] and is not the last (fourth) octet, then press the period {[>.] or [. Del]} key. So, to enter the second DreamHost DNS [208.96.10.221 at the time of this edit], type: [2] [0] [8] [9] [6] [.] [1] [0] [.] [2] [2] [1]).

Do not click [ Ok ] just yet! Now, make sure that you can see the Windows Command Prompt with your usual ISP DNS servers shown from the “ipconfig /all” command, then add those DNS entries to the list, in order, after the DreamHost ones! Then click [ Ok ] and exit the Properties dialog completely.

Because you still have the former DNS servers on the list, your DNS Cache will remain for awhile (perhaps a day or more), preventing you from accessing the DreamHost version of domains that you had recently tried to access during that period. To resolve this quickly, go back to your Command Prompt window and type: “ipconfig /flushdns” to flush the DNS cache. Wait a few minutes for this to fully take effect. You can check its progress by typing “ipconfig /displaydns” to view the cached entries. Once fully flushed, only two entries each for “localhost” and any entries defined in your Hosts file should remain.

On occasion, your DNS Cache may still retrieve the “real-world” DNS address for a domain. If that happens, just do the “ipconfig /flusdns” thing again.

You should now be able to access the DreamHost version of domains that have not yet been switched over to DreamHost, while still being able to access non-DreamHost-hosted services as usual.

Earlier Versions of Windows

The basic technique described above is pretty much the same, but how you get there is different: you’ll need to go to a “Networking” Control Panel. Then proceed with the second or third paragraph in the above subsection, depending on your specific version of Windows. Some particularly old versions of Windows may require a reboot before changes take effect.

Mac OS X

In recent versions, you call up the System Preferences, then click on the Network icon in the Networking & Internet group. The first tab is the TCP/IP tab. Most recent versions let you set up multiple “Locations” which you can select from a drop-down menu. These are named and stored settings. You can save your current Location settings, then edit it to add the DreamHost DNS servers in the space provided, then save that Location as “DreamHost Testing” or some such. No need to write down the old addresses, and you can switch between the two configurations at any time!

Ubuntu

edit tthe resolv.conf file

   sudo vi /etc/resolv.conf


then add the following line below to the beginning of the file

   nameserver 208.96.10.221

Other OSes

Please feel free to edit these sections to add Mac OS Classic, Linux GNOME, Linux KDE, etc. instructions.

See also