Configure DHCP Server on a Cisco switch or router

Configure Layer3 address on a switch interface that correlates with DHCP address scope.

(config) # interface vlan 5
(config-vlan)# ip address 192.168.5.1 255.255.255.0
(config-vlan)# no shut
(config)#ip dhcp pool users
(config-dhcp)#network 192.168.5.0 255.255.255.0
(config-dhcp)#default-router 192.168.5.1
(config-dhcp)#dns-server 192.168.5.10 192.168.5.11
(config-dhcp)#domain-name itadminguide.com
(config-dhcp)#lease 8
(config-dhcp)#ip dhcp excluded-address 192.168.5.1 192.168.5.100


By default network and broadcast addresses for the subnet won’t be offered to any client, so you do not need to specify in dhcp excluded-address list.

Lease period is mentioned in days here, by default offered with 1 day lease. If you want to specify DHCP 150 TFTP option to let IP phones download the configuration file from call manager, specify this additional command

(dhcp-config)#option 150 ip 192.168.5.44

You need Service DHCP command to enable DHCP server and relay agent on your switch, by default this feature is enabled. Ref Cisco article.

CommandsDescription
#show ip dhcp bindingDisplays address bindings on Cisco IOS DHCP Server
#show ip dhcp conflictDisplays IP address conflicts. By default, Cisco IOS DHCP Server records DHCP address conflicts in a log file.
#clear ip dhcp binding 192.168.5.3Clears the specific DHCP binding
#clear ip dhcp conflick 192.168.5.3Clears the conflicting IP address of the host
#debug ip dhcp serverDisplays detailed information about the client's request