addresses were manually administered to IP hosts, which was a tedious, error-prone, and labor-intensive process. DHCP allows IP addresses to be assigned automatically to DHCP clients. The DHCP service can be implemented with a server or with a Cisco IOS device. Figure displays where DHCP would be implemented in an enterprise network.
Content 5.5 DHCP 5.5.2 Understanding the Function of DHCP A Cisco IOS device can be a DHCP server, client, or relay agent. Figure displays the steps that occur when a DHCP client requests an IP address from a DHCP server.
  1. The host sends a DHCPDISCOVER broadcast message to locate a DHCP server.
  2. A DHCP server offers configuration parameters, such as an IP address, a domain name, a DNS server, a default gateway, and a lease for the IP address to the client in a DHCPOFFER unicast message. Also included may be IP telephony DHCP options, such as option 150, which is used for TFTP configuration of IP telephones.
  3. The client returns a formal request for the offered IP address to the DHCP server in a DHCPREQUEST broadcast message.
  4. The DHCP server confirms that the IP address has been allocated to the client by returning a DHCPACK unicast message to the client.
A DHCP client may receive offers from multiple DHCP servers and can accept any one of the offers. However, the client usually accepts the first offer that it receives. Also, the offer from the DHCP server is not a guarantee that the IP address will be allocated to the client. The server usually reserves the address until the client has had a chance to formally accept the address. DHCP supports three possible address allocation mechanisms:
Content 5.5 DHCP 5.5.3 Configuring DHCP Configuring a Cisco IOS DHCP server involves the following tasks: Not all of the optional features are covered in detail. Additional information on these optional features is available on the Cisco website. Figure identifies the major commands to implement a Cisco IOS DHCP server. Figure lists additional commands to customize manual bindings for individual clients, including MAC addresses. Additional options are also available with the implementation of the DHCP relay agent function. Before configuring the Cisco IOS DHCP server feature, you should complete the following tasks: Step 1 Identify an external FTP, TFTP, or Remote Copy Protocol (RCP) server for storing the DHCP binding database. Step 2 Identify the IP address range to be assigned by the DHCP server and the IP addresses to be excluded (default routers and other statically assigned addresses within a dynamically assigned range). Step 3 Identify DHCP options for devices where necessary, including these: Step 4 Decide on a DNS domain name. Cisco IOS devices can also be configured as DHCP clients and DHCP relay agents. Figure displays a sample DHCP configuration. In the example in Figure , two DHCP address pools are created: one for subnet 172.16.1.0 and one for subnet 172.16.2.0. The host receives its address from the DHCP server on the closest device. The router determines how to provide the addresses based on the IP address on the router interface.
Content 5.5 DHCP 5.5.4 DHCP Importing and Autoconfiguration In the past, Cisco IOS DHCP servers had to be configured on each device separately with all parameters and options specified in each case. Cisco IOS software has been revised to allow remote Cisco IOS DHCP servers to be configured to import option parameters from a centralized server. The configurations in Figure provide an example of the partial command syntax for this feature.
Content 5.5 DHCP 5.5.5 Configuring the DHCP Client A Cisco IOS device can be configured to be a DHCP client and obtain an interface address dynamically from a DHCP server with the command ip address dhcp. This command is implemented in interface mode and is specific to an individual interface.
Content 5.5 DHCP 5.5.6 The IP Helper Address A DHCP relay agent is any host that forwards DHCP packets between clients and servers. Relay agents receive DHCP messages and then generate a new DHCP message to send out on another interface. The agents forward requests and replies between clients and servers when they are not on the same physical subnet. The Cisco IOS DHCP relay agent is enabled on an interface only when the ip helper-address is configured. DHCP clients use UDP broadcasts to send their initial DHCPDISCOVER message, because they do not have information about the network to which they are attached. If the client is on a network that does not include a server, UDP broadcasts are normally not forwarded by the attached router. The ip helper-address command causes the UDP broadcast to be changed to a unicast and forwarded out another interface to a unicast IP address specified by the command. The relay agent sets the gateway address (giaddr field of the DHCP packet) and, if configured, adds the relay agent information option (option 82) in the packet and forwards it to the DHCP server. The reply from the server is forwarded back to the client after removing option 82.
Content 5.5 DHCP 5.5.7 Configuring the IP Helper Address Figure illustrates using the ip helper-address command to implement a DHCP relay agent. The command enables forwarding of all well-known UDP ports that may be included in an UDP broadcast message. You can use the ip forward-protocol udp command to customize this feature to network requirements.
Content 5.5 DHCP 5.5.8 Customizing the Forwarded UDP Services The following are UDP well-known ports identified by default forwarding UDP services: You can eliminate ports from the forwarding service with the no ip forward-protocol command, and add ports with the ip forward-protocol command. The sample configuration in Figure no longer forwards the NetBIOS and time ports. However, UDP port 8000 is added to the forwarded list, which includes the remainder of the well-known UDP ports for example, TACACS, DNS, BOOTP client and server, and TFTP).
Content 5.5 DHCP 5.5.9 Configuring DHCP Relay Services When you use the ip dhcp relay information option command, the relay agent adds the