Dynamically Allocating Client IP Addresses via DHCP on Cisco router
You want to configure your Cisco router to be a DHCP server and allocate dynamic IP addresses to client devices
Use the following configuration commands:
Router1#configure terminal
Router1(config)#ip dhcp pool
Router1(dhcp-config)#network 192.168.1.0 255.255.255.0
Router1(dhcp-config)#default-router 192.168.1.1
Router1(dhcp-config)#exit
Router1#
In the above example, we have configured the router to dynamically allocate IP addresses for the subnet 192.168.1.0/24
The first thing we did was to define a range of IP addresses using the network command.
Excluding addresses
To exclude some addresses, so the router doesn’t assign addresses from the entire subnet (254), in most cases, reserved for other purposes, we include the ip dhcp exclude-address command.
Router1#configure terminal
Router1(config)#ip dhcp pool 192.168.1.0/24
Router1(dhcp-config)#network 192.168.1.0 255.255.255.0
Router1(dhcp-config)#default-router 192.168.1.1
Router1(dhcp-config)#exit
Router1(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.50
Router1(config)#ip dhcp excluded-address 192.168.1.200 192.168.1.255
Router1(config)#end
Router1#