Dynamically Allocating Client IP Addresses via DHCP
Problem
You want to configure your router to be a DHCP server and allocate dynamic IP addresses to client workstations.
Solution
The following set of configuration commands allows the router to dynamically allocate IP addresses to client workstations:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#service dhcp
Router1(config)#ip dhcp pool
Router1(dhcp-config)#
172.25.1.0/24
network
Router1(dhcp-config)#
172.25.1.0 255.255.255.0
default-router
Router1(dhcp-config)#
172.25.1.1
exit
Router1(config)#ip dhcp excluded-address
Router1(config)#
172.25.1.1 172.25.1.50
ip dhcp excluded-address
Router1(config)#
172.25.1.200 172.25.1.255
end
Router1#
Discussion
Cisco incorporated DHCP server functionality starting in IOS Version 12.0(1)T. This allows routers to dynamically allocate IP addresses to client workstations without needing a centralized DHCP server.
Providing DHCP services from a router has some interesting advantages over using a central server. First, distributing the DHCP functionality into the access routers of a large network reduces the risk of a server configuration problem affecting the entire corporate network. Second, maintaining DHCP services within each remote branch router reduces the utilization over expensive WAN links. Third, when a WAN link fails, workstations are still able to function on the local segment. And fourth, the router based DHCP services can easily be administered ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.