How-TO: Configure DHCP on a CISCO router

This post is about configuring a CISCO router to act as a DHCP server in your network.

Task1: Configure R1 to act as a DHCP server and provide all network information to hosts in the LAN dynamically. (R1 and R2 are directly connected via Ethernet)

Server Configuration (R1)

!-- enable dhcp server (default)

service dhcp

! -- defining DHCP pool with all network information

ip dhcp pool OFFICE
network 192.168.12.0 255.255.255.0
domain-name networkers-online.com
default-router 192.168.12.1 !-- gateway address
dns-server 192.168.12.100 192.168.12.101 !-- DNS servers
netbios-name-server 192.168.12.99 !-- WINS servers
lease 2 !-- lease time

!-- defining static binding to R2 using its client-id

ip dhcp pool STATIC
host 192.168.12.2 255.255.255.0
client-identifier 01cc.010d.f000.00

!-- exclude server and static addresses from the dynamic pool

ip dhcp excluded-address 192.168.12.1
ip dhcp excluded-address 192.168.12.100 192.168.12.101
ip dhcp excluded-address 192.168.12.200
p dhcp excluded-address 192.168.12.2

Client Configuration:

interface FastEthernet0/0
ip address dhcp client-id FastEthernet0/0

Troubleshooting and verfication:

IP address is assigned dynamically to R2

!-- R2 f0/0 address is assigned via DHCP

R2(config-if)#do sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.12.2 YES DHCP up up

!-- R1 bindings has R2 as a static entry

R1#sh ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type
Hardware address/
User name
192.168.12.2 01cc.010d.f000.00 Infinite Manual

R2 gets its domain-name dynamically from R1

R2#sh ip domain
networkers-online.com

R2 sets R1 as a default gateway using a floating static route

R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static routeGateway of last resort is 192.168.12.1 to network 0.0.0.0

C 192.168.12.0/24 is directly connected, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
S* 0.0.0.0/0 [254/0] via 192.168.12.1

R2 learns Primary and secondary DNS servers from R1

R2#ping xyz.comTranslating "yahoo.com"...domain server (192.168.12.100) (192.168.12.101)
% Unrecognized host or address, or protocol not running.

for more information on how to configure DHCP features consult the following link CISCO IOS DHCP Server

Check Also

Best AI tools list