Return to InfoBlast Home

Knowledge: Understanding DHCP


Overview
Transport and ports used
Differences between DHCP and BOOTP
    Mechanisms for assigning IP addresses
    Configuration Options
How does it work?
    Basic
    Session Diagram
    Detailed
Cisco Products That Support DHCP
Configuring an IOS router to forward DHCP (BOOTP)

The Dynamic Host Configuration Protocol (DHCP) is used to enable hosts (DHCP Clients) on an IP network to obtain their configurations from a server (DHCP server). This reduces the work necessary to administer an IP network. The most significant configuration option the client receives from the server is it's IP address. DHCP is not intended for use in configuring routers.

The DHCP protocol is described in RFC 2131 which obsoletes RFC 1541.

DHCP uses UDP as its transport protocol. The client sends messages to the server on port (67). The server sends messages to the client on port (68).

DHCP is an extension of the BOOTP mechanism but this document will not cover details of the interaction between BOOTP and DHCP. For further reading on the subject, read IETF RFC 1542. There are two primary differences, however, between DHCP and BOOTP that are worth mentioning. First, DHCP defines mechanisms through which clients can be assigned an IP address for a finite lease period, allowing for reassignment of the IP address to another client later. Secondly, DHCP provides the mechanism for a client to gather other IP configuration parameters it needs to operate in the TCP/IP network.

There are three mechanisms used to assign an IP address to the client. They are:

We'll be focusing on the dynamic allocation mechanism in this document.

Some of the configuration parameters available are listed in IETF RFC 1533. Among those are:

How the protocol works (basic)

In its simplest form, the client sends a request for a server (optionally, with it's suggested IP address). The server responds with an available IP address. Next, the client sends a request to the selected server for it's configuration options. Finally, the server responds with the client's committed IP address along with other options such as it's netmask. If there is a router in between the client and the server, the router should use a BOOTP forwarding agent (in Cisco IOS, see the ip helper-address command) to get the request from the client to the server and back.

The following diagram describes how a typical DHCP session works:

Diagram 1:

 

How the protocol works (detailed)

In a typical session, the client broadcasts a DHCPDISCOVER message on its local segment. The client may suggest the IP address it wants to use and its lease duration. If the server is on the same segment, it may respond with a DHCPOFFER message that includes the available IP address and other parameters such as the netmask. (If the server is on another segment, a BOOTP relay agent on the router can be used to transport the request to that segment.) Once the client receives this message it responds with a DHCPREQUEST message that includes a 'server identifier' value. This value is how the client tells the server it has accepted it's offer and implicitly tells other servers it has declined their offers. The selected server receives the DHCPREQUEST message and then responds with a DHCPACK message containing the configuration parameters. (If the server has allocated the IP address already, it will send a DHCPNAK, instead.) The client should then perform a check to make sure the IP address is correct by perhaps using ARP on the local segment.

If the client detects that the address is already in use on the local segment it will send a DHCPDECLINE message and the process starts again.

If the client received a DHCPNAK from the server after sending the DHCPREQUEST, then it will restart the process again.

If the client no longer needs its IP address, the client sends a DHCPRELEASE message to the server.

If the client wants to extent its lease time, the client sends a DHCPREQUEST to the server. In this message, the client sets the 'ciaddr' field with its current IP address but doesn't include a 'server identifier' in the message. The server responds with a DHCPACK message which includes the duration of the lease. At this point the client has successfully reacquired its address and new duration of the lease.

 

The following is the State-transition diagram for the DHCP client. This is a representation of the diagram outline in the IETF RFC 2131 (Dynamic Host Configuration Protocol)

Cisco products that support DHCP.

Configuring an IOS router to forward DHCP (BOOTP).

To configure Cisco IOS to be the BOOTP forwarder, the ip helper-address command needs to be configured on the interface that will forward the BOOTP requests. The general rule is to configure the command on the interface closest to the client. The address used in the ip helper-address can be a specific server IP address or it can be the the network address if other DHCP Servers are on the destination network segment. Using the network address allows other servers to be able to respond, also.

The following diagram shows an example network scenario and where ip helper-address is configured:


All contents copyright © 1992--1999 Cisco Systems, Inc. Important Notices and Privacy Statement.