11.1 Configuring Hosts

Most systems attached to a network use DNS services to determine the IP address associated with a hostname. However, private hosts on your local network won't be known to your ISP's DNS and therefore can be accessed only by IP address, not by hostname. Moreover, Samba and other local area network services won't operate correctly unless they can resolve hostnames.

Fortunately, using the Network Administration Tool, you can configure your system to determine the IP address associated with a hostname even when DNS services are not available. To do so, use the Hosts tab of the Network Administration Tool, shown in Figure 11-1.

Figure 11-1. The Hosts tab of the Network Administration Tool

To specify host information, launch the Network Administration Tool by choosing System Settings Network from the GNOME or KDE menu. Select the Hosts tab of the Tool, click Add. The Add/Edit Hosts entry dialog box appears, as shown in Figure 11-2. Specify the IP address and name of the host. If desired, you can specify one or more aliases or abbreviated names for the host. By default, the host information includes an entry for the IP address, which is associated with the hostname localhost. You should not disturb this entry, which provides a way for your system to access its own network facilities.

Figure 11-2. The Add/Edit Hosts entry dialog box

Linux stores configured hostnames in the file /etc/hosts, which you can edit by using a text editor, if you prefer. Windows has a similar file that you must revise in order for Windows hosts to interoperate with Samba and other Linux-based services. The file is named hosts and resides in an etc subdirectory of your Windows directory. Under Windows 2000, the path of the file is often c:\windows\system32\drivers\etc\hosts; the location varies slightly depending on the installation options.

Each line of the file describes a single host. The left column contains the host's IP address and the right column contains the associated hostname or names. If multiple names (aliases) appear, the principal name is given first. Simply use a text editor, such as Notepad, to add the appropriate lines describing your local hosts.