DHCP Servers on Cisco Routers
The first step is enabling the DHCP service on the router. This is done using the service dhcp command, as exemplified below:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#service dhcp
The next step is to create a DHCP pool which defines the IP address pool that will be allocated to clients. In this example, pool name “SUBNET_A” will offer IP addresses from the 192.168.1.0/24 range:
Router(config)#ip dhcp pool SUBNET_A
Router(dhcp-config)#network 192.168.1.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.1.1
Router(dhcp-config)#dns-server 8.8.8.8
Router(dhcp-config)#domain-name Network+
Router(dhcp-config)#lease 30
The DHCP Pool Configuration mode is also the place where you can configure other DHCP options. In the configuration output above, the following parameters were configured:
- Default gateway: 192.168.1.1 (the router interface assigned to the network it serves as a DHCP server)
- DNS server: 8.8.8.8
- Domain name: Network+
- Lease time: 30 days
If needed, you can also configure some excluded addresses from the 192.168.1.0/24 range. Let’s say you want to exclude the router interface IP address (192.168.1.1) and the 192.168.1.250 to 192.168.1.255 address range, from which you would manually assign addresses to servers in your network. This is done using the configuration below:
Router(config)#ip dhcp excluded-address 192.168.1.1
Router(config)#ip dhcp excluded-address 192.168.1.250 192.168.1.255
To verify the clients currently served by the router DHCP server, you can use the commands below:
Router#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type Hardware address/
192.168.1.2 Mar 02 2014 12:07 AM Automatic 0063.6973.636f.2d63
In the output above, a single client was served by the DHCP server and was assigned the first non-excluded IP address from the DHCP scope: 192.168.1.2. You can also see the lease expiration date and the device MAC address.
DHCP Clients on Cisco Routers
In addition to DHCP server functionality, Cisco IOS routers also permit configuring the interfaces as DHCP clients. This means that interfaces will require an address using the standard DHCP process, and any server present on the specific subnet can allocate the IP addresses.
The commands to configure a router interface as a DHCP client are as follows:
Router(config)#int FastEthernet0/0
Router(config-if)#ip address dhcp
Once a DHCP server allocates an IP address, the following notification (which includes the address and mask) will be visible on the router console:
*Mar 1 00:29:15.779: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 10.10.10.2, mask 255.255.255.0, hostname Router
The DHCP allocation method can be observed with the show ip interface brief command:
Router#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.10.10.2 YES DHCP up up
FastEthernet0/1 unassigned YES unset administratively down down
DHCP Packet Analysis
In order to practically understand the topics presented in this module, some traffic captures on the devices involved in the examples above will be generated. After the DHCP server is configured and the client workstation boots up, the four-step DHCP process occurs, as can be observed in the screenshot below:
Figure 14.4 – DHCP Four-Step Process
The DHCP Discover packet components can be observed below:
Figure 14.5 – DHCP Discover Packet
As you can see in the screenshot, the packet was sent by the client who broadcasted it on the network (destination 255.255.255.255). You can also see the message type “Boot Request (1).”
The next packet is the DHCP Offer packet, presented below:
Figure 14.6 – DHCP Offer Packet
This packet was sent by the server (source IP: 192.168.1.1) to the Broadcast address (destination: 255.255.255.255) and it contains the proposed IP address (192.168.1.2). You can also see the message type “Boot Reply (2).”
The third packet is the DHCP Request:
Figure 14.7 – DHCP Request Packet
The DHCP Request packet is sent by the client to the Broadcast address. You can see the message type “Boot Request (1).” This packet is similar to the initial DHCP Discover packet but contains a very important field, which is Option 50: Requested IP Address (192.168.1.2). This is exactly the same IP address offered by the DHCP server in the DHCP Offer packet, and the client confirms it and accepts it.
The last packet in the DHCP allocation process is the DCHP Ack packet sent by the server:
Figure 14.8 – DHCP Ack Options Packet
This packet is sourced by the DHCP server and broadcasted on the network; it also contains some extra fields as seen in the screenshot above:
- DHCP Server Identifier: the DHCP server IP address (192.168.1.1)
- All of the options configured on the router:
- Lease time: 30 days (and the derived renewal time and rebinding time values discussed earlier)
- Subnet mask: 255.255.255.0
- Default gateway (router): 192.168.1.1
- DNS server: 8.8.8.8
- Domain name: Network+




