xref: /netbsd-src/share/man/man5/hosts.5 (revision 481fca6e59249d8ffcf24fef7cfbe7b131bfb080)
1.\"	$NetBSD: hosts.5,v 1.7 2000/06/14 03:57:23 itojun 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. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     @(#)hosts.5	8.2 (Berkeley) 12/11/93
35.\"
36.Dd January 16, 1999
37.Dt HOSTS 5
38.Os
39.Sh NAME
40.Nm hosts
41.Nd host name data base
42.Sh DESCRIPTION
43The
44.Nm hosts
45file contains information regarding
46It can be used in conjunction with the DNS, and the
47.Tn NIS
48maps
49.Sq hosts.byaddr ,
50and
51.Sq hosts.byname ,
52as controlled by
53.Xr nsswitch.conf 5 .
54.Pp
55the known hosts on the network.
56For each host a single line should be present
57with the following information:
58.Bd -unfilled -offset indent
59Internet address
60Official host name
61Aliases
62.Ed
63.Pp
64Items are separated by any number of blanks and/or
65tab characters.  A ``#'' indicates the beginning of
66a comment; characters up to the end of the line are
67not interpreted by routines which search the file.
68.Pp
69When using the name server
70.Xr named 8 ,
71or
72.Xr ypserv 8 ,
73this file provides a backup when the name server
74is not running.
75For the name server, it is suggested that only a few addresses
76be included in this file.
77These include address for the local interfaces that
78.Xr ifconfig 8
79needs at boot time and a few machines on the local network.
80.Pp
81This file may be created from the official host
82data base maintained at the Network Information Control
83Center
84.Pq Tn NIC ,
85though local changes may be required
86to bring it up to date regarding unofficial aliases
87and/or unknown hosts.  As the data base maintained at
88.Tn NIC
89is incomplete, use of the name server is recommended for
90sites on the
91.Tn DARPA
92Internet.
93.Pp
94As network addresses, both IPv4 and IPv6 addresses are allowed.
95IPv4 addresses are specified in the conventional
96``.'' (dot) notation using the
97.Xr inet_pton 3
98routine
99from the Internet address manipulation library,
100.Xr inet 3 .
101IPv6 addresses are specified in the standard hex-and-colon notation.
102Host names may contain any printable
103character other than a field delimiter, newline,
104or comment character.
105.Sh FILES
106.Bl -tag -width /etc/hosts -compact
107.It Pa /etc/hosts
108The
109.Nm hosts
110file resides in
111.Pa /etc .
112.El
113.Sh SEE ALSO
114.Xr gethostbyname 3 ,
115.Xr nsswitch.conf 5 ,
116.Xr ifconfig 8 ,
117.Xr named 8
118.Rs
119.%T "Name Server Operations Guide for BIND"
120.Re
121.Sh HISTORY
122The
123.Nm
124file format appeared in
125.Bx 4.2 .
126