In this lesson, I will show you how to configure DHCP service on Cisco Router. In our production network, we need to use the DHCP server to distribute IP addresses, subnet mark, gateway, DNS to our internal devices.

Let's see our network scenario that we are going to work on:


We have R1 which is going to be the DHCP server, and another Cisco Router acting as a DHCP client in which he will receive the DHCP information from R1.

Both Routers have a blank configuration. The 1st thing I need to do is to put an IP address on the interface F0/0 because this interface is going to be the gateway of the DHCP client.

R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
*Mar  1 00:01:15.787: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:01:16.787: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#

As you can see, the interface F0/0 is now up.

Now we need to configure the DHCP pool from which the IP addresses will be assigned to the DHCP clients. Note that the pool IP range should be from the same subnet of the IP that we have sent on Fastethernet 0/0

R1(config)#ip dhcp pool MyNetworkTraining
R1(dhcp-config)#network 192.168.1.0 255.255.255.0

Excellent!!!! Now this can do the work. But you know, you also require to provide for the DHCP client the Gateway and the DNS server in case for example you need that your DHCP clients to go to the internet for example. Then you need to address the following for the Pool that you have created

R1(config)#ip dhcp pool MyNetworkTraining
R1(dhcp-config)#default-router 192.168.1.1
R1(dhcp-config)#dns-server 192.168.1.1

So now every DHCP client requesting from the DHCP server, he will get an IP from the network of 192.168.1.0 with a subnet mask of 255.255.255.0 and a gateway of 192.168.1.1 as well as a DNS server 192.168.1.1. That's great.

Maybe a good idea also to exclude from the range of the IP's of the DHCP server the IP's that you may need to use it for your servers because you need to be assigned manually. So let's exclude the following IP: 192.168.1.2

R1(config)#ip dhcp excluded-address 192.168.1.2

That means now that the 1st IP that will be assigned the the DHCP client should be 192.168.1.3

The configuration is completely done on the DHCP server side (R1). Let's connect to the DHCP client Router and request to get an IP address automatically from the DHCP server.


DHCP_Client#show ip interface brief 
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES manual administratively down down    
Serial0/0                  unassigned      YES unset  administratively down down    
FastEthernet0/1            unassigned      YES unset  administratively down down    
Serial0/1                  unassigned      YES unset  administratively down down    
FastEthernet1/0            unassigned      YES unset  administratively down down    
Serial2/0                  unassigned      YES unset  administratively down down    
Serial2/1                  unassigned      YES unset  administratively down down    
Serial2/2                  unassigned      YES unset  administratively down down    
Serial2/3                  unassigned      YES unset  administratively down down    
DHCP_Client#

As you can see, the Fastethernet0/0 interface of the DHCP Client is down with no IP address. Let's enable the DHCP client process on the interface and bring it up

DHCP_Client#configure terminal
DHCP_Client(config)#interface f0/0
DHCP_Client(config-if)#no shutdown
*Mar  1 00:20:39.507: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:20:40.507: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
DHCP_Client(config-if)#ip address dhcp
DHCP_Client(config-if)#
*Mar  1 00:20:52.151: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.1.3, mask 255.255.255.0, hostname DHCP_Client

I have put the interface ip by using "no shutdown" and I have enabled the DHCP client on it by using "ip address dhcp". As you can see, the message is saying that it has received an IP of 192.168.1.3 - Excellent!!!! That means that the configuration that I have done on the DHCP Server is working perfectly.

 DHCP_Client#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.3     YES DHCP   up                    up      
Serial0/0                  unassigned      YES unset  administratively down down    
FastEthernet0/1            unassigned      YES unset  administratively down down    
Serial0/1                  unassigned      YES unset  administratively down down    
FastEthernet1/0            unassigned      YES unset  administratively down down    
Serial2/0                  unassigned      YES unset  administratively down down    
Serial2/1                  unassigned      YES unset  administratively down down    
Serial2/2                  unassigned      YES unset  administratively down down    
Serial2/3                  unassigned      YES unset  administratively down down

We see that the interface F0/0 has received the IP from the DHCP server and it is up/up

DHCP_Client#show ip dns view
DNS View default parameters:
Logging is off
DNS Resolver settings:
  Domain lookup is disabled
  Default domain name: 
  Domain search list:
  Lookup timeout: 3 seconds
  Lookup retries: 2
  Domain name-servers:
    192.168.1.1
DNS Server settings:
  Forwarding of queries is disabled
  Forwarder addresses:

If we check also the DNS, will see that it has also receive the DNS address of 192.168.1.1.

Conclusion:
Configuring DHCP on Cisco IOS is something that you may need to do it a lot. With the following steps you see that it is very easy to configure it and it works perfectly.

I hope that you liked my lesson, and if you have any question(s) or suggestion(s) please write it down in the comments below (you need to have an account to write a comment, you can create one for free on my website)