A hosts-Datei is a computer file (operating system file) that maps host names to IP addresses. It is a plain text file.
Originally, a file called hosts.txt was manually maintained and provided by the Stanford Research Institute to the Arpanet membership via file share. It contained the hostnames and addresses of hosts contributed for inclusion by member organizations. The domain name system, first described in 1983 and implemented in 1984, automated the publishing process and allowed for instant and dynamic host name resolution on the rapidly growing network.
The hosts-Datei is one of several system facilities that support the addressing of network nodes on a computer network. It is a common part of an operating system’s Internet Protocol (IP) implementation and is used to support user-friendly host names into numeric protocol addresses, called IP addresses, that identify and locate a host on an IP network.
In some operating systems, the contents of hosts-Datei are preferred for other name resolution methods, such as DNS (domain name system). However, many systems implement name service switches, e.g., nsswitch.conf for Linux and Unix customization. In contrast to remote DNS resolvers, the is controlled hosts-Datei directly by the administrator of the local computer.
Tips on file contents
The hosts computer file contains lines of text consisting of an IP address in the first text field followed by one or more hostnames. Each field is separated by spaces – tabs are often preferred for historical reasons. Comment lines may also be included. They are indicated by a so-called octothorpe (#) at the first position of such lines. Completely empty lines in the file are ignored.
For example, a typical file may contain the following:
126.96.36.199 localhost loopback
This example contains entries only for the system’s loopback addresses and their hostnames, a typical default content of this file. The example also shows that an IP address can have multiple hostnames (localhost and loopback) and that a hostname can be assigned to both IPv4 and IPv6 IP addresses.
In its hostname resolution feature, Hosts can be used to define any hostname or domain name for use on the local system.
Redirect Local Domains
Some Web service and intranet developers and administrators define locally defined domains on a LAN for various purposes, such as accessing the company’s internal resources or testing local Web sites in development.
Blocking Internet resources
Entries in the hosts-Datei can be used to block online advertisements or the domains of known malicious resources and servers that contain spyware, Adware and other Malware. This can be accomplished by adding entries for these sites to redirect requests to another address that does not exist, for example. Commercial software applications can be used to automatically populate the file with entries for known undesirable Internet resources. In addition, user-created hosts-Dateien that block undesirable servers are publicly available.
Some pirated software relies on a modified file to prevent software from contacting the publisher’s activation servers, although activation servers sometimes appear in general-purpose hosts files.
In modern operating systems, hosts-Datei remains an alternative name resolution mechanism that can often be configured as a primary method or as a fallback method as part of features such as the “name service switch”.
Do you have any more questions?