What is a host file?
The simple answer is: the host file is like an address book. when you type a URL in your browser, the host file will be queried to see if you have set an IP address for that site. if you set it, your computer will use this IP address to open the site. if no, the computer will go back to your Internet Service Provider (ISP) computer to find the IP address. most of the time, there will be no IP addresses in the host file. most of the time, the computer queries the ISP to obtain the IP address.
The longer answer is: windows and other operating systems use the host file to map the Host Name and IP address.
The following steps are required to find the IP address corresponding to the Host Name:
First query your local host file. the host file will tell you the IP address corresponding to the Host Name of your computer, so that your computer will stop querying and directly open the site. however, if it cannot be found, it will ask the DNS server for information.
Host File Location
C: \ windows \ hosts
Windows NT/2000/XP Pro
C: \ winnt \ system32 \ drivers \ etc \ hosts
Windows XP Home/Windows 7/Windows Server 2008
C: \ windows \ system32 \ drivers \ etc \ hosts
Host is the name of the file, not the name of the folder. There is no extended name for this file (for example, .exe,. txt,. Doc, etc)
If you do not have a host file, you can create one by yourself and put it in the folder listed above.
If you find that you already have the host file, we recommend that you back up it and copy it to another hard disk partition so that you can recover it.
Host file example
# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample hosts file used by Microsoft TCP/IP for Windows.
# This file contains the Mappings of IP addresses to host names. Each
# Entry shoshould be kept on an individual line. The IP address shold
# Be placed in the first column followed by the corresponding host name.
# The IP address and the host name shocould be separated by at least one
# Additionally, comments (such as these) may be inserted on individual
# Lines or following the machine name denoted by a' # 'symbol.
# For example:
#22.214.171.124 rhino.acme.com # source server
#126.96.36.199 x.acme.com # X client host
# Localhost name resolution is handled within DNS itself.
#: 1 localhost