Hosts file

From LQWiki
Jump to: navigation, search

The /etc/hosts file maps the IP address of a device connected to the network to a name (typically the devices hostname). Due to the arrival of DNS this file is rarely used but is still useful for small networks and at boot when no name servers are running. In addition, the hosts file can be hacked so that the domain name of servers that host annoying webpage ads are redirect to the loopback address ( Need link to sample hosts file that does this.

The layout of the file is a simple list of IP addresses followed by the name of the host e.g.: localhost gateway fileserver1 foo1 foo2

See Also