xref: /netbsd-src/share/man/man5/hosts.5 (revision 33da33a43d09510557954c3a697b2487d79dbeb8)
1*33da33a4Suwe.\"	$NetBSD: hosts.5,v 1.14 2021/03/12 10:00:32 uwe Exp $
2b5930afcSjtc.\"
3b5930afcSjtc.\" Copyright (c) 1983, 1991, 1993
4b5930afcSjtc.\"	The Regents of the University of California.  All rights reserved.
561f28255Scgd.\"
661f28255Scgd.\" Redistribution and use in source and binary forms, with or without
761f28255Scgd.\" modification, are permitted provided that the following conditions
861f28255Scgd.\" are met:
961f28255Scgd.\" 1. Redistributions of source code must retain the above copyright
1061f28255Scgd.\"    notice, this list of conditions and the following disclaimer.
1161f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright
1261f28255Scgd.\"    notice, this list of conditions and the following disclaimer in the
1361f28255Scgd.\"    documentation and/or other materials provided with the distribution.
14075022b3Sagc.\" 3. Neither the name of the University nor the names of its contributors
1561f28255Scgd.\"    may be used to endorse or promote products derived from this software
1661f28255Scgd.\"    without specific prior written permission.
1761f28255Scgd.\"
1861f28255Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1961f28255Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2061f28255Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2161f28255Scgd.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2261f28255Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2361f28255Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2461f28255Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2561f28255Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2661f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2761f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2861f28255Scgd.\" SUCH DAMAGE.
2961f28255Scgd.\"
30b5930afcSjtc.\"     @(#)hosts.5	8.2 (Berkeley) 12/11/93
3161f28255Scgd.\"
32ff1595ffSlukem.Dd November 17, 2000
3361f28255Scgd.Dt HOSTS 5
347a1aea16Sgarbled.Os
3561f28255Scgd.Sh NAME
3661f28255Scgd.Nm hosts
3761f28255Scgd.Nd host name data base
3861f28255Scgd.Sh DESCRIPTION
3961f28255ScgdThe
4061f28255Scgd.Nm hosts
412baa698aSlukemfile contains information regarding the known hosts on the network.
42abda4debSlukemIt can be used in conjunction with the DNS, and the
43abda4debSlukem.Tn NIS
44abda4debSlukemmaps
45abda4debSlukem.Sq hosts.byaddr ,
46abda4debSlukemand
47abda4debSlukem.Sq hosts.byname ,
48abda4debSlukemas controlled by
49abda4debSlukem.Xr nsswitch.conf 5 .
50abda4debSlukem.Pp
5161f28255ScgdFor each host a single line should be present
5261f28255Scgdwith the following information:
532baa698aSlukem.Dl address hostname [alias ...]
542baa698aSlukem.Pp
552baa698aSlukemThese are:
562baa698aSlukem.Bl -tag -width hostname -compact -offset indent
57ff1595ffSlukem.It Em address
5861f28255ScgdInternet address
59ff1595ffSlukem.It Em hostname
609572fc31SderaadtOfficial host name
61ff1595ffSlukem.It Em alias
622baa698aSlukemAlias host name
632baa698aSlukem.El
6461f28255Scgd.Pp
6561f28255ScgdItems are separated by any number of blanks and/or
6671e62d7dSlukemtab characters.  A hash sign
6771e62d7dSlukem.Pq Dq \&#
6871e62d7dSlukemindicates the beginning of
6961f28255Scgda comment; characters up to the end of the line are
7061f28255Scgdnot interpreted by routines which search the file.
7161f28255Scgd.Pp
7261f28255ScgdWhen using the name server
7361f28255Scgd.Xr named 8 ,
74abda4debSlukemor
75abda4debSlukem.Xr ypserv 8 ,
7661f28255Scgdthis file provides a backup when the name server
7761f28255Scgdis not running.
7861f28255ScgdFor the name server, it is suggested that only a few addresses
7961f28255Scgdbe included in this file.
8061f28255ScgdThese include address for the local interfaces that
8161f28255Scgd.Xr ifconfig 8
8261f28255Scgdneeds at boot time and a few machines on the local network.
8361f28255Scgd.Pp
84b08666e2SitojunAs network addresses, both IPv4 and IPv6 addresses are allowed.
8571e62d7dSlukemIPv4 addresses are specified in the conventional dot
8671e62d7dSlukem.Pq Dq \&.
8771e62d7dSlukemnotation using the
88b08666e2Sitojun.Xr inet_pton 3
8961f28255Scgdroutine
9061f28255Scgdfrom the Internet address manipulation library,
9161f28255Scgd.Xr inet 3 .
92b08666e2SitojunIPv6 addresses are specified in the standard hex-and-colon notation.
9361f28255ScgdHost names may contain any printable
9461f28255Scgdcharacter other than a field delimiter, newline,
9561f28255Scgdor comment character.
9661f28255Scgd.Sh FILES
9761f28255Scgd.Bl -tag -width /etc/hosts -compact
9861f28255Scgd.It Pa /etc/hosts
9961f28255ScgdThe
10061f28255Scgd.Nm hosts
10161f28255Scgdfile resides in
10261f28255Scgd.Pa /etc .
10361f28255Scgd.El
10461f28255Scgd.Sh SEE ALSO
10561f28255Scgd.Xr gethostbyname 3 ,
106abda4debSlukem.Xr nsswitch.conf 5 ,
10761f28255Scgd.Xr ifconfig 8 ,
10861f28255Scgd.Xr named 8
10961f28255Scgd.Rs
11061f28255Scgd.%T "Name Server Operations Guide for BIND"
11161f28255Scgd.Re
11261f28255Scgd.Sh HISTORY
11361f28255ScgdThe
11461f28255Scgd.Nm
11561f28255Scgdfile format appeared in
11661f28255Scgd.Bx 4.2 .
117