Certification Objective 9.03: DHCP

 < Day Day Up > 



There are two protocols that allow a client computer to get network configuration information from a server: DHCP (Dynamic Host Configuration Protocol) and bootp. DHCP works if you have a DHCP server on the local network. The bootp protocol is required if you're getting information from a DHCP server on another network.

DHCP servers can simplify and centralize network administration if you're administering more than a few computers on a network. They are especially convenient for networks with a significant number of mobile users. The bootp protocol is essentially just a way to access a DHCP server on a remote network.

As of this writing, Red Hat does not include any GUI tool to configure a DHCP server. You'll have to do your work in this section from the command line interface.

Exam Watch 

While DHCP knowledge is not explicitly listed in the current Red Hat Exam Prep guide, it is a part of the associated curriculum. Based on their outlines, the RHCT course, RH133, teaches you how to configure a DHCP client. The RHCE course, RH300, teaches you how to configure a DHCP server. It is important for any network administrator to know DHCP. You'll have to make your own decision regarding whether you'll need to study how to create a DHCP server for your exam.

Installing DHCP Packages

As with most network services, DHCP has a client and a server. These are based on the dhcp-3.0pl2-6.14 and dhclient-3.0pl2-6.14 RPM packages. The dhclient RPM package should be installed by default. The dhcp RPM package is installed by default with the Network Server package group. Install them if required.

On The Job 

Red Hat seems to change the commands and packages related to the DHCP client frequently. Recent versions of Red Hat have used dhcpcd and pump as DHCP client commands. If you are using a different version of Red Hat Linux, make sure you've installed the right packages and are using the right commands.

DHCP Server Configuration

A DHCP server sends messages to multiple computers on a LAN. This is also known as a multicast. It should be enabled by default in RHEL 3. You can confirm this with the ifconfig command. The output should resemble Figure 9-12, which includes a MULTICAST setting for the active network card.

click to expand
Figure 9-12: Active network interfaces MULTICAST

If you don't see MULTICAST associated with your network card, someone has compiled this feature out of your kernel. For more information on the kernel management process, see Chapter 5.

Now configure the DHCP server daemon, dhcpd, by creating or editing the /etc/dhcpd.conf configuration file. Normally, this file allows the DHCP server to randomly assign IP addresses from a specific range. If you don't already have an /etc/dhcpd.conf file, you can start with the dhcpd.conf.sample file in the /usr/share/doc/dhcp-3.0-pl2 directory. The lines that start with a hash mark (#) are comments in the file. Let's analyze this sample file in detail:

  • ddns-update-style interim With this command, the RHEL 3 DHCP server conforms as closely as possible to the new Dynamic DNS standard, where the DNS database is updated when the DNS server renews its DHCP lease. It is 'interim' because the standards for DDNS are not complete as of this writing.

  • ignore client-updates A good setting if you don't want to allow users on client computers to change their hostnames.

  • subnet 192.168.0.0 netmask 255.255.255.0 Describes a network with an address of 192.168.0.0 and a subnet mask of 255.255.255.0. This allows you to assign addresses in the range 192.168.0.1-192.168.0.254 to different computers on this network. Naturally, if you've configured a different network IP address, you'll want to change these settings accordingly.

  • option routers Lists the default router. You can add additional option routers commands if you have more than one connection to an outside network. This information is passed to DHCP clients as the default gateway, which supports access to outside networks such as the Internet. Naturally, you'll want this command to reflect the IP address for the gateway for your network.

  • option subnet-mask Specifies the subnet mask for the local network.

  • option nis-domain Notes the server that provides the NIS shared authorization database. If you've configured NIS on your network, you'll want to substitute the name of your domain for domain.org. Otherwise, you should comment out this command.

  • option domain-name Adds the domain name for your network. If your domain name is different, you'll want to change this command accordingly.

  • option domain-name-servers Notes the IP address for the DNS server for your network. You can add more commands of this type to specify additional DNS servers.

  • option time-offset Lists the difference from Greenwich Mean Time, also known as UTC (a French acronym), in seconds.

  • option ntp-servers Notes any Network Time Protocol (NTP) servers for keeping the time on the local computer in sync with UTC. I describe NTP in more detail later in this chapter.

  • option netbios-name-servers Adds the location of any Windows Internet Naming Service (WINS) servers for your network. As this is a Microsoft service, I only refer to it briefly in my description of Samba in Chapter 8.

  • option netbios-node-type 2 Peer-to-peer node searches, associated with WINS.

  • range dynamic-bootp 192.168.0.128 192.168.0.254 Notes the assignable IP addresses to remote networks, using the bootp protocol. (Drop the dynamic-bootp for a local network.) Remember the space between the IP addresses! (Don't use the 192.168.0.255 address in the sample dhcpd.conf file.)

  • default-lease-time Specifies the lease time for IP address information, in seconds.

  • max-lease-time Specifies the maximum lease time for IP address information, in seconds.

  • next-server Notes the boot server for network computers. If you don't have any network computers, you can comment out this entire stanza.

You can also assign a specific IP address to a computer based on a client's Ethernet address. Just add an entry similar to the following to /etc/dhcpd.conf:

host dragonfire {      hardware ethernet 08:00:12:23:4d:3f;      fixed-address 192.168.0.201;   }

This assigns the IP address 192.168.1.201 to a client named dragonfire with the Ethernet hardware address 08:00:12:23:4d:3f.

Naturally, you'll want to modify this file accordingly for your particular network. For example, if you've configured computers on the example.com network described earlier in this chapter, you'll want to substitute example.com and the associated IP addresses in your /etc/dhcpd.conf file. I've done this for my network in Figure 9-13.

click to expand
Figure 9-13: Sample DHCP configuration file

On The Job 

To assign an IP address to a specific network card on a specific computer, you need the hardware address, which can be found via the ifconfig command.

DHCP can be customized for individual computers. You can set up static IP addresses for servers. Once you're ready, start the dhcpd service with the following command:

# service dhcpd start

By default, this starts a DHCP server, which listens for requests on the eth0 network card. Alternatively, to have a DHCP server listen on the eth1 network interface, run the following command:

# service dhcpd start eth1

If these commands don't get a response, you probably haven't created a /etc/dhcpd.conf configuration file.

You can watch the DHCP server in action. Stop the DHCP server with the service dhcpd stop command. You can then restart it in the foreground with the following command:

# /usr/sbin/dhcpd -d -f

Start another Linux/Unix client. Make it look for another DHCP lease with the dhclient -r and dhclient commands, then watch the console of the server. You'll see a number of DHCP communication messages on the server that illustrates the process of leasing an IP address to a client.

On The Job 

Another easy way to get the MAC address for a given client is to watch the DHCP server messages.

Once you've configured your DHCP server to your satisfaction, remember to activate it at the appropriate runlevels. For example, the following command activates the DHCP daemon when you boot Linux into runlevels 3 and 5:

# chkconfig --level 35 dhcpd on

DHCP and Microsoft Windows

In order for the DHCP server to work correctly with picky DHCP clients such as Microsoft Windows 9x, the server needs to send data to the broadcast address: 255.255.255.255. Unfortunately, Linux insists on changing 255.255.255.255 into the local subnet broadcast address. The mixed message results in a DHCP protocol violation, and while Linux DHCP clients don't notice the problem, Microsoft DHCP clients do. Normally, such clients can't see DHCPOFFER messages and therefore don't know when to take an IP address offered from the DHCP server. If you're configuring a DHCP server for a network with Microsoft Windows computers, run the following command:

# route add --host 255.255.255.255 dev eth0

where eth0 is the name of the NIC that connects the server to the network.

Client Configuration

You can set up DHCP as a client using the dhclient command, or you can use the Red Hat Network Configuration tool (which you can also start with the Main Menu | System Settings | Network command). Alternatively, configuring a DHCP client at the command line is not difficult (and I believe is faster on the Red Hat exams). Make sure that the /etc/sysconfig/network configuration file includes the following line:

NETWORKING=yes

Next, make sure that the /etc/sysconfig/network-scripts/ifcfg-eth0 script contains the following lines (if you're using a different network device, modify the appropriate file in /etc/sysconfig/network-scripts directory):

BOOTPROTO='dhcp' ONBOOT='yes' 

The next time you reboot, your network configuration should look for DHCP address information automatically from the DHCP server for your network.

On The Job 

There is a subtle difference in the Linux names for the DHCP client and server. The DHCP server daemon is dhcpd; the DHCP client daemon is dhclient. If you're experienced with older versions of Red Hat Linux, this can get even more confusing, as obsolete DHCP client daemons were named dhcpcd and pump.

Alternatively, you can use the Network Configuration tool from a GUI to configure DHCP. You can also start it from a GUI terminal console with the redhat-config-network command. When the tool opens, select your network card and click Edit. You should see a window similar to what is shown in Figure 9-14.

click to expand
Figure 9-14: Configuring your network card

If you want to use DHCP on this computer, select the 'Automatically obtain IP address settings with' option. You'll then get to choose between getting IP address information from a DHCP server on your local network, using bootp to get IP address information from a remote network, or going through a dialup connection, such as to an ISP. Once you've activated the changes, restart the network daemon with the service network restart command. Your network card will then look for IP address information from a DHCP server.

DHCP Client Troubleshooting

If the DHCP client configuration instructions in this chapter are not working, there may be a problem with the way the network is set up on your Linux computer. For example:

  • The NIC is not configured properly. See Chapter 4 for information on reconfiguring your network card.

  • If the computer is still having problems finding a DHCP server, check your firewall. If port 67 or 68 is blocked, your computer won't be able to get a message to the server.

    On The Job 

    The gateway daemon, starting with Red Hat 8.0, is zebra, which is now part of the quagga RPM. The gated and zebra RPM packages are now obsolete.

Exercise 9-4: DHCP

start example

To run this exercise, you'll need two different computers: a DHCP server and a DHCP client on the same LAN.

  1. Open /etc/dhcpd.conf. Configure the server with an IP address range of 192.168.11.11-192.168.11.15 and with a network mask of 255.255.255.0. (If you want to use a different private IPv4 address subnet, substitute accordingly.)

  2. Configure the client computer to use DHCP. Restart the network service on the client and record the IP address that it gets.

  3. Add gateway and DNS server options with IP addresses of 192.168.11.254 and 12.34.45.56, respectively. If you already have a gateway and a DNS server, substitute the appropriate IP addresses. Restart the DHCP service. Restart networking on the client to make it renew the lease on the IP address.

end example



 < Day Day Up > 



RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
ISBN: 71765654
EAN: N/A
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net