Setting up a DHCP Server on a Cisco Router
Nerd Cafe
Scenario:
You are configuring a Cisco router as a DHCP server to dynamically assign IP addresses to client devices on a local network.
1. Understanding DHCP
DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses, subnet masks, default gateways, and other parameters to network devices. A Cisco router can function as a DHCP server, providing these settings to clients.
2. Practical Scenario
You are setting up a small office network.
The router will act as a DHCP server.
The local network uses the 192.168.1.0/24 subnet.
The router's interface (FastEthernet0/0) will be the gateway 192.168.1.1.
The DHCP server should assign addresses from 192.168.1.100 to 192.168.1.200.
Some devices (like a printer) will need static IP reservations.
3. Network Topology

4. Configuration Steps
Step 1: Enter Global Configuration Mode
Connect to the router via CLI (Console, SSH, or Telnet), then enter global configuration mode:
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#
Step 2: Exclude Reserved IP Addresses
Reserve specific IP addresses that should not be assigned by DHCP (e.g., for the router, printers, and servers):
R1(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10
192.168.1.1 is the router’s IP.
192.168.1.2 – 192.168.1.10 are reserved for static devices.
Step 3: Create a DHCP Pool
Define a DHCP pool named OFFICE_NETWORK:
R1(config)#ip dhcp pool OFFICE_NETWORK
R1(dhcp-config)#
Step 4: Define the Network and Subnet Mask
Specify the subnet for DHCP clients:
R1(dhcp-config)#network 192.168.1.0 255.255.255.0
Step 5: Set Default Gateway
Assign the router’s IP as the default gateway:
R1(dhcp-config)#default-router 192.168.1.1
Step 6: Define the DNS Server
Specify a DNS server (e.g., Google’s 8.8.8.8):
R1(dhcp-config)#dns-server 8.8.8.8
Step 7: Configure the Lease Time
Set a lease duration (e.g., 24 hours):
R1(dhcp-config)#lease 1 0 0
1 0 0
means 1 day, 0 hours, 0 minutes.
Step 8: Exit the DHCP Configuration
R1(dhcp-config)#exit
R1(config)#
Step9: Assign IP address to fastEthernet 0/0 (Connected to PC1)
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
Step 9: PC1 Configuration
PC1> ip dhcp
DORA IP 192.168.1.11/24 GW 192.168.1.1
PC1> show ip
NAME : PC1[1]
IP/MASK : 192.168.1.11/24
GATEWAY : 192.168.1.1
DNS : 8.8.8.8
DHCP SERVER : 192.168.1.1
DHCP LEASE : 86395, 86400/43200/75600
MAC : 00:50:79:66:68:00
LPORT : 20008
RHOST:PORT : 127.0.0.1:20009
MTU : 1500
PC1>
Step 10: Printer (Static IP)
Manually set IP: 192.168.1.2, Gateway: 192.168.1.1.
Ensure it doesn’t request DHCP.
PC2> ip 192.168.1.2/24 192.168.1.1
Checking for duplicate address...
PC2 : 192.168.1.2 255.255.255.0 gateway 192.168.1.1
PC2> show ip
NAME : PC2[1]
IP/MASK : 192.168.1.2/24
GATEWAY : 192.168.1.1
DNS :
MAC : 00:50:79:66:68:01
LPORT : 20010
RHOST:PORT : 127.0.0.1:20011
MTU : 1500
PC2>
5. Verifying DHCP Configuration
1. Check the DHCP Configuration
R1#show ip dhcp pool
Pool OFFICE_NETWORK :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 0
Pending event : none
1 subnet is currently in the pool :
Current index IP address range Leased addresses
192.168.1.1 192.168.1.1 - 192.168.1.254 0
R1#
This shows the active DHCP pool and available IP addresses.
2. View DHCP Bindings (Leased IPs)
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.11 0100.5079.6668.00 Mar 23 2025 05:54 AM Automatic
R1#
This displays assigned IP addresses and MAC addresses.
7. Troubleshooting Commands
Check if the DHCP service is running:
R1#show running-config | inclu
R1#show running-config | include dhcp
ip dhcp excluded-address 192.168.1.1 192.168.1.10
ip dhcp pool OFFICE_NETWORK
R1#
Debug DHCP process:
R1#debug ip dhcp server events
DHCP server event debugging is on
Keywords
DHCP
, Cisco Router
, IP Address
, Subnet Mask
, Default Gateway
, DNS Server
, Lease Time
, Excluded Address
, DHCP Pool
, Network Configuration
, IP Binding
, DHCP Reservation
, Dynamic IP
, Static IP
, Show Commands
, Debugging
, Packet Tracer
, Network Automation
, Router Configuration
, CCNA
, سیسکو
Last updated