-->

Previous | Table of Contents | Next

Page 250

Stock Network Configuration

Red Hat Linux comes with networking enabled. The easiest way to get started with networking is to configure it as part of your installation. If you are not familiar with the information requested, you can skip it and reconfigure it later with the netcfg program.

Begin by starting up the X Window environment and running netcfg from an xterm window. The opening window should look something like Figure 13.1.


Figure 13.1. The Network
Configurator Names menu.

If your Hostname: and Domain: entries already have entries in them, don't worry. That just means you've already set those values during the installation. If not, enter the appropriate information for your hostname and domain name. If you are unsure of these, contact your local network administrator to find out.

The Search for hostnames in additional domains: box should be left blank unless you want to be able to specify hostnames from multiple domains without having to use their fully qualified domain names. This is usually a bad idea.

The Nameservers: box is important. This will tell your network where to resolve hostnames that are not local to your network. Each line should contain the IP address of every DNS server you want to query (with a maximum of three). If you do not know this information, again, contact your network administrator and ask. If you are the network administrator, read the section on setting up a DNS server, "The Domain Name Service."

When you are done entering this information, click the Hosts button at the top of the window. The window will change to look like Figure 13.2.

Page 251


Figure 13.2.
The Network
Configurator Hosts menu.

This is what will become the /etc/hosts file. (See the section "The Domain Name Service," later in this chapter, for detailed information.) This file essentially provides a mapping from hostnames to IP numbers. At the very least, you should provide mappings for any machines on your network necessary as part of your boot procedure (such as servers). For example, if you wanted to add an entry for the host vestax whose IP address is 192.168.42.7, you would do the following:

  1. Click the Add button, which is toward the bottom of the window. This brings up the Edit /etc/hosts window; it has three entries.
  2. In the first box for the IP number, enter vestax's IP address.
  3. In the Name box, enter the name vestax.
  4. If vestax has any aliases, you can enter them in the Nicknames box. If there are no aliases, leave that box blank.
  5. Click Done to finish adding this entry. The Edit /etc/hosts window will close and the main window will show your addition in the table.

After you have entered all the hosts your system needs to know at boot time, click the button labeled Interfaces at the top of the window. The window will change to look like Figure 13.3.

You can configure an Ethernet device from this window. To configure your Ethernet card, do the following:

  1. Click the Add button at the bottom of the screen to bring up the Choose Interface window.
  2. In the Choose Interface window, click the button to select Ethernet and then click OK. The Choose Interface window will disappear and a new window titled Edit Ethernet/Bus Interface will appear.

Page 252


Figure 13.3.
The Network Configurator
Interfaces menu.

  1. In the Edit Ethernet/Bus Interface window, click the IP box and enter the IP address of your machine. The Netmask: box will automatically fill in, based on the address you provide in the IP box. If this is not correct, click the Netmask: box and make the necessary corrections.
  2. If you want this interface to automatically start at boot time, click the Activate interface at boot time button. Leave the Allow any user to (de)activate interface box unselected. It is a very bad practice to allow nonroot users to configure network settings.
  3. The Interface Configuration Protocol enables you to select alternative methods (BOOTP or DHCP) to configure your network interface. Unless you have been instructed by a network manager to use these protocols, leave this box blank. Click Done to bring up a new window asking whether you want to save the current configuration. Click Save to keep your addition. Both windows will close, leaving you back with the original Network Configurator window, this time showing your new network interface.

With your interface defined, you can now set routes and gateways for your machine. Click the button labeled Routing at the top of the window. This will change the Network Configurator window to look like Figure 13.4.

To set up your routing information, follow these steps:

  1. Click in the Gateway box and enter the IP address of your gateway to rest of the network. If you do not have a gateway machine (for example, you're configuring a local area network without an Internet connection), you can leave this blank.
  2. If you do have a gateway, enter the device name from which the gateway will be accessed. Most likely, this will be the device name that was configured in the Interfaces part of the Network Configurator window. If you are using a Ethernet card, this will most likely be eth0.

Page 253


Figure 13.4.
The Network Configurator
Routing menu.

  1. Click Save at the bottom of the window and then click Quit, which is also at the bottom. This will exit the netcfg program.

Your system now has the necessary scripts configured to establish your network connection. Before you can claim victory, you need to test the connection. Enter the following command to start the network connection:


/etc/rc.d/init.d/network stop;/etc/rc.d/init.d/network start

This will restart your network connection. Try pinging a machine in your immediate network using the ping command, like this:


ping IP_Address

where IP_Address is the IP address of the machine you are trying to ping. If you placed the IP address to hostname mapping in the Hosts section in netcfg, then you can use the hostname instead. This should return output similar to this:


PING 192.168.42.1 (192.168.42.1): 56 data bytes

64 bytes from 192.168.42.1: icmp_seq=0 ttl=255 time=1.0 ms

64 bytes from 192.168.42.1: icmp_seq=1 ttl=255 time=3.5 ms

-- 192.168.42.1 ping statistics --

2 packets transmitted, 2 packets received, 0% packet loss

round-trip min/avg/max = 1.0/24.4/47.8 ms

Note that in order to get ping to stop, you need to press Ctrl+C.

If you have an Internet connection, try pinging a machine outside of your network. This should result in output similar to the preceding, with the notable exception that the time measurements will be longer. If the ping fails at this point, try another host; it could be the other machine that has failed and not yours.

If the pings fail, restart netcfg and verify the information you provided it.

Previous | Table of Contents | Next