Classnotes | UNIX02 | RecentChanges | Preferences Showing revision 1 Difference (from revision 1 to current revision)
(minor diff) (The revisions are identical or unavailable.)
DNS (Domain Name Service) is the standard means by which host names get resolved into IP addresses, however, you will want at least some simple host name resolution without going through a DNS server. Your Linux system may need a simple host name resolution for start up scripts, or you may want to have a more quick lookup for certain hosts, or you may even want to redirect certain host names to other hosts. This is where the /etc/hosts file comes in.
Your hosts file is a white-space separated configuration file with three columns. The first column contains the IP, the second column contains the fully qualified domain name, and the third column contains the optional aliases.
By default, you should have at least the following in your hosts file (this is the default Red Hat hosts file):
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
If you will recall, this is the looback interface that was mentionned earlier.
You may have a more complicated network, then you would have other entries in the hosts file as well. Here is an example from a ficticious Brewery company: