1HOSTS(5)                   Linux Programmer's Manual                  HOSTS(5)
2
3
4

NAME

6       hosts - static table lookup for hostnames
7

SYNOPSIS

9       /etc/hosts
10

DESCRIPTION

12       This  manual  page  describes  the format of the /etc/hosts file.  This
13       file is a simple text file that associates IP addresses with hostnames,
14       one line per IP address.  For each host a single line should be present
15       with the following information:
16
17              IP_address canonical_hostname [aliases...]
18
19       The IP address can conform to either IPv4 or IPv6.  Fields of the entry
20       are separated by any number of blanks and/or tab characters.  Text from
21       a "#" character until the end of the line is a comment, and is ignored.
22       Host names may contain only alphanumeric characters, minus signs ("-"),
23       and periods (".").  They must begin with an  alphabetic  character  and
24       end  with an alphanumeric character.  Optional aliases provide for name
25       changes, alternate spellings, shorter hostnames, or  generic  hostnames
26       (for  example,  localhost).   If required, a host may have two separate
27       entries in this file; one for each version  of  the  Internet  Protocol
28       (IPv4 and IPv6).
29
30       The Berkeley Internet Name Domain (BIND) Server implements the Internet
31       name server for UNIX systems.  It augments or replaces  the  /etc/hosts
32       file  or  hostname  lookup, and frees a host from relying on /etc/hosts
33       being up to date and complete.
34
35       In modern systems, even though the host table has  been  superseded  by
36       DNS, it is still widely used for:
37
38       bootstrapping
39              Most systems have a small host table containing the name and ad‐
40              dress information for important  hosts  on  the  local  network.
41              This  is useful when DNS is not running, for example during sys‐
42              tem bootup.
43
44       NIS    Sites that use NIS use the host table as input to the  NIS  host
45              database.   Even though NIS can be used with DNS, most NIS sites
46              still use the host table with an entry for all local hosts as  a
47              backup.
48
49       isolated nodes
50              Very small sites that are isolated from the network use the host
51              table instead of DNS.  If the local information rarely  changes,
52              and  the  network  is  not connected to the Internet, DNS offers
53              little advantage.
54

FILES

56       /etc/hosts
57

NOTES

59       Modifications to this file normally take effect immediately, except  in
60       cases where the file is cached by applications.
61
62   Historical notes
63       RFC 952  gave  the  original  format  for the host table, though it has
64       since changed.
65
66       Before the advent of DNS, the host table was the only way of  resolving
67       hostnames  on  the fledgling Internet.  Indeed, this file could be cre‐
68       ated from the official host data base maintained at the Network  Infor‐
69       mation  Control  Center (NIC), though local changes were often required
70       to bring it up to date  regarding  unofficial  aliases  and/or  unknown
71       hosts.  The NIC no longer maintains the hosts.txt files, though looking
72       around at the time  of  writing  (circa  2000),  there  are  historical
73       hosts.txt files on the WWW.  I just found three, from 92, 94, and 95.
74

EXAMPLES

76       # The following lines are desirable for IPv4 capable hosts
77       127.0.0.1       localhost
78
79       # 127.0.1.1 is often used for the FQDN of the machine
80       127.0.1.1       thishost.mydomain.org  thishost
81       192.168.1.10    foo.mydomain.org       foo
82       192.168.1.13    bar.mydomain.org       bar
83       146.82.138.7    master.debian.org      master
84       209.237.226.90  www.opensource.org
85
86       # The following lines are desirable for IPv6 capable hosts
87       ::1             localhost ip6-localhost ip6-loopback
88       ff02::1         ip6-allnodes
89       ff02::2         ip6-allrouters
90

SEE ALSO

92       hostname(1),  resolver(3),  host.conf(5),  resolv.conf(5), resolver(5),
93       hostname(7), named(8)
94
95       Internet RFC 952
96

COLOPHON

98       This page is part of release 5.12 of the Linux  man-pages  project.   A
99       description  of  the project, information about reporting bugs, and the
100       latest    version    of    this    page,    can     be     found     at
101       https://www.kernel.org/doc/man-pages/.
102
103
104
105Linux                             2021-03-22                          HOSTS(5)
Impressum