Configure DHCP server on a Cisco router

Dynamic Host Configuration Protocol (DHCP) is an application layer protocol used to distribute network configuration parameters, such as IP addresses, subnet masks, default gateways, etc. to devices on a TCP/IP network. DHCP employs a client-server architecture; a DHCP client is configured to request network parameters from a DHCP server. A DHCP server is configured with a pool of available IP addresses and assigns one of them to the DHCP client.

A Cisco router can be configured as a DHCP server. Here is how you can do that:

1. Exclude addresses from being assigned by DHCP by using the ip dhcp excluded-address FIRST_IP LAST_IP

2. Create a new DHCP pool by using the ip dhcp pool NAME command.

3. Define a subnet that will be used to assign IP addresses to hosts by using the network SUBNET SUBNET_MASK command.

4. Define the default gateway by using the default-router IP command.

5. Define the DNS server by using the dns-server IP address command.

6. (Optional, not available on all routers) Define the DNS domain name by using the ip domain-name NAME command.

7. (Optional) Define the lease duration by using the lease DAYS HOURS MINUTES command. If you don’t specify this parameter, the default lease time of 24 hours will be used.

dhcp configuration

In the example above you can see that we’ve configured the DHCP server with the following parameters:

  • the IP addresses from the 192.168.5.0 – 192.168.5.25 range will not be assigned to hosts
  • the DHCP pool was created and named HQ_DHCP_SERVER
  • the IP addresses assigned to the hosts will be from the 192.168.5.0/24 range
  • the default gateway’s IP address is 192.168.5.1
  • the DNS server’s IP address is 192.168.5.1

To view information about currently leased addresses, you can use the show ip dhcp binding command:

show ip dhcp binding

In the picture above you can see that we have one DHCP client with the IP address of 192.168.5.26.

Subscribe to our Newsletter

Like us on Facebook

top
Geek University 2019