SUBSCRIBE - [ Tech News ] [ Make Money Blogging Tips ] [ Online Marketing Tips ] [ Web Dev News ]
Powered by MaxBlogPress  

What is hosts file and how to edit hosts file in Win XP and Win Vista?

February 16, 2009 by MK  
Filed under Hosting

Most of the times when we visit a web site e.g. http://www.coolwebdeveloper.com by typing in the domain name, our browser sends a request to the DNS (Domain Name Server or System) to map that name with the IP address of the web server. The DNS server will then query other servers on the Internet that know the correct information for that domain name, and then return to the web server’s IP address.

DNS stands for Domain Name System and is the standard domain name resolution service used on the Internet. Whenever a device connects to another device on the Internet it needs to connect to it via the IP address of the remote device. In order to get that IP address, DNS is used to resolve that domain name to its mapped IP address.

There is another way to resolve domain names without using the Domain Name System, and that is by using your HOSTS file. Almost every OS that communicates via TCP/IP, the standard of communication on the Internet, has a file called the HOSTS file. This file allows you to create mappings between domain names and IP addresses.

The HOSTS file is a text file that contains IP addresses separated by at least once space and then a domain name, with each entry on its own line. For example, imaging that we wanted to make it so that if you typed in www.google.com, instead of going to Google we would go to www.coolwebdeveloper.com. In order to do this you would need to find out one of the IP addresses of Yahoo and map www.google.com to that IP address.

One of the IP addresses for www.coolwebdeveloper.com is 216.110.120.72. If we wanted to map Google to that IP address we would add an entry into our HOSTS file as follows:

216.110.120.72 www.google.com

Note the space between the 2 entries, this is important.

 

Operating System Location on Hard Drive
Linux/Unix /etc/hosts
Windows 3.1/95/98/ME c:\windows\hosts
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts or c:\windows\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts
Netware SYS:ETC/HOSTS
Apple System Folder:Preferences and in the System Folder itself.
Win Vista c:\windows\system32\drivers\etc\hosts

 

For editing hosts file in Win Vista you will need administrative privileges, and you will not be able to edit as a regular user. Here are the steps that you need to follow to edit hosts file in win vista.

  1. Click Start , click All Programs, click Accessories, right-click Notepad, and then click Run as administrator.
  2. If you are prompted for an administrator password or for a confirmation, type the password, or click Allow.
  3. Open the Hosts file, make the necessary changes, and then click Save on the Edit menu.
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • LinkedIn
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Yahoo! Buzz