The History of /etc/hosts

Historically, systems on the Internet used the file HOSTS.TXT to propagate host IP addresses and name information. This is a plain text file that is searched from beginning to end for each forward lookup (a name is provided and an IP address is returned) or an inverse lookup (an IP address is provided and a name is returned). The file format for HOSTS.TXT and /etc/hosts is given in Figure 2-1.

Figure 2-1. The format of /etc/hosts.

The fields are delimited by white space. Field 1 is the IP address. Field 2 is the formal name of the system. Additional fields (up to the comment character #) are alias names for this device. An optional comment is allowed after the # sign.

 ip_address name alias_names # comment 15.24.44.65 ...

Get OpenView Network Node Manager: Designing and Implementing an Enterprise Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.