1.\" $NetBSD: hosts.5,v 1.13 2003/08/07 10:31:17 agc 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 84This file may be created from the official host 85data base maintained at the Network Information Control 86Center 87.Pq Tn NIC , 88though local changes may be required 89to bring it up to date regarding unofficial aliases 90and/or unknown hosts. As the data base maintained at 91.Tn NIC 92is incomplete, use of the name server is recommended for 93sites on the 94.Tn DARPA 95Internet. 96.Pp 97As network addresses, both IPv4 and IPv6 addresses are allowed. 98IPv4 addresses are specified in the conventional dot 99.Pq Dq \&. 100notation using the 101.Xr inet_pton 3 102routine 103from the Internet address manipulation library, 104.Xr inet 3 . 105IPv6 addresses are specified in the standard hex-and-colon notation. 106Host names may contain any printable 107character other than a field delimiter, newline, 108or comment character. 109.Sh FILES 110.Bl -tag -width /etc/hosts -compact 111.It Pa /etc/hosts 112The 113.Nm hosts 114file resides in 115.Pa /etc . 116.El 117.Sh SEE ALSO 118.Xr gethostbyname 3 , 119.Xr nsswitch.conf 5 , 120.Xr ifconfig 8 , 121.Xr named 8 122.Rs 123.%T "Name Server Operations Guide for BIND" 124.Re 125.Sh HISTORY 126The 127.Nm 128file format appeared in 129.Bx 4.2 . 130