Configure DHCP Server in Cisco Router or Switch
In our previous post, we have learnt about DHCP and DHCP process, In this lesson we will learn about configuring DHCP Server in Cisco Router. So lets begin.
To configure a Cisco router as a DHCP server, follow these steps:
- Enter configuration mode by typing “configure terminal” at the command prompt.
- Create a DHCP pool by typing “ip dhcp pool [name]”, where [name] is the name you want to give to the pool.
- Define the pool’s scope by typing “network [network-number] [mask]”, where [network-number] is the network address and [mask] is the subnet mask.
- Set the default router for the scope by typing “default-router [router-address]”, where [router-address] is the IP address of the default router.
- Set the DNS server for the scope by typing “dns-server [server-address]”, where [server-address] is the IP address of the DNS server.
- Set the lease time for the scope by typing “lease [days] [hours] [minutes]”, where [days] is the number of days, [hours] is the number of hours, and [minutes] is the number of minutes for the lease time.
- Save the configuration by typing “end” and then “write memory”.
Here’s an example of a complete DHCP configuration on a Cisco router:
Router>enable Router#configure terminal Router#ip dhcp excluded-address 10.0.0.1 10.0.0.10 Router(config)#ip dhcp pool mypool Router(dhcp-config)#network 10.0.0.0 255.255.255.0 Router(dhcp-config)#default-router 10.0.0.1 Router(dhcp-config)#dns-server 10.0.0.2 Router(dhcp-config)#lease 3 0 0 Router(dhcp-config)#end Router#write memory
This configuration creates a DHCP pool named “mypool” with a scope of 10.0.0.0/24, a default router of 10.0.0.1, a DNS server of 10.0.0.2, and a lease time of 3 days. it will exclude IP addresses from 1 – 10 from DHCP pool and these IP addresses will not be assigned to any client.