SPY HILL Research
Spy-Hill.net

Poughkeepsie, New York [DIR] [UP]

Network Connection and Configuration - Red Hat Linux

IP Address

Every computer on a network must have an IP Address (Internet Protocol address). The IP Address for a computer is like the phone number of a telephone. At Vassar your IP address will be of the form 143.229.xxx.yyy, where xxx represents the subnet and depends on which dorm or building you are in, and yyy is unique to your computer.

Most computers on campus obtain an IP address automatically via DHCP (the Dynamic Host Configuration Protocol). Some computers require a static IP address which is assigned by CIS. If you don't know that you need a static IP address then you should configure your machine to use DHCP.

Network Configuration

The easiest way to configure your network connection on Red Hat Linux is to run the 'netconfig' utility. You need to become the root user, either by logging in as root or by using the command `su root` in a command shell (terminal window). Then give the command
   #  netconfig   
(The # represents the command prompt for the root user - you do not need to type it.) The netconfig utility will ask you if you would like to set up networking. Push the "Yes" button. (Use the tab key to move between items.)

To have your computer configure itself automatically with DHCP simply select the item "Use Dynamic IP configuration" by pressing the space bar when that item is highlighted.

To configure you computer to use a static IP address, tab down the form and fill in the IP address, the Netmask (which will be 255.255.255.0), the Default gateway (which will be 143.229.xxx.1, where xxx is the subnet for your dorm or building), and the Primary Nameserver (which is 143.229.1.6). Details on these settings are available here. Then press the "OK" button.

To make the changes take effect you need to restart the networking service, with the command:

   #  service network restart  
In Unix you do not need to reboot to change your network configuration. Remember though that you must be the root user to use the commands above. When you are done you should exit the root command shell or log out of the root account.

You can verify that the IP address and netmask have been set correctly using the ifconfig command:

   #  ifconfig		
This will list the IP address (as "inet addr") and the subnet mask (as "Mask") for the network interface "eth0" (your ethernet card). It will also list other details, including the hardware address of your ethernet card (as "HWaddr"), which is sometimes refered to as the "MAC address". This is an identifier for your ethernet card (like a serial number) and is different from the IP address.

(The ifconfig command will also give the status of the "loopback" device ("lo"), which is a simulated network connection from your computer back to itself. The IP address of the loopback device will be 127.0.0.1. You don't need to do anything to this interface.)

You can verify that the gateway (default route) is set correctly by giving the route command:

   #  route -n	 	
The default "Destination", which is listed as 0.0.0.0, should have a "Gateway" of 143.229.xxx.1, where xxx the subnet for your dorm or building. The -n "numeric" flag prevents DNS lookup and reports addresses in numeric form.

Network Configuration - details

In Unix it is possible to directly change the IP address, netmask, and broadcast address, using the ifconfig command like so:
   #  ifconfig eth0  143.229.xxx.yyy  netmask 255.255.255.0  
   #  ifconfig eth0  broadcast  143.229.xxx.255
Here xxx represents the subnet, and depends on which dorm or building you are in, and yyy is unique to your computer. The netmask is used to determine what part of a network address is considered local - The part of the address which is zero in the netmask is the local part of the address.

To send to an address outside of the local subnet reqires that the packets be sent to a gateway host or router. In Unix the default route (gateway) is set with the route command:

   #  route add -net default gw 143.229.xxx.1 eth0	
(The syntax of the route command is slightly different on Mac OS X, but the idea is the same.) You can verify these settings by giving the ifconfig or route commands with no arguments, in which case the network interface status or routing tables are printed to the screen.

These changes will go away after the next reboot. You can make permanent changes by editing the appropriate configuration files. Red Hat Linux keeps the network settings in the file /etc/sysconfig/network. This is also where the host name is kept. The file should look something like:

   NETWORKING=yes
   HOSTNAME=mandalay
   BOOTPROTO=static
   IPADDR=143.229.29.60
   NETMASK=255.255.255.0
   GATEWAY=143.229.29.1		
   
Figure 1: The file /etc/sysconfig/network for a static IP address.
You can edit this file with your favourite editor (eg. emacs) to change the IP address, netmask, gateway, or host name, and the changes will take effect the next time the network services are restarted.

Sometimes some of this information will be recorded in the file ifcfg-eth0 in the directory /etc/sysconfig/network-scripts instead. If you have more than one Network Interface Card (NIC), as for example a laptop with both a wired and wireless connection, then information for each NIC will appear in separate files in this directory with names of the form ifcfg-ethX for "eth0" and "eth1", etc. For example, to enable DHCP at boot for a wireless card which is "eth1" the file would contain:

   DEVICE=eth1
   ONBOOT=yes
   BOOTPROTO=DHCP   
Figure 2: The file /etc/sysconfig/network-scripts/ifcfg-eth1 for a wireless NIC, as in a laptop.

The Domain Name Service (DNS) provides a translation from a computer's name (eg. "mandalay.vasssar.edu") to it's IP address. To use the DNS you need to list one or more nameservers, by IP address, in the file /etc/reslove.conf. The contents of this file should look something like:

   search vassar.edu
   nameserver 143.229.1.6
   nameserver 143.229.1.3
   nameserver 143.229.1.4
   nameserver 141.211.96.15
Figure 3: The file /etc/resolve.conf for Vassar's DNS, with an off-campus backup.
It is useful to have several DNS servers listed in this file, because if one is not responding then your computer will automatically ask the next one on the list.

If you want your computer to use the Network Time Protocol (NTP) to automatically keep the clock syncronized to the Internet then you should edit the file /etc/ntp.conf to make sure it contains the lines:


   server  noether.vassar.edu
   server  mandalay.vassar.edu	
   
Figure 4: Excerpt from the file /etc/ntp.conf
These are both stratum 2 timeservers for the Vassar campus. It is useful to have two servers in case one is temporarily unavailable, and they have also been configured to syncronize their time with separate sets of stratum 1 servers for greater accuracy and stability.

You also need to be sure that the ntpd service is running and enabled at boot. For Red Hat Linux the commands are:

   #  chkconfig ntpd on
   #  service ntpd start  
  Copyright © 2006 by Spy Hill Research http://www.Spy-Hill.net/~myers/help/linux/config_rh.html (served by Islay.spy-hill.com) Last modified: 31 May 2006