CONTRIBUTING.d/patches: Please provide a git-range-diff(1)
[man-pages.git] / man5 / hosts.5
blob515a1a26965b952556e08e0a167f84ffce6bc575
1 .\" Copyright (c) 2000 Manoj Srivastava <srivasta@debian.org>
2 .\"
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
4 .\"
5 .\" Minor polishing, aeb
6 .\" Modified, 2002-06-16, Mike Coleman
7 .\"
8 .TH hosts 5 (date) "Linux man-pages (unreleased)"
9 .SH NAME
10 hosts \- static table lookup for hostnames
11 .SH SYNOPSIS
12 .nf
13 .B /etc/hosts
14 .fi
15 .SH DESCRIPTION
16 This manual page describes the format of the
17 .I /etc/hosts
18 file.
19 This file is a simple text file that associates IP addresses
20 with hostnames, one line per IP address.
21 For each host a single
22 line should be present with the following information:
23 .RS
25 IP_address canonical_hostname [aliases...]
26 .RE
28 The IP address can conform to either IPv4 or IPv6.
29 Fields of the entry are separated by any number of blanks and/or
30 tab characters.
31 Text from a "#" character until the end of the line is
32 a comment, and is ignored.
33 Host names may contain only alphanumeric
34 characters, minus signs ("\-"), and periods (".").
35 They must begin with an
36 alphabetic character and end with an alphanumeric character.
37 Optional aliases provide for name changes, alternate spellings,
38 shorter hostnames, or generic hostnames (for example,
39 .IR localhost ).
40 If required, a host may have two separate entries in this file;
41 one for each version of the Internet Protocol (IPv4 and IPv6).
43 The Berkeley Internet Name Domain (BIND) Server implements the
44 Internet name server for UNIX systems.
45 It augments or replaces the
46 .I /etc/hosts
47 file or hostname lookup, and frees a host from relying on
48 .I /etc/hosts
49 being up to date and complete.
51 In modern systems, even though the host table has been superseded by
52 DNS, it is still widely used for:
53 .TP
54 .B bootstrapping
55 Most systems have a small host table containing the name and address
56 information for important hosts on the local network.
57 This is useful
58 when DNS is not running, for example during system bootup.
59 .TP
60 .B NIS
61 Sites that use NIS use the host table as input to the NIS host
62 database.
63 Even though NIS can be used with DNS, most NIS sites still
64 use the host table with an entry for all local hosts as a backup.
65 .TP
66 .B isolated nodes
67 Very small sites that are isolated from the network use the host table
68 instead of DNS.
69 If the local information rarely changes, and the
70 network is not connected to the Internet, DNS offers little
71 advantage.
72 .SH FILES
73 .I /etc/hosts
74 .SH NOTES
75 Modifications to this file normally take effect immediately,
76 except in cases where the file is cached by applications.
77 .SS Historical notes
78 RFC\ 952 gave the original format for the host table, though it has
79 since changed.
81 Before the advent of DNS, the host table was the only way of resolving
82 hostnames on the fledgling Internet.
83 Indeed, this file could be
84 created from the official host data base maintained at the Network
85 Information Control Center (NIC), though local changes were often
86 required to bring it up to date regarding unofficial aliases and/or
87 unknown hosts.
88 The NIC no longer maintains the hosts.txt files,
89 though looking around at the time of writing (circa 2000), there are
90 historical hosts.txt files on the WWW.
91 I just found three, from 92,
92 94, and 95.
93 .SH EXAMPLES
94 .EX
95 # The following lines are desirable for IPv4 capable hosts
96 127.0.0.1       localhost
98 # 127.0.1.1 is often used for the FQDN of the machine
99 127.0.1.1       thishost.example.org   thishost
100 192.168.1.10    foo.example.org        foo
101 192.168.1.13    bar.example.org        bar
102 146.82.138.7    master.debian.org      master
103 209.237.226.90  www.opensource.org
105 # The following lines are desirable for IPv6 capable hosts
106 ::1             localhost ip6\-localhost ip6\-loopback
107 ff02::1         ip6\-allnodes
108 ff02::2         ip6\-allrouters
110 .SH SEE ALSO
111 .BR hostname (1),
112 .BR resolver (3),
113 .BR host.conf (5),
114 .BR resolv.conf (5),
115 .BR resolver (5),
116 .BR hostname (7),
117 .BR named (8)
119 Internet RFC\ 952
120 .\" .SH AUTHOR
121 .\" This manual page was written by Manoj Srivastava <srivasta@debian.org>,
122 .\" for the Debian GNU/Linux system.