1
0
Files
2022-09-29 17:59:04 +03:00

91 lines
2.4 KiB
Plaintext

.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" @(#)hosts.5 6.3 (Berkeley) 5/14/86
.\"
.TH hosts 4
.SH NAME
hosts \- hostname-address database
.SH DESCRIPTION
The
.I /etc/hosts
file contains information regarding
the known hosts on the network.
For each host a single line should be present
with the following information:
.RS
.IP \(bu 3
Internet address
.IP \(bu 3
official hostname
.IP \(bu 3
aliases (optional)
.RE
.PP
Items are separated by any number of blanks and/or
tab characters.
A \f3#\f1 indicates the beginning of
a comment; characters up to the end of the line are
not interpreted by routines that search the file.
For example,
.Ex
192.0.2.2 iris.widgets.com iris
.Ee
This file must include entries for all of the machine's network interfaces,
the localhost address
and a few important machines on the local network.
.IR ifconfig (1M)
uses this file when assigning addresses to the network interfaces
during system initialization.
.P
By default, this file is used by
.IR gethostbyname (3N)
and
.IR gethostbyaddr (3N)
only when the NIS or
the Berkeley Internet name server
.RI ( named (1M))
are not enabled.
The system can be configured to use NIS,
.IR named ,
and/or this file, as described in
.IR resolver (4).
.PP
If the host is not connected to any network, the file
should contain an entry defining the hostname as an
alias for the localhost entry.
For example, if the hostname is IRIS, the
.I /etc/hosts
file should contain this line:
.Ex
127.1 localhost IRIS
.Ee
Sites connected to the Internet should configure the system
to use the name server.
This file can be created from the official host
database maintained at the Network Information
Center (NIC), though local changes may be required
to bring it up to date regarding unofficial aliases
and/or unknown hosts.
The host database maintained at NIC
is incomplete.
.PP
Network addresses are specified in the conventional
dot (.) notation using the \f2inet_addr\fP() routine
from the Internet address manipulation library,
.IR inet (3N).
Legal hostnames can contain any alphanumeric
character, the minus sign (\-) and period (.).
Periods are not part of the name but serve to separate components
of a domain-style name.
.SH FILES
/etc/hosts
.SH "SEE ALSO"
ifconfig(1M),
named(1M),
gethostbyname(3N),
resolver(4),
sys_id(4),
hostname(5).