Changes: Ready for 5.13
[man-pages.git] / man5 / hosts.5
blobeaa34ef87a8df16f3233da89cf99e2083879783c
1 .\" Copyright (c) 2000 Manoj Srivastava <srivasta@debian.org>
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\"
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
13 .\"
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 .\" GNU General Public License for more details.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
22 .\" %%%LICENSE_END
23 .\"
24 .\" Minor polishing, aeb
25 .\" Modified, 2002-06-16, Mike Coleman
26 .\"
27 .TH HOSTS 5 2021-03-22 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 hosts \- static table lookup for hostnames
30 .SH SYNOPSIS
31 .nf
32 .B /etc/hosts
33 .fi
34 .SH DESCRIPTION
35 This manual page describes the format of the
36 .I /etc/hosts
37 file.
38 This file is a simple text file that associates IP addresses
39 with hostnames, one line per IP address.
40 For each host a single
41 line should be present with the following information:
42 .RS
43 .PP
44 IP_address canonical_hostname [aliases...]
45 .RE
46 .PP
47 The IP address can conform to either IPv4 or IPv6.
48 Fields of the entry are separated by any number of blanks and/or
49 tab characters.
50 Text from a "#" character until the end of the line is
51 a comment, and is ignored.
52 Host names may contain only alphanumeric
53 characters, minus signs ("\-"), and periods (".").
54 They must begin with an
55 alphabetic character and end with an alphanumeric character.
56 Optional aliases provide for name changes, alternate spellings,
57 shorter hostnames, or generic hostnames (for example,
58 .IR localhost ).
59 If required, a host may have two separate entries in this file;
60 one for each version of the Internet Protocol (IPv4 and IPv6).
61 .PP
62 The Berkeley Internet Name Domain (BIND) Server implements the
63 Internet name server for UNIX systems.
64 It augments or replaces the
65 .I /etc/hosts
66 file or hostname lookup, and frees a host from relying on
67 .I /etc/hosts
68 being up to date and complete.
69 .PP
70 In modern systems, even though the host table has been superseded by
71 DNS, it is still widely used for:
72 .TP
73 .B bootstrapping
74 Most systems have a small host table containing the name and address
75 information for important hosts on the local network.
76 This is useful
77 when DNS is not running, for example during system bootup.
78 .TP
79 .B NIS
80 Sites that use NIS use the host table as input to the NIS host
81 database.
82 Even though NIS can be used with DNS, most NIS sites still
83 use the host table with an entry for all local hosts as a backup.
84 .TP
85 .B isolated nodes
86 Very small sites that are isolated from the network use the host table
87 instead of DNS.
88 If the local information rarely changes, and the
89 network is not connected to the Internet, DNS offers little
90 advantage.
91 .SH FILES
92 .I /etc/hosts
93 .SH NOTES
94 Modifications to this file normally take effect immediately,
95 except in cases where the file is cached by applications.
96 .SS Historical notes
97 RFC\ 952 gave the original format for the host table, though it has
98 since changed.
99 .PP
100 Before the advent of DNS, the host table was the only way of resolving
101 hostnames on the fledgling Internet.
102 Indeed, this file could be
103 created from the official host data base maintained at the Network
104 Information Control Center (NIC), though local changes were often
105 required to bring it up to date regarding unofficial aliases and/or
106 unknown hosts.
107 The NIC no longer maintains the hosts.txt files,
108 though looking around at the time of writing (circa 2000), there are
109 historical hosts.txt files on the WWW.
110 I just found three, from 92,
111 94, and 95.
112 .SH EXAMPLES
114 # The following lines are desirable for IPv4 capable hosts
115 127.0.0.1       localhost
117 # 127.0.1.1 is often used for the FQDN of the machine
118 127.0.1.1       thishost.mydomain.org  thishost
119 192.168.1.10    foo.mydomain.org       foo
120 192.168.1.13    bar.mydomain.org       bar
121 146.82.138.7    master.debian.org      master
122 209.237.226.90  www.opensource.org
124 # The following lines are desirable for IPv6 capable hosts
125 ::1             localhost ip6\-localhost ip6\-loopback
126 ff02::1         ip6\-allnodes
127 ff02::2         ip6\-allrouters
129 .SH SEE ALSO
130 .BR hostname (1),
131 .BR resolver (3),
132 .BR host.conf (5),
133 .BR resolv.conf (5),
134 .BR resolver (5),
135 .BR hostname (7),
136 .BR named (8)
138 Internet RFC\ 952
139 .\" .SH AUTHOR
140 .\" This manual page was written by Manoj Srivastava <srivasta@debian.org>,
141 .\" for the Debian GNU/Linux system.