The hosts file is a computer file used to store information on where to find a node on a computer network. This file maps hostnames to IP addresses. The hosts file is used as a supplement to (or instead of) the ___domain name system on networks of varying sizes. This file is (unlike DNS) under the control of the user who is using the computer.
History
The ARPANET (predecessor to the Internet) had no DNS system for giving network nodes their own addresses. Because there was no centralized system for this purpose, each network node contained its own “map” of the network nodes that it needed to know about, and assigned them names that were memorable to the user. There was no system for ensuring that all systems on a network were called the same thing, nor was there a way to read some other user’s hosts file to automatically obtain their copy.
The small size of the ARPANET permitted hosts files to be used with some convenience for some time. Network nodes typically had one address, and could have potentially many names. As individual TCP/IP computer networks started becoming popular, however, the hosts file became a large burden on system administrators—networks and network nodes were being added all the time—making maintenance of the hosts file a task which grew significantly.
The hosts file is used today mostly in a secondary or tertiary fashion to obtain names of networked computers. The ___domain name system provides nearly all Internet users with the names of the computers that they need to access (for example, www.wikipedia.org can be found on an Internet-connected computer without the need for its IP address to be listed in the hosts file). The hosts file is still useful today, however, on networks which are small and static enough to not need the services of a DNS server. It can also be used to redirect network connections—for example, adding an entry to redirect Yahoo! to Google is possible. This can be used to reduce the risk of malware connecting to other Internet-connected machines by name (however, it does not help if the malware attempt to connect directly to IP addresses).
Location and layout
Operating system | File ___location |
---|---|
Unix-like systems, including GNU and Linux systems | /etc
|
Microsoft Windows (95/98 and 98SE/Me) | %windir%
|
Microsoft Windows (NT/2000/XP/2003/Vista) | %SystemRoot%\system32\drivers\etc by default[1][2]
|
Mac OS “Classic” | System Folder or System Folder:Preferences
|
Mac OS X | /private/etc or /etc [3]
|
OS/2 and eComStation | \mptn\etc on the boot drive
|
Novell Netware | SYS:\ETC
|
OpenVMS, using the HP TCP/IP stack | SYS$SYSTEM:TCPIP$HOST.DAT
|
OpenVMS, using MultiNet | MULTINET_COMMON_ROOT:[MULTINET]HOSTS.LOCAL
|
OpenVMS, using TCPware | TCPWARE_COMMON:[TCPWARE]HOSTS.
|
The hosts file is generally named “hosts
”, and its ___location varies with the type of operating system in use. The table shows the most common places to find the hosts file on various systems that are able to connect to TCP/IP networks. These files may have operating system-specific quirks or changes in layout, behavior, etc. The documentation for the operating system or TCP/IP stack in use should provide information on the format of the hosts file on a given system. Many systems use a common layout for the hosts file, following the Unix-like convention for configuration files—using a plain text format. The file traditionally lists an IP address, followed by a list of names for that node to go by. Comments are started by a hash mark (“#”) and continue through to the end-of-line.
Alternate uses for the hosts file
The hosts file has alternative uses, including filtering ads (by having entries for known ad-servers redirect to machines without the advertising on them). This can save network bandwidth, as well, by eliminating a request to the DNS server normally used for obtaining address information, as well as by not downloading the advertisements. However, if the hosts file is to be used for this purpose, it must be kept up-to-date with lists of Internet servers known to host such content.
The hosts file can also be “hijacked”, or used for malicious purposes. For example, adware, computer viruses, trojan horses, or other malware can edit the hosts file (particularly on Windows-based systems) to redirect traffic from a “safe” site (such as Google or Wikipedia) to sites hosting content that may be offensive or intrusive to the user or the user’s computer system. For example, a trojan (Qhosts) redirected traffic from search engines such as Google and AltaVista, redirecting requests for those services to a site specified by the author of the trojan horse[citation needed]. Mydoom.B (a malware program) blocked users from visiting sites regarding computer security and antivirus software, which also affected the Windows Update web site.
External links
This article's use of external links may not follow Wikipedia's policies or guidelines. |
This page or section may contain link spam masquerading as content. |
- Additional information
- Hosts File Info – A hosts file resource directory
- Blocking ads on the Internet – Contains a list of ad server hostnames and IP addresses
- Spyware Warrior – Contains security and hosts file related links and information
- SSMedia hosts file and Utilities
- Why Should You Wait for Internet Propagation? – An alternative use to the hosts file
- Custom hosts files
- Dan Pollock's hosts file A well maintained hosts file with updates almost daily,
- Andrew Short’s Hosts file project – comprehensive hosts file
- BadHosts – Henry Hertz Hobbit’s superset of the MVPS hosts file (commercial use restricted!)
- HPHosts – An ad blocking hosts file
- The Security Now! podcast page on the hosts file
- Mikes Ad-Blocking hosts file – available as a direct download to merge in, or as an installer
- Hosts-pider – A public hosts file with over 100,000 hostnames in the blacklist
- SCoooBY’s Hosts File – A large list of ad servers
- Ad Blocking Lists – Peter Lowe’s List
- Template:Fr Airelle Lists – Hosts files with a large blacklist of 400,000 sites
- Applications to Manage Hosts Files
- Abelhadigital’s HostsMan 3.0 beta 1 – A freeware application for hosts file management
- Bluetack, B.I.S.S Hosts Manager
- Funkytoad’s Hoster 3.1 – A free application to arrange, and edit hosts files
- Mike Meyer’s HostsToggle 2.1 – An open source hosts file tool
- KH Blocker – A free Microsoft Windows application which manages an ad-blocking hosts file
- Ray Marron's Hostess, Concise description, Ray Marron's Hostess – Freeware Ms Windows 32 hosts file manager.
See also
References and footnotes
- ^ The directory storing the hosts file under the Windows NT family of operating systems is
\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath
. - ^ The Windows system has a DNS resolver cache which may be disabled or flushed; Microsoft’s Knowledge Base contains further information on the subject matter.
- ^ On Mac OS X,
/etc
is a symbolic link to/private/etc
.