There are several steps that occur when you go to a website. One of the first things that happens is a DNS query to the websites Nameservers. This works much like looking up a phone number for a business in a phone book. What many people don’t know is that each computer has it’s own “Nameserver” that it queries before looking to the websites Nameservers. This is called your computers “Hosts File”. This allows you to define your own IP addresses for domain names and view them from your computer. This is helpful when you are developing websites and need to view the new site by using the domain name. It may sound complicated at first – but after completing this tutorial things should become more clear.
sudo vi /etc/hosts
IP Address www.yourdomain.com
hostfiletestdomain.com to go to Googles IP we can insert this line:
You may have to wait a little while before the changes take affect – however in most cases the changes are pretty much instantaneous.
NOTE: Always remember to remove the entries from your host file after you are done using them.