How to Configure DHCP on a New or Used Cisco Router
Did you ever want to learn how to manually configure a new or used Cisco router to serve as a DHCP server? This tutorial will walk you through step by step.
- First, define the DHCP address pool:
Router(config)#ip dhcp pool POOLNAME
Router(dhcp-config)#network XXX.XXX.XXX.XXX YYY.YYY.YYY.YYY
where, XXX.XXX.XXX.XXX is the network address to be used by the DHCP pool YYY.YYY.YYY.YYY is the subnet mask for the network.
You can replace the subnet mask by a (/PREFIX) to provide the subnet mask.
- Configure the correct parameters to be sent to the client:
For the DNS server IP address:
For the IP address of the default gateway:
For the name of the domain of the network (if in a domain environment):
For the IP address of the NetBIOS name server:
Router(dhcp-config)#lease DAYS HOURS MINUTES
This is to define the lease time of the addresses given to the client. To make it infinite, instead use this command:
There are a large group of settings that you can configure to be sent to the clients, and I have only mentioned the most frequently used.
- Configure the IP addresses to be excluded from the IP Address pool. This is generally done in order to avoid conflicts caused by the DHCP with servers and printers. Remember to provide all servers and network printers with static IP addresses in the same range of the DHCP pool. And then exclude these addresses from the pool to avoid conflicts.
Router(config)#ip dhcp excluded-address XXX.XXX.XXX.XXX
Use the command above to excluded a single address. You can repeat it as much as you see fit for the IP addresses you want to exclude. Alternatively:
Router(config)#ip dhcp excluded-address YYY.YYY.YYY.YYY ZZZ.ZZZ.ZZZ.ZZZ
YYY.YYY.YYY.YYY is the start of the range to be excluded from the pool
ZZZ.ZZZ.ZZZ.ZZZ is the end of the range
This way you can exclude a range or ranges of IP addresses and reserve them for static addresses use.
- Enable the DHCP service in the router:
To disable it, type:
Router(config)#no service dhcp
Usually the DHCP service is enabled by default on your router.
- Use the following commands to check the DHCP operation on the router:
Router#show ip dhcp binding
This command shows the current bindings of addresses given to clients:
Router#show ip dhcp server statistics
This command show the DHCP server statistics:
Router#debug ip dhcp server
This debug command is used to troubleshoot DHCP issues.
- If you have a DHCP server besides the router, and want the router to forward DHCP requests from a certain LAN (local area network) to the DHCP server lying outside that LAN, go to the Ethernet interface that does not have the DHCP server and type the following command:
Router(config-if)#ip helper-address XXX.XXX.XXX.XXX
where XXX.XXX.XXX.XXX is the IP address of the server laying outside this LAN.
- You can create a DHCP database agent that stores the DHCP binding database. A DHCP database agent can be any host. For example, an FTP, TFTP, or RCP server that stores the DHCP bindings database counts. You can configure multiple DHCP database agents and you can configure the interval between database updates and transfers for each agent. To configure a database agent and database agent parameters, use the following command in global configuration mode:
Router(config)#ip dhcp database url [timeout seconds | write-delay seconds]
Here is an example url:
ftp://user:password @ 192.168.0.18/router-dhcp (remove the spaces before implementing)
If you choose not to configure a DHCP database agent, disable the recording of DHCP address conflicts on the DHCP server. To disable DHCP address conflict logging, use the following command in global configuration mode:
Router(config)#no ip dhcp conflict logging
- The DHCP service utilizes port 67 and 68. Remember to open these ports in the event that you are using a firewall to block specific ports.
- To clear DHCP server variables, use the following commands as needed:
Router#clear ip dhcp binding *
If you want to clear a certain binding not all of them, replace the * in the previous command with the IP address to be cleared.
Network I.T. Automates DHCP Configuration on Used Cisco Routers
Network I.T. provides routers with dummy-proof GUIs (Graphical User Interfaces). Network I.T. also provides high-quality switches. Network I.T. specializes in:
- Used Cisco POE Switches
- Used Cisco Gigabit Switches
Network I.T. buys and sells refurbished and used Cisco routers and switches in Toronto, the GTA and throughout Canada. Contact Network I.T. today for our best pricing.