Defines the Internet Protocol (IP) name and address of the local host and specifies the names and addresses of remote hosts.
The /etc/hosts file contains the Internet Protocol (IP) host names and addresses for the local host and other hosts in the Internet network. This file is used to resolve a name into an address (that is, to translate a host name into its Internet address). When your system is using a name server, the file is accessed only if the name server cannot resolve the host name.
When the local host is using the DOMAIN protocol, the resolver routines query a remote DOMAIN name server before searching this file. In a flat network with no name server, the resolver routines search this file for host name and address data.
Entries in the hosts file have the following format:
Address HostName
In this entry, Address is an IP address specified in either dotted decimal or octal format, and HostName is the name of a host specified in either relative or absolute domain name format. If you specify the absolute domain name, the portion of the name preceding the first . (period) has a maximum length of 63 characters and cannot contain blanks. For both formats of the name, the total number of characters cannot exceed 255 characters, and each entry must be contained on one line. Multiple HostNames (or aliases) can be specified.
This file can contain two special case entries that define reserved (or well-known) host names. These host names are:
| Item | Description | 
|---|---|
| timeserver | Identifies a remote time server host. This host name is used by the setclock command. | 
| printserver | Identifies the default host for receiving print requests. | 
In this hosts file entry, the Address parameter is an IP address specified in either dotted decimal or octal format, and each HostName parameter is a host name specified in either relative or absolute domain name format. These never have the full domain name listed; they are always listed as either printserver or timeserver.
Entries in this file can be made by using the System Management Interface Tool (SMIT) or the hostent command, or by creating and editing the file with an editor.
In these examples, the name of the local host is the first line in each hosts file. This is to help you identify the host whose file is being displayed. Your host does not have to be defined on the first line of your hosts file.
Host1
185.300.10.1  host1
185.300.10.2  host2
185.300.10.3  host3
185.300.10.4  host4 merlin
185.300.10.5  host5 arthur king
185.300.10.5   timeserver185.300.10.2  host2
185.300.10.1  host1
185.300.10.3  host3
185.300.10.4  host4 merlin
185.300.10.5  host5 arthur kingHost 5
128.114.1.15  name1.xyz.aus.century.com  name1
128.114.1.14  name2.xyz.aus.century.com  name2
128.114.1.16  name3.xyz.aus.century.com  name3