Free tech learning for everyone, from basics to pro

Networking LabsLabsIntermediate

Lab: DHCP server, pools and relay on Cisco routers

In short: Dynamic Host Configuration Protocol (DHCP) hands out IP settings automatically. In this lab one router serves two subnets: its own LAN directly, and a remote LAN through a relay agent, and you check the leases from both sides.

Aim and what you need

The aim is to configure central DHCP for two subnets and understand why a relay is needed when the server is on a different network. DHCP discover messages are broadcasts, and routers do not forward broadcasts, so a router near the clients must pass them on.

  • Packet Tracer or your own lab: two routers (R1 and R2), two switches, and at least one PC per LAN.
  • Addressing: R1 LAN 192.168.10.0/24 (R1 .1), R1 to R2 link 10.0.12.0/30, R2 LAN 192.168.20.0/24 (R2 .1).
  • Routing between the two routers, either static routes or OSPF from the earlier labs.

Design

DHCP across a relayClientDHCPDISCOVERR2 relayhelper-addressR1 serverpicks poolR2 relayforwards offerClientgets lease
Figure 1. The relay turns the client broadcast into a unicast to the server, which picks a pool from the relay address.
DORA exchangeDiscoverclient broadcastOfferserver proposesRequestclient acceptsAcklease confirmed
Figure 2. The four DHCP messages: discover, offer, request and acknowledge, repeated at renewal time.

When R2 relays a request, it writes the address of its client-facing interface (192.168.20.1) into the packet. R1 uses that address to choose the pool for 192.168.20.0/24. That is why the server needs a route back to the relay's LAN.

Steps

  1. On R1, exclude the addresses you reserve for routers, servers and printers before creating pools.
  2. Create one pool per subnet with the network, default gateway, DNS server and domain name.
  3. On R2, add the helper address on the interface that faces the clients.
  4. Set the PCs to DHCP and renew.
! R1: DHCP server
ip dhcp excluded-address 192.168.10.1 192.168.10.20
ip dhcp excluded-address 192.168.20.1 192.168.20.20
ip dhcp pool LAN10
 network 192.168.10.0 255.255.255.0
 default-router 192.168.10.1
 dns-server 192.168.10.5
 domain-name lab.example.com
 lease 1
ip dhcp pool LAN20
 network 192.168.20.0 255.255.255.0
 default-router 192.168.20.1
 dns-server 192.168.10.5
 domain-name lab.example.com
! R2: relay on the client-facing interface
interface g0/0
 ip helper-address 10.0.12.1

Tip: Packet Tracer accepts most of these options but may ignore lease. On real IOS the lease is in days, so lease 1 means one day.

On a PC, use IP Configuration and select DHCP, or use the command prompt. On a Linux client in a real lab, use NetworkManager or dhclient.

ipconfig /release
ipconfig /renew
ipconfig /all

Verify

Success means each PC receives an address from the correct pool, starting at .21, with the right gateway and DNS server. On R1, the bindings table lists each client's MAC address and lease, and pool statistics show leased addresses for both pools.

show ip dhcp binding
show ip dhcp pool
show ip dhcp server statistics
show ip dhcp conflict
show running-config interface g0/0

Troubleshooting and clean-up

  • Client gets 169.254.x.x: this is an automatic private (APIPA) address, meaning no DHCP server answered. Check the helper address and routing.
  • Helper on the wrong interface: it must be on the interface where client broadcasts arrive, not on the link towards the server.
  • Remote clients get nothing but local clients work: R1 has no route to 192.168.20.0/24, so its replies to the relay are lost.
  • Address conflicts: a static device inside the pool range. Exclude it and clear the conflict with clear ip dhcp conflict *.

To clean up, remove the pools with no ip dhcp pool LAN10 and no ip dhcp pool LAN20, and clear old leases with clear ip dhcp binding *. In production, also enable DHCP snooping on access switches so that a rogue DHCP server on a user port cannot hand out a fake gateway.

Practice

Why must ip dhcp excluded-address be planned before clients connect?
Otherwise the router may lease addresses already used by gateways, servers or printers, causing conflicts.
How does the server know which pool to use for a relayed request?
From the relay agent address (giaddr) in the packet, which is the IP of the relay interface facing the clients.
A PC shows 169.254.10.20. What happened?
It did not receive a DHCP offer and assigned itself an APIPA link-local address.

Key takeaways

  • DHCP uses a four-message exchange: discover, offer, request, acknowledge.
  • Exclude reserved addresses before creating pools.
  • Routers block broadcasts, so remote subnets need ip helper-address on the client-facing interface.
  • The server needs a route back to the relay subnet.
  • Verify with show ip dhcp binding and pool statistics.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.