hosts(4)hosts(4)NAMEhosts - hostname-address database
DESCRIPTION
The /etc/hosts file contains information regarding the known hosts on the
network. For each host a single line should be present with the
following information:
o Internet address
o official hostname
o aliases (optional)
Items are separated by any number of blanks and/or tab characters. A #
indicates the beginning of a comment; characters up to the end of the
line are not interpreted by routines that search the file. For example,
192.0.2.2 iris.widgets.com iris
This file must include entries for all of the machine's network
interfaces, the localhost address and a few important machines on the
local network. ifconfig(1M) uses this file when assigning addresses to
the network interfaces during system initialization.
By default, this file is used by gethostbyname(3N) and gethostbyaddr(3N)
only when the NIS or the Berkeley Internet name server (named(1M)) are
not enabled. The system can be configured to use NIS, named, and/or this
file, as described in resolver(4).
If the host is not connected to any network, the file should contain an
entry defining the hostname as an alias for the localhost entry. For
example, if the hostname is IRIS, the /etc/hosts file should contain this
line:
127.1 localhost IRIS
Sites connected to the Internet should configure the system to use the
name server. This file can be created from the official host database
maintained at the Network Information Center (NIC), though local changes
may be required to bring it up to date regarding unofficial aliases
and/or unknown hosts. The host database maintained at NIC is incomplete.
Network addresses are specified in the conventional dot (.) notation
using the inet_addr() routine from the Internet address manipulation
library, inet(3N). Legal hostnames can contain any alphanumeric
character, the minus sign (-) and period (.). Periods are not part of
the name but serve to separate components of a domain-style name.
Page 1
hosts(4)hosts(4)FILES
/etc/hosts
SEE ALSOifconfig(1M), named(1M), gethostbyname(3N), resolver(4), sys_id(4),
hostname(5).
Page 2