The Local Host Table — etchosts

International organizations info New, recently introduced top−level domain of general nature The Network Information Center NIC had the authority to allocate domains. An official application to the NIC must be submitted to obtain a domain. The NICs approval meant that a new domain is registered and it granted complete authority over the domain. Any registered domain had the authority to divide its domain into subdomains arbitrarily, without consulting the NIC. The decision to add additional subdomains is completely up to the local network administrator. Currently, NIC authority has moved to other organizations, but we will continue to refer to NIC as a central authorization body. An address assignment is in some ways similar to a domain assignment. The NIC assigns a network address or several addresses corresponding to the domain, and the network administrator for the domain may assign subnet addresses and host addresses belonging to the assigned network. The NIC is the central authority that delegates power and distributes control over names and addresses to individual organizations. Once that authority has been delegated, the individual organization is responsible for managing the names and addresses it has been assigned. The parallel between subnet and subdomain assignments is only verbal; subnets and subdomains must not be linked, although sometimes such links could make the administration easier. A subdomain may contain information about hosts from several different networks. Creating a new subnet does not require the creation of a new subdomain, and vice versa.

16.1.3 Host Database Files

The basic function of the name service is to enable the hosts domain name to be mapped to its IP address, and in this way, to make inter−host communication possible. Independently of how the name service is organized for a particular site, the information must be stored somewhere, making a corresponding host database available to the host itself at any time. The corresponding host database files are also called host tables.

16.1.3.1 The Local Host Table — etchosts

The local host table the word local should be understood as internal; the data always refer to the network is a simple text file that associates IP addresses with host names. This table is in the file etchosts. Each entry line in the host table has the following format: ipaddress hostname aliases where ipaddress IP address of the host hostname Domain name of the host aliases One or more aliases alternative names for this host An example of the etchosts file is: 371 −−−−−−−−−−−−−−− etchosts −−−−−−−−−−−−−−−−− Sun Host Database If the NIS is running, this file is only consulted when booting 127.0.0.1 localhost 146.98.1.15 default gateway 146.98.1.2 hcprophet 146.98.1.4 mvaxgr 146.98.1.11 patsy mailhost loghost 146.98.6.15 indigo1.ch indigo1 146.98.1.21 rs01−ch 146.98.1.22 rs02−ch ... ... Email relay gateway 128.228.1.2 cunyvm.cuny.edu ddn−gateway Campus email relay 146.98.8.31 apollo.ph.myschool.scps.edu apollo.ph apollo Other locations 146.98.2.71 everest ... ... Other departments 146.98.1.111 mathsci 146.98.14.14 genectr.myschool.scps.edu genectr rcmi smtp gateway ... ... One entry assigns the address 127.0.0.1 to the host name localhost. As we already know, the class A network address 127 is reserved for the loopback network. This host address is a special address used to designate the loopback address of the local host. The special addressing convention allows the host to address itself in the same way as it addresses any remote host, using the same IP address on any host, which obviously makes the implemented software simpler. It also reduces network traffic because the local host address is associated with a loopback device that loops data back to the host before it is sent out to the network. Although the local host table has been superseded by DNS, it is still required and used for the following reasons: All systems must have a small host table containing the name and address information of the host itself and sometimes of the important hosts on the local network. This table is used during the initial system startup, when DNS is not running DNS is started in the last phase of the system startup. The etchosts file must include entries for the host itself, the localhost, the gateways, and depending on the implemented network services, the servers on the local network. • Sites that use NIS Network Information System use the host table as input to the NIS host database. Even when NIS is used in conjunction with DNS, most NIS sites create a complete NIS host database that has an entry for every host on the network belonging to the NIS domain. The corresponding etchosts file must exist on the master NIS server. • Very small sites sometimes use the host table. If there are few local hosts and there is no need to communicate with remote sites, then there is little advantage in using DNS. • 372 An exception is Linux which eliminated a need for the etchosts file entirely. However, it is still recommended to maintain the file itself for a backward compatibility; Linux does not use the file etchosts, but still needs to get and keep host data somewhere; in Linux this is the file etcsysconfignetwork. Here is an example: cat etcsysconfignetwork NETWORKING=yes FORWARD_IPV4=false HOSTNAME=broome DOMAINNAME=scps.nyu.edu GATEWAY=128.122.71.65 Presented domain data is related to the NIS domain see Chapter 17 to learn about NIS; however, in this case DNS and NIS domain names match. 16.1.3.2 Aliases Aliases provide alternate host names, alternate spellings, and shorter host names. They are painless solutions for host name changes. They also fit well for such generic host names, as loghost, mailhost, lprhost, or dumphost. Some programs are written to direct their output to whichever host has been given a certain generic name. In this way, by assigning the appropriate generic host name as an alias, the output of such programs can be forwarded to any host on the network. For example, loghost is a special host name used by the syslog daemon, syslogd. Program syslog will direct its output to the host with the alias loghost; of course, in most cases this is the alias for the local host itself.

16.1.3.3 Maintaining the etchosts File