| • Science | • People | • Locations | • Timeline |
Before the advent of the Domain Name System (DNS), the hosts file was the only method of mapping IP addresses to hostnames. For many years, the Network Information Control Center (NIC) maintained a main hosts.txt file for others to download. The file is not updated anymore, but historical versions of the file are available on the Internet.
The file is of a very simple format, with an IP address at the beginning of the line and a space-separated list of hostnames, or "aliases". In most cases, the file contains at least one line, usually appearing like this:
127.0.0.1 localhostAnother line usually maps the system's main Ethernet interface to the system's hostname. For instance, if the machine was named gandalf in the domain lotr.net, a line like this might appear:
192.168.1.5 gandalf gandalf.lotr.netOn a Unix system, the file is usually located at /etc/hosts. There are several locations that have been used in Windows; Windows XP places it in C:\Windows\System32\Drivers\etc\hosts.
In order to keep the hosts file synchronized between different systems, it can be published across a Unix network via NIS ( Network Information Service).
Other similar files include ethers and networks, for mapping Media Access ControlMedia Access Control MAC is the lower sublayer of the OSI data link layer, the interface between a node's Logical Link Control and the network's physical layer. The MAC differs for various physical media. The MAC sublayer is primarily concerned with break and IP network addresses, respectively. However, they are rarely used.
One use of the hosts file is to essentially "unmap" the IP addresses of undesireable Internet hosts, such as systems that serve advertisements. This is usually achieved by setting the IP address of the target hostname to 0.0.0.0 or 127.0.0.1. An example would be:
127.0.0.1 ad.doubleclick.netHowever, the reverse can also happen. Internet worms have sometimes been known to alter the hosts file to point legitimate hostnames to computers run by attackers who are interested in capturing sensitive data such as usernames and passwordFor information on the game Password see Password game. A password is a form of authentication which uses secret data to control access to a resource. The password is kept secret from those not allowed access, and those wishing to gain access are tested os.