Science  People  Locations  Timeline
Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home > Hosts


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.

1 File format

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 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.net

On 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.

2 Overriding Internet hostnames

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.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 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.

3 External link



Read more »

Non User