HOSTS Guide

HOSTS (case insensitive in Windows OSes) or hosts (must be lower case in *nix OSes) is an ASCII (plain text) file used by TCP/IP protocol for BSD/FreeBSD/Linux/Solaris/UNIX, BeOS, MacOS, OS/2, Novell Netware + Windows Operating Systems.
Acts as TCP/IP (Transport Control Protocol/Internet Protocol) host table and contains a list of address-to-name resolution mappings of numeric IP (Internet Protocol) addresses (32-bit identifiers) resolved to valid host names.
Operates as a local DNS (Domain Naming System) server by translating a UNC (Universal Naming Convention) domain name into an IP address, thus decreasing the time necessary to reach a remote server.
Never map an IP to a host name already in use, for example your ISP (Internet Service Provider) name or your favorite web site(s) name(s).
Never rename this file, it must be HOSTS or hosts without extension.

To properly use HOSTS in Windows 32-bit (Win32/x86) + 64-bit (Win64/x64) OSes you must make sure Enable DNS is turned ON: Control Panel -> Network -> your TCP/IP adapter name (if more than 1 must do this for ALL) -> TCP/IP Properties -> DNS Configuration tab -> check Enable DNS box -> click Apply/OK button.

Microsoft Windows Host Name Resolution over TCP/IP search order:

  1. HOSTS file
  2. DNS server
  3. NetBIOS cache
  4. WINS server
  5. Broadcast
  6. LMHOSTS file

You can view/edit your HOSTS file using Notepad or better text/ASCII editor/viewer, especially if your HOSTS file is larger than 64 KB.
Each entry must be kept on its own (separate) line.
Entries are almost always case sensitive.
Each IP address must be placed 1st separated by at least 1 space or Tab from corresponding host (machine) name, which must be placed 2nd on the same line.
Insert any optional comments on the same line after the host name (or on separate lines) preceded by a # symbol and followed (optionally) by at least 1 space or Tab (examples):

IPHost nameComments

102.54.94.97 rhino.acme.com source server
38.25.63.10 x.acme.com client host

This must be the 1st HOSTS line:

127.0.0.1 localhost

If more than 1 localhost lines, the 1st one overrides all others.

Each host name entry is limited to a maximum of 255 characters.

•NEVER• rename/modify/delete/comment/remark this HOSTS line:

127.0.0.1 localhost

The hosts file must reside in: [%windir% = usually C:\WINDOWS (3.xx/95/98/ME + 2000/XP/2003/Vista/2008) or C:\WINNT (NT/2000)]

  • %windir% = Windows 3.xx/95/98/ME
  • %windir%\SYSTEM32\DRIVERS\ETC or %windir%\SYSTEM32 = Windows NT4/2000/XP/2003/Vista/2008:
    HOSTS location can be changed by modifying this Registry Value.
  • /etc = BSD/FreeBSD/Linux/Solaris/UNIX
  • /boot/beos/etc = BeOS
  • /private/etc = MacOS X
  • \mptn\etc = OS/2
  • \ETC = Novell Netware