B.1 Hosts File

The sys:\etc\hosts file contains information about the known hosts on the IP internetwork. Typically, it is centrally administered and distributed to all local hosts. Its format, as shown in Figure B-1, is identical to /etc/hosts on UNIX systems. Each entry provides information about a single host. An entry cannot extend beyond one line.

Figure B-1 Sample Hosts File

The hosts file entry has the following format:

IP_address host_name [alias [...]]

The IP_address is a 4-byte address in standard dotted decimal notation. Each byte is a decimal, hexadecimal, or octal value and is separated by a period. Hexadecimal numbers must start with the character pair 0x or 0X; octal numbers must start with 0.

The host_name is the name of the system associated with this IP address. The name cannot contain a space, tab, pound sign (#), or end-of-line character. Each hostname must be unique.

The alias is another name for the same system. Typically, this is a shorter name. A single host can have from 1 to 10 aliases. For example, the host sales could have the following address and aliases:

129.0.9.5 sales sa saleshost

The sample file sys:\etc\samples\hosts is included with the TCP/IP software. When you are configuring TCP/IP for the first time, copy the sample hosts file from sys:\etc\samples to sys:\etc. You then edit the sys:\etc\hosts file. You can change your configuration at any time by editing your existing sys:\etc\hosts file.