NAD810 DHCP LAB

From CDOT Wiki
Revision as of 12:06, 17 April 2009 by Cheping (talk | contribs) (Completing the Lab)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Install and Configure a DHCP Server

Objectives

To install, configure, and test ISC's DHCP Server

Reference

  • ISC (Internet Software Consortium) DHCP Web Site: [1]
  • man pages for dhcpd, dhcpd.conf, dhcpd.leases, dhcp-options, dhclient, dhclient-conf
  • Rad Hat Enterprise Linux Documentation: Dynamic Host Configuration Protocol

Required material

  • A working Fedora system
  • The dhcp package
  • USB memory key for backing up configuration files (optional)

Prerequisite

  • A LAN with at least 2 nodes (Physical or Virtual)
  • all computers in your LAN are working properly

Pre-Lab Activities

  • Read the RHEL Documentation on how to customize DHCP server
  • Read the man page for dhcpd.conf (/etc/dhcpd.conf)
  • Study the sample DHCP server configuration file

ISC DHCP packages Overview

The version of DHCP server included with Fedora is maintained and distributed by the Internet Software Consortium (http://www.isc.org). The source package that you can download from ISC includes not only the DHCP server, but also a DHCP client and a DHCP relay agent. However, Fedora separates it into two RPM packages: the DHCP client package (dhclient) and the DHCP server package (dhcp). The DHCP client package is normally installed by default.

Lab Activities

Install required packages

1. To check that you have "dhclient" installed, enter the command: rpm -q dhclient

Install the "dhclient" package if it was not installed.

2. The DHCP server rpm package is normally not being installed by default. Follow the normal steps to install the DHCP server rpm package with the package name started with "dhcp".

3. Study the man pages of dhcpd, dhcpd.conf, dhcp-options, and dhcpd.leases. In particular, look up the meaning and possible value(s), if any, for the following configuration options:

   * broadcast-address
   * default-lease-time
   * max-lease-time
   * domain-name
   * domain-name-servers
   * fixed-address
   * group
   * hardware
   * host
   * host-name
   * range
   * routers
   * shared-network
   * subnet
   * subnet-mask
   * interface-mtu

DHCP Server Configuration

4. Create/modify the DHCP server configuration file "/etc/dhcpd.conf" so that your DHCP server is capable of providing the following configuration values for the hosts that are directly connected to your LAN:

   * default-lease-time : 1 hours
   * max-lease-time: 8 hours
   * domain-name: user you learn-id appended with lux.com
   * subnet: 10.0.1.0 
   * subnet-mask: 255.255.255.0
   * broadcast-address: pick the appropriate value
   * range: 
         o use 10.0.1.101 to 10.0.1.199 

5. To test your DHCP server configuration, start the DHCP server daemon "dhcpd" with the following command:

   service dhcpd start

Use the command "ps -ef" to confirm that the DHCP server daemon process exists in the process table and use the command "netstat -aun" to confirm that the DHCP server port (port # 67) is active and listening for incoming requests. NOTE: If there are any typos or formatting errors in your DHCP server configuration file, some diagnostic messages will be written to the system log file (/var/log/messages). Review those messages and try to fix the errors in the dhcp server configuration file (/etc/dhcpd.conf).

6. Open another terminal window (if you are running a GUI in X-Windows) or login to another virtual terminal session as root (if you are running CUI) and issue the following command:

   tail -f /var/log/messages

A few lines should be displayed on the screen (lets called this "H-Screen") and then stop. When new data is being written to the file "/var/log/messages", the new data will be displayed on this "H-Screen". Just leave it there and switch back to the other terminal window (or virtual terminal session) and execute the following command:

   service dhcpd restart

Something should appear on the "H-Screen". Study the information displayed. Keep the "H-Screen" open for viewing further information that will be written to the file "/var/log/messages".

DHCP Cleint Request

7. On any other Linux system (not running DHCP server) on your LAN, modify the network device configuration to use DHCP at boot time and restart the network service on that computer - use the command "service network restart".

Something should appear on your "H-Screen" when your restarted the network service on the other computer. Study and/or record the messages on the "H-Screen".

DHCP server and client lease files

8. If your DHCP server successfully issued the proper TCP/IP network configuration values to the client machine, check the file called "/var/lib/dhcp/dhcpd.leases" on your system and the file called "/var/lib/dhcp/dhclient.leases" (or /var/lib/dhcp/dhclient-eth0.leases ) on the client system. What type of files are they (binary or text)? Do they contain similar information? What information is stored in each file? Record your findings.

9. Execute the following command on your computer to produce your own DHCP Server log:

   grep dhcpd /var/log/messages > /root/dhcpd.log

10. Create a directory called "/root/DHCP" and copy the following files to it:

  • your DHCP server configuration file "/etc/dhcpd.conf"
  • the DHCP server lease file "/var/lib/dhcp/dhcpd.leases"
  • the DHCP client lease file "/var/lib/dhcp/dhclient.leases"

Completing the Lab

1. Modify your DHCP server configuration so that it will assign the following TCP/IP parameters to all the computer in your LAN:

  • fixed IP address
    • you need to know the MAC address of the network device on each computer
    • you need to know the host name to be assigned to each computer
  • default gateway
  • IP(s) of the Domain name server

2. Mail your dhcp server configuration file and the files in the "/root/DHCP" directory to your Instructor by Feb 17, 2009

Review Questions

  1. What does DHCP stand for?
  2. What is the name of the DHCP server configuration file (full path)?
  3. Which file (full path) is used by the DHCP server to store the client lease database?
  4. What are the two types of statements in the DHCP server configuration file?
  5. If you change the DHCP server configuration file, what do you do to make the changes to take effect?
  6. When will you use the parameter "range" in the DHCP server configuration file?
  7. What will you use the parameter "fixed-address" in the DHCP server configuration file?
  8. What statement in a DHCP server configuration file assigns "10.1.1.254" as the default gateway to its DHCP clients?
  9. What is the name (full path) of the sample DHCP server configuration file that is included in the DHCP server rpm package?
  10. What statement in a DHCP server configuration file assigns "142.204.1.2" as the DNS name server to its DHCP clients?
  11. What port is used by DHCP server to listen to client requests?
  12. What port is used by DHCP client to receive DHCP server responses?
  13. What transport protocol is used for DHCP communication?
  14. How can a DHCP client, which does not have an IP address to begin with, communicate with a DHCP server?