Creating /etc/hosts
The /etc/hosts file can be defined as follows:
- The maximum line length is 256 characters. If a line is greater than 256 characters, it is truncated to 256 characters and processed. If Trace Resolver is active, a warning message is issued.
- The line starts with an IP address, followed by a blank, followed by host names. Host names are separated by one or more blanks. The first host name that follows an IP address is the official host name, or CNAME (canonical name). Any additional host names that follow the CNAME are alias host names.
- Only IPv4 addresses are supported.
- Each IP address can have up to 35 host names. A host name can have up to 35 IP addresses.
- The values for the host name must conform to the following rules:
- Maximum of 128 characters.
- Must contain one or more tokens that are separated by a period.
- Each token must be at least one character and less than 64 characters.
- The first character in each token must be a letter (A-Z or a-z) or number (0-9).
- A comment is indicated by the # or ; character.
For the search orders used in locating /etc/hosts, see Configuration files for TCP/IP applications.