Host Files (Hosts or Hosts.txt)

The Hosts file is a static file edited manually. It contains matched pairs of Internet Protocol (IP) addresses and Host names.

When an application requires an IP address for a given Host name, the computer first checks its own name for a match. If this fails it then checks the Hosts file. If no match is found here or the Hosts file is absent then the Host name is sent to the local Domain Name System (DNS) server. When the Host name is found by whichever method, the IP address is returned to the computer and communication can proceed.

When editing the Hosts file, the IP address is entered first and left justified, the host name or if you prefer, the Fully Qualified Domain Name (FQDN) is added next on the same line with at least one space after the IP address. If a second name is added after this it is considered an alias for the same computer. Any text written after an # sign is a comment for the edification of the editor. The addresses most commonly used are placed at the top because the file is read from the top downward. Hosts entries are case sensitive, multiple entries in different cases for the same IP address can help.

The Hosts file on many systems resides in the etc sub folder, for example, c:\Winnt\System32\drivers\etc\Hosts on Windows NT. In Windows 95 and 98 it is in the Windows folder.