Hosts Guide, Meaning , Facts, Information and Description
The hosts file, present in many operating systems, is a simple database containing mappings between hostnames and IP addresses. It is most common to find the file being used on Unix systems, although Microsoft Windows and IBM's OS/2 are other notable systems that have implemented it.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.
| Table of contents |
|
2 Overriding Internet hostnames 3 External link |
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:
File format
127.0.0.1 localhost
Another 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 Control 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:
Overriding Internet hostnames
127.0.0.1 ad.doubleclick.net
However, 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 passwords.
