Skip to content
  • There are no suggestions because the search field is empty.

Configuring DHCP

Configuring DHCP on a Cisco router is a very simple process. You can configure the router as a DHCP server for the internal devices in the network, such as computers, smartphones, or servers, while simultaneously functioning as a DHCP client for the internet service provider to get a public IP address needed for communication on the internet. 

Cisco router operating as a DHCP server and DHCP client

Based on the example topology in the image above, we will configure router R1 as a DHCP client for the router in the ISP (DHCP server) and as a DHCP server for the devices in the internal network.

Enter the “ip address dhcp command in interface configuration mode to enable an interface as a DHCP client. Once you enter this command, the interface will acquire IP addresses from the DHCP server. 

Enter the following commands to configure R1 as a DHCP server:

  • ip dhcp pool name: Creates a DHCP server address pool and enters DHCP pool configuration mode.  
  • network IP-network [mask | prefix-length]: Specifies the network from which IP addresses will be assigned and subnet mask or prefix length to define the network part.
  • default-router IP-address: Specifies the default gateway IP address for the DHCP clients.
  • dns-router IP-address: Specifies the DNS server IP address that DHCP clients will use.
  • domain-name domain: Specifies the domain name for the clients.
  • lease days hours: Specifies the lease time for the assigned network parameters.

Based on the topology example in the image above, the following configuration can be used to achieve the desired goal on R1:

Configuring DHCP on a Cisco router

As you can see from the configuration above, the DHCP pool is named Pivit_network and the IP addresses that will be assigned are from network 192.168.1.0/24. The default gateway and the DNS server for the clients is the 192.168.1.1 IP address assigned on G0/0 on R1. 

The domain name is pivit.com and the lease time is 4 hours. At the same time, interface G0/1, configured as a DHCP client, will receive a public IP address from the ISP router operating as a DHCP server.

Because some IP addresses of the defined network in the pool may already be used, such as the IP address used as a default gateway and DNS, they must be excluded from the DHCP assignment process and never assigned to clients. 

The command “ip dhcp excluded-address start ip-address end ip-address allows for excluding a specific range of IP addresses. For example, if you want to exclude the first 20 IP addresses, enter “ip dhcp excluded-address 192.168.1.1 192.168.1.20” in global configuration mode.

Verification Commands

Remember that you can never assume the configuration is correctly applied and properly functioning without adequate verification. To verify that R1 receives an IP address from the ISP router, you can use the “show ip interface brief command like in the example below and confirm that an IP address is assigned and the method is “DHCP.”

Show ip interface brief command and its output

The following commands provide additional verification of the DHCP process:

  • show ip dhcp binding: Displays IP address bindings on the DHCP server.
  • show ip dhcp conflict: Displays IP address conflicts found by the DHCP server for addresses offered to the clients.
  • show dhcp lease: Displays DHCP lease information for interfaces configured with DHCP.
  • show dhcp server: Displays information about which DHCP servers are chosen by the router.