DHCP (Dynamic Host Configuration Protocol) is the protocol used by network devices (such as PCs, network printers, etc) to automatically obtain correct network parameters so they can access network and Internet resources such as IP Address, Default Gateway, Domain Name, DNS Servers and more. A DHCP Server is considered necessary in today’s networks. Devices usually found providing this service are Windows servers, routers and layer 3 switches.
It describes how to configure basic DHCP parameters on a Cisco router, enabling it to act as a DHCP server for your network.
The router will act as a DHCP server for the 192.168.1.0/24 network. IP Addresses already assigned to our switch (192.168.1.2) and File Server (192.168.1.5) will be excluded from the DHCP pool, to ensure they are not given out to other hosts and cause an IP address conflict.
First step is to create the DHCP pool that defines the network of IP addresses that will be given out to the clients. ‘Admin’ is the name of the DHCP IP Pool we are creating:
Delhi(config)#Â ip dhcp pool admin
Delhi(dhcp-config)#Â network 192.168.1.0 255.255.255.0
This tells the router to issue IP addresses for the network 192.168.1.0, which translates to the range 192.168.1.1 – 192.168.1.254. We will have to exclude the IP addresses we want later on.
We now define the DHCP parameters that will be given to each client. These include the default gateway (default-router), dns-servers and lease period (days):
Delhi(dhcp-config)#Â default-router 192.168.1.1
Delhi(dhcp-config)#Â dns-server 192.168.1.10
Delhi(dhcp-config)#Â lease 9
LeaseÂ parameters are not mandatory. In above configuration lease address validity is 9 Days. By default, theÂ lease timeÂ for an IP address is one day, however we can specify any time range we need. For example, if we need to set the lease time forÂ 0 Days, 12 hoursÂ andÂ 0 minutesÂ we would use the following command under our DHCP pool:
Delhi(dhcp-config)#Â lease 0 12 0
The above command is interpreted as follows:Â 0Â (Zero) days,Â 12Â hours andÂ 0Â minutes. The above configuration is all you need to get the DHCP server running for your network.
CISCO provides Â few more commands you can use to troubleshoot and ensure it’s working correctly. The following command will allow you to check which clients have been served by the DHCP:
Delhi#Â show ip dhcp bindingÂ
Delhi#Â show ip dhcp pool