hosts(4)hosts(4)NAMEhosts - The host name data base
SYNOPSIS
/etc/hosts
DESCRIPTION
The hosts file contains information regarding the known hosts on the
network. For each host a single line should be present with the fol‐
lowing information: IP_address canonical_hostname aliases
Items are separated by any number of blanks and/or tab characters. The
# (number sign) indicates the beginning of a comment; characters up to
the end of the line are not interpreted by routines which search the
file.
The following is an example of an /etc/hosts file:
127.0.0.1 localhost 192.168.201.38 esterbrook.sty‐
los.plume.net esterbrook este es 192.168.201.3 wirt.sty‐
los.plume.net wirt # DNS server 192.168.201.6
eclipse.stylos.plume.net eclipse # DNS server 192.168.112.155
carter.stylos.plume.net carter # NIS server 192.168.112.163
chilton.stylos.plume.net chilton # NIS server
The first two or more entries include the default 127.0.0.1 loopback
interface and any local network interfaces that the ifconfig command
needs when you boot your system. In this case, there is one (primary)
network interface on the local system. It is called esterbrook, but
because it has such a long name, users on the local system can refer to
it by the aliases este or es for convenience.
The remaining entries are for other hosts in your network. If you are
not running a naming service, such as BIND, you need to add an entry
for any system to which you will refer by a host name. If you are run‐
ning a naming service, you need only add entries for the most critical
systems with which you will communicate. In the event that the naming
service fails, the hosts file will serve as a backup.
This file may be created from the official host data base maintained at
the Network Information Control Center (NIC), though local changes may
be required to bring it up to date regarding unofficial aliases and/or
unknown hosts. As the data base maintained at NIC is incomplete, use
of the name server is recommend for sites on the DARPA Internet.
Network addresses are specified in the conventional notation using the
inet_addr() routine from the Internet address manipulation library,
inet_addr(3). Host names may contain any printable character other
than a field delimiter, newline, or comment character.
SEE ALSO
Commands: ifconfig(8), named(8)
Functions: gethostbyname(3)hosts(4)