What is the HOSTS file ?
The HOSTS file allows you to map host names or nicknames
to IP addresses.
For Windows systems, the HOSTS file is a text file that
resides in the Windows directory. It has no extension.
Why using the HOSTS file ?
Whenever you have a lot of IP addresses to remember, you
can use the HOSTS file, so instead of the IP addresses, you can use the easier names
defined in the HOSTS file.
These are some examples where a HOSTS file comes in usefully
:
- When you have a local Intranet server. So to visit
your Intranet home page with any browser, people can type in its host name instead
of its IP address.
- When you use a proxy server or a gateway on one machine,
for instance Wingate or CProxy. Now when you configure your
browser for it, again you use its host name instead of its IP address.
The HOSTS file entries
HOSTS entries use the following format:
IPaddress hostname
where IPaddress is the IP address of the host you
are mapping, and hostname is the host name or nickname that you are mapping
to the IP address.
You may list multiple host names on a single line.
Example:
192.168.0.1 ourgateway
192.168.0.3 accounting fred
In this example, your network sends packets addressed
to ourgateway to the 192.168.0.1 address and packets addressed to
accounting or fred to the 192.168.0.3 address.
The Hosts file can include lines of data, blank lines,
and comments. A comment begins with a semicolon (;) and can be on the same line
as data. The comment extends from the semicolon to the end of the line.
|