xref: /netbsd-src/share/man/man5/hosts.5 (revision 33da33a43d09510557954c3a697b2487d79dbeb8)
1.\"	$NetBSD: hosts.5,v 1.14 2021/03/12 10:00:32 uwe Exp $
2.\"
3.\" Copyright (c) 1983, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)hosts.5	8.2 (Berkeley) 12/11/93
31.\"
32.Dd November 17, 2000
33.Dt HOSTS 5
34.Os
35.Sh NAME
36.Nm hosts
37.Nd host name data base
38.Sh DESCRIPTION
39The
40.Nm hosts
41file contains information regarding the known hosts on the network.
42It can be used in conjunction with the DNS, and the
43.Tn NIS
44maps
45.Sq hosts.byaddr ,
46and
47.Sq hosts.byname ,
48as controlled by
49.Xr nsswitch.conf 5 .
50.Pp
51For each host a single line should be present
52with the following information:
53.Dl address hostname [alias ...]
54.Pp
55These are:
56.Bl -tag -width hostname -compact -offset indent
57.It Em address
58Internet address
59.It Em hostname
60Official host name
61.It Em alias
62Alias host name
63.El
64.Pp
65Items are separated by any number of blanks and/or
66tab characters.  A hash sign
67.Pq Dq \&#
68indicates the beginning of
69a comment; characters up to the end of the line are
70not interpreted by routines which search the file.
71.Pp
72When using the name server
73.Xr named 8 ,
74or
75.Xr ypserv 8 ,
76this file provides a backup when the name server
77is not running.
78For the name server, it is suggested that only a few addresses
79be included in this file.
80These include address for the local interfaces that
81.Xr ifconfig 8
82needs at boot time and a few machines on the local network.
83.Pp
84As network addresses, both IPv4 and IPv6 addresses are allowed.
85IPv4 addresses are specified in the conventional dot
86.Pq Dq \&.
87notation using the
88.Xr inet_pton 3
89routine
90from the Internet address manipulation library,
91.Xr inet 3 .
92IPv6 addresses are specified in the standard hex-and-colon notation.
93Host names may contain any printable
94character other than a field delimiter, newline,
95or comment character.
96.Sh FILES
97.Bl -tag -width /etc/hosts -compact
98.It Pa /etc/hosts
99The
100.Nm hosts
101file resides in
102.Pa /etc .
103.El
104.Sh SEE ALSO
105.Xr gethostbyname 3 ,
106.Xr nsswitch.conf 5 ,
107.Xr ifconfig 8 ,
108.Xr named 8
109.Rs
110.%T "Name Server Operations Guide for BIND"
111.Re
112.Sh HISTORY
113The
114.Nm
115file format appeared in
116.Bx 4.2 .
117