Networkhunt.com

Configure DHCP Server on Cisco IOS router

configure dns server on cisco ios router

DHCP (Dynamic Host Configuration Protocol) provides dynamic addressing information to hosts on a network such as  IP addresses, subnet masks, default gateways, DNS servers, etc. Typically, physical DHCP servers (such as Microsoft Windows servers) are used to provide addressing information to DHCP clients (which are devices that request configuration via DHCP). However, Cisco IOS routers can also be configured to act as DHCP servers and provide dynamic addressing to DHCP clients.

A DHCP server is configured with a pool of available IP addresses and assigns one of them to the DHCP client.

Below is the step-by-step process to configure the DHCP server on the Cisco IOS router.

  1. Enable DHCP service on Cisco Router
  2. Create a new DHCP pool with the ip dhcp pool NAME command.
  3. Provide a Network that will be used to assign IP addresses to hosts.
  4. Provide the default gateway which will be used to assign to DHCP client.
  5. Define the DNS server.
  6. (Optional) Define the DNS domain name.
  7. (Optional) Define the lease duration by using the lease DAYS HOURS MINUTES command. If you don’t specify this argument, the default lease time of 24 hours will be used.

We will use the below information to configure the DHCP server in the Cisco IOS router

● DHCP network: 192.168.1.0/24
● DNS server: 10.1.1.254
● WINS server: 10.2.2.254
● Default gateway: 192.168.1.1
● DNS domain: networkhunt.com
● DHCP lease time: 5 days 30 minutes

1 Enable DHCP Service on Cisco router, which is by deafault is enabled.

R1# configure terminal
R1(config)# service dhcp

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

R1(config)# ip dhcp pool DHCP-POOL

3. Provide a Network that will be used to assign IP addresses to hosts with the network SUBNET SUBNET_MASK command.

R1(dhcp-config)# network 192.168.1.0 255.255.255.0

The above network configuration 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.

In the next configuration, we will define the DHCP parameters that will be given to each client. These include the default gateway (default-router), DNS servers, domain, and lease period (days):

4. Provide the default gateway with the default-router IP command.

R1(dhcp-config)# default-router 192.168.1.1

5. Define the DNS server with the dns-server IP address command.

R1(dhcp-config)# dns-server 10.1.1.254

6. (Optional) Define the DNS domain name by using the ip domain-name NAME command.

R1(dhcp-config)# domain-name Networkhunt.com

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

R1(dhcp-config)# lease 5 0 30
R1(dhcp-config)# exit
R1(config)#

8. Ensure that you exclude the IP address of the router interface from the DHCP pool. You can use this command to exclude any IP’s from the network. Eg. You can use this command If you have assigned static IP address to your workstation or server and you want to exclude those IP’s from the network to avoid duplicate IP addresses.

R1(config)# ip dhcp excluded-address 192.168.1.1
R1(config)# ip dhcp excluded-address 192.168.1.5 192.168.1.10

9. Run show ip dhcp pool DHCP-POOL command to view the DHCP configuration in Cisco router.

R1#show ip dhcp pool DHCP-POOL
Pool DHCP-POOL :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 0
Excluded addresses : 1
Pending event : none
1 subnet is currently in the pool
Current index IP address range Leased/Excluded/Total
192.168.1.1 192.168.1.1 – 192.168.1.254 0 / 1 / 254

The above configuration is all you need to get the DHCP server running for your network. We’ll provide a 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:

R1# show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type
Hardware address/
User name
192.168.1.6 0100.1e7a.c409 Jan 19 2009 03:06 PM Automatic
192.168.1.7 0100.1e7a.c3c1 Jan 19 2009 09:00 PM Automatic
192.168.1.8 0100.1ebe.923b Jan 19 2009 02:25 PM Automatic
192.168.1.9 0100.1b53.5ccc Jan 19 2009 02:03 PM Automatic
192.168.1.11 0100.1e7a.261d Jan 19 2009 07:52 PM Automatic
R1#

Below is the end-to-end configuration for DHCP Server on the Cisco IOS router.

R1#config t
Enter configuration commands, one per line. End with CTRL/Z.
R1(config)#ip dhcp pool DHCP-POOL
R1(dhcp-config)#network 192.168.1.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.1.1
R1(dhcp-config)#dns-server 10.1.1.254
R1(dhcp-config)#domain-name networkhunt.com
R1(dhcp-config)#lease 5 0 30
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.1.1
R1(config)# exit
R1#show ip dhcp pool DHCP-POOL
Pool DHCP-POOL :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 0
Excluded addresses : 1
Pending event : none
1 subnet is currently in the pool
Current index IP address range Leased/Excluded/Total
192.168.1.1 192.168.1.1 – 172.16.1.254 0 / 1 / 254

Exit mobile version