2 The hosts file

The file /etc/hosts specifies a mapping between host names and their corresponding numerical IP addresses. You can use the command man hosts to read the manual page of this command. Instead of repeating contents from the manual, this section discusses the rationale of this file, and how it may be useful.

For most domain name to IP address translation, most hosts rely on DNS (domain name system) servers. It would appear that there is no need of this /etc/hosts file. In reality, however, this file is quite useful. Let us examine a few applications.

127.0.0.1 localhost

This entry is important because each host is its own localhost. Furthermore, the name localhost does not comply to the rule of a domain name.

This file is also a good backup in case the DNS servers are not accessible. Entries of important servers, such as backup file servers, should be entered into this file. This way, even if DNS services is interrupted, critical operations will continue.