[Previous] [Contents] [Index] [Next]

/etc/hosts

Hostname database (UNIX)

Name:

/etc/hosts

Description:

The /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:

internet_address  official_host_name  aliases

Items are separated by any number of spaces or tabs, or both; however, spaces or tabs aren't allowed before the IP address. A # indicates the beginning of a comment -- any characters after a #, up to the end of the line, aren't interpreted by routines that search the file.

If you're using a name server, this file provides a backup when the server isn't running. In this case, you should include only a few addresses in this file. These include addresses for the local interfaces that ifconfig needs at boot time and a few machines on the local network.

Network addresses are specified in the conventional "." (dot) notation using the inet_addr() routine from the internet address manipulation functions. Hostnames may contain any printable character other than a field delimiter, newline, or comment character.

See also:

ifconfig

gethostname() in the Library Reference

DNS and BIND by Paul Albitz and Cricket Liu, O'Reilly & Associates (ISBN 1-56592-010-4)


[Previous] [Contents] [Index] [Next]