home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeTCP/IP Network AdministrationSearch this book

3.2. The Host Table

The host table is a simple text file that associates IP addresses with hostnames. On most Unix systems, the table is in the file /etc/hosts. Each table entry in /etc/hosts contains an IP address separated by whitespace from a list of hostnames associated with that address. Comments begin with #.

The host table on rodent might contain the following entries:

# Table of IP addresses and hostnames 
#     rodent.wrotethebook.com rodent       localhost     crab.wrotethebook.com crab loghost     jerboas.wrotethebook.com jerboas     horseshoe.wrotethebook.com horseshoe      ora.wrotethebook.com ora      linuxuser.articles.wrotethebook.com linuxuser

The first entry in the sample table is for rodent itself. The IP address is associated with the hostname rodent.wrotethebook.com and the alternate hostname (or alias) rodent. The hostname and all of its aliases resolve to the same IP address, in this case

Aliases provide for name changes, alternate spellings, and shorter hostnames. They also allow for "generic hostnames." Look at the entry for One of the aliases associated with that address is loghost. loghost is a special hostname used by Solaris in the syslog.conf configuration file. Some systems preconfigure programs like syslogd to direct their output to the host that has a certain generic name. You can direct the output to any host you choose by assigning it the appropriate generic name as an alias. Other commonly used generic hostnames are lprhost, mailhost, and dumphost.

The second entry in the sample file assigns the address to the hostname localhost. As we have discussed, the network address is reserved for the loopback network. The host address is a special address used to designate the loopback address of the local host -- hence the hostname localhost. This special addressing convention allows the host to address itself the same way it addresses a remote host. The loopback address simplifies software by allowing common code to be used for communicating with local or remote processes. This addressing convention also reduces network traffic because the localhost address is associated with a loopback device that loops data back to the host before it is written out to the network.

Although the host table system has been superseded by DNS, it is still widely used for the following reasons:

The old host table system is inadequate for the global Internet for two reasons: inability to scale and lack of an automated update process. Prior to the development of DNS, an organization called the Network Information Center (NIC) maintained a large table of Internet hosts called the NIC host table. Hosts included in the table were called registered hosts, and the NIC placed hostnames and addresses into this file for all sites on the Internet.

Even when the host table was the primary means of translating hostnames to IP addresses, most sites registered only a limited number of key systems. But even with limited registration, the table grew so large that it became an inefficient way to convert hostnames to IP addresses. There is no way that a simple table could provide adequate service for the enormous number of hosts on today's Internet.

Another problem with the host table system is that it lacks a technique for automatically distributing information about newly registered hosts. Newly registered hosts can be referenced by name as soon as a site receives the new version of the host table. However, there is no way to guarantee that the host table is distributed to a site, and no way to know who had a current version of the table and who did not. This lack of guaranteed uniform distribution is a major weakness of the host table system.

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.