The hosts file is a vital file built into Windows. Its purpose is to convert IP addresses to host names, much like DNS would. This can be useful in pointing an individual PC to a specific server where DNS may point it elsewhere.
For example, normally example.com would point to 188.8.131.52, however you may want it to point to 10.87.1.5 on only one PC. You could use a host file entry to point this one PC to 10.87.1.5.
The hosts file is stored in C:\windows\system32\drivers\etc and can be edited using Notepad. Due to the location of the file, Notepad must be run as administrator, otherwise it will only be able to open the file in read-only.
To run Notepad as administrator, open the Start menu and navigate to All Programs > Accessories, then right click on Notepad. Select Run as administrator from the menu.
From the File menu, select Open
Browse to the following path: C:\Windows\System32\drivers\etc
Make sure the file types drop down is set to All files (*.*)
Double click on hosts:
You should now be presented with a file that looks similar to this:
Any line in this file that starts with a # is a â€œcomment lineâ€. This means any information on this line is ignored.
To add a new entry, start a new line and enter the IP address of the server and the host name you wish to give it, separating the two with a space. Using the example.com as used earlier, this would look like:
10.87.1.5Â Â Â Â Â Â Â Â Â Â Â Â Â example.com
Select Save from the File menu to commit any changes.