1.\" $NetBSD: hosts.5,v 1.12 2001/09/08 01:29:05 wiz 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 November 17, 2000 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 the known hosts on the network. 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 55For each host a single line should be present 56with the following information: 57.Dl address hostname [alias ...] 58.Pp 59These are: 60.Bl -tag -width hostname -compact -offset indent 61.It Em address 62Internet address 63.It Em hostname 64Official host name 65.It Em alias 66Alias host name 67.El 68.Pp 69Items are separated by any number of blanks and/or 70tab characters. A hash sign 71.Pq Dq \&# 72indicates the beginning of 73a comment; characters up to the end of the line are 74not interpreted by routines which search the file. 75.Pp 76When using the name server 77.Xr named 8 , 78or 79.Xr ypserv 8 , 80this file provides a backup when the name server 81is not running. 82For the name server, it is suggested that only a few addresses 83be included in this file. 84These include address for the local interfaces that 85.Xr ifconfig 8 86needs at boot time and a few machines on the local network. 87.Pp 88This file may be created from the official host 89data base maintained at the Network Information Control 90Center 91.Pq Tn NIC , 92though local changes may be required 93to bring it up to date regarding unofficial aliases 94and/or unknown hosts. As the data base maintained at 95.Tn NIC 96is incomplete, use of the name server is recommended for 97sites on the 98.Tn DARPA 99Internet. 100.Pp 101As network addresses, both IPv4 and IPv6 addresses are allowed. 102IPv4 addresses are specified in the conventional dot 103.Pq Dq \&. 104notation using the 105.Xr inet_pton 3 106routine 107from the Internet address manipulation library, 108.Xr inet 3 . 109IPv6 addresses are specified in the standard hex-and-colon notation. 110Host names may contain any printable 111character other than a field delimiter, newline, 112or comment character. 113.Sh FILES 114.Bl -tag -width /etc/hosts -compact 115.It Pa /etc/hosts 116The 117.Nm hosts 118file resides in 119.Pa /etc . 120.El 121.Sh SEE ALSO 122.Xr gethostbyname 3 , 123.Xr nsswitch.conf 5 , 124.Xr ifconfig 8 , 125.Xr named 8 126.Rs 127.%T "Name Server Operations Guide for BIND" 128.Re 129.Sh HISTORY 130The 131.Nm 132file format appeared in 133.Bx 4.2 . 134