How to simulate a DNS change

Published on
9,384 Points
1 Endorsement
Last Modified:
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server when DNS changes has been propagate (which can take hours).

One of the tricks I do to simulate that DNS has already propagated, even if you haven't still changed your DNS server to point to your new web server, is to edit the file c:\Windows\system32\drivers\etc\hosts.

This file is a text file that acts as a local DNS, where you can see some names and IPs such as:      localhost

You can add your new server's IP and your domain to simulate the new configuration on the DNS. After all tests run ok, you can make the changes on your DNS server and then remove the line you added on hosts file. Then wait for the DNS to propagate, but you don't need to cross your fingers as you have already tested your new server with your domain.

This is also userful for new sites too (not only for moving sites from server). You normally buy a domain, and then develop the site, but this is not correct as any development errors will be online for some periods of time.

You can develop your site without buying a domain (but use the domain from your computer where you added the IP of your server and the domain on hosts file) and when development is finish, you can buy the domain so your private domain on hosts files gets public. Also you save to spend to the domain until your site is completed.

Finally, linux and mac has also this file. normally at /etc/hosts on linux, and on /private/etc/hosts on mac.

Hope it helps.
Ask questions about what you read
If you have a question about something within an article, you can receive help directly from the article author. Experts Exchange article authors are available to answer questions and further the discussion.
Get 7 days free