Configure DHCP on CISCO Router
In this tutorial, You will learn how to configure DHCP on Cisco Router. This lab is intended to be a simple tutorial for beginners. No other parameters are configured related to terminal security, line console passwords etc.
Overview
- Setup Simple Topology
- Configure the Router and Enable DHCP
- Testing
Setup Simple Topology
Packet Tracer Topolgy is simple. There will be one Router, single switch and Two end devices connected to the device. As shown in the picture below, Router Interface gig0/0 is configured as 192.168.1.1/24 which will be the default gateway or default router for the end devices.
Configure the Router and Enable DHCP
Router>en //Entering into Global Configuration Mode Router#conf t Enter configuration commands, one per line. End with CNTL/Z. //setting up hostname Router(config)#hostname Router1 //Configuring DHCP Pool and associate options Router1(config)#ip dhcp pool localSubnets Router1(dhcp-config)#network 192.168.1.0 255.255.255.0 Router1(dhcp-config)#default-router 192.168.1.1 Router1(dhcp-config)#exit //Excluding the default gateway IP Address (192.168.1.1) to be leased to the clients Router1(config)#ip dhcp excl Router1(config)#ip dhcp excluded-address 192.168.1.1 //Checking the Pool Settings Router1(config)#do show ip dhcp pool Pool localSubnets : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 254 Leased addresses : 0 Excluded addresses : 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 //Configuring gig0/0 interface to be used as default gateway Router1(config)#int gig0/0 Router1(config-if)#ip address 192.168.1.1 255.255.255.0 Router1(config-if)#no shut Router1(config-if)# %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
Router1#show ip int br Interface IP-Address OK? Method Status Protocol GigabitEthernet0/0 192.168.1.1 YES manual up up
Testing
If everything is configured properly, at this time, our clients should be able to locate the DHCP Server and request an IP Address to be assigned. The concept of DHCP IP Address allocation is out of scope of this article, however, as you can see in the screenshots below that initially PC2 did not have any IP Address assigned.Afer Changing the IP Allocation method to DHCP. PC2 requested the DHCP Server (Router in this case) and router responded (after going through dhcp allocation leasing process) by offering the first usable (unused) IP Address along with other parameters such as Default gateway and subnet mask. The PC did not get the dns settings because, we never configured dns settings in the DHCP Pool.
Router should also show these assigned addresses binded to clients.
Router1#show ip dhcp binding IP address Client-ID/ Lease expiration Type Hardware address 192.168.1.2 00E0.F98A.BD53 -- Automatic 192.168.1.3 0090.0CD8.14E0 -- Automatic
From the output above, you can also see that even the router could have assigned the first usuable IP Address (192.168.1.1) from the pool 192.168.1.0/255, however it leased 192.168.1.2 instead. Reason behind it is that we instructed the router to exclude 192.168.1.1 ip address while fulfilling our dear client's requests.
Packet Tracer lab on Configure DHCP on CISCO Router can be downloaded from here.