A real-life situation
HQ is growing. Today 40 laptops on VLAN 10 need addresses, and typing them in by hand is not an option. Later, a central server (SRV1) at the server site should hand out addresses for every branch. You need R1 to do two jobs on Cisco IOS: first act as the DHCP server itself, then pass requests on to SRV1 as a relay agent. R1's internet link also gets its own address from the ISP by DHCP.
How DHCP works (the DORA exchange, leases, renewal) is covered in DHCP, which ends with a short Cisco lab. This lesson is the full IOS treatment.
What a Cisco router can do with DHCP
| Role | What it means | Key command |
|---|---|---|
| Server | The router keeps pools and leases addresses itself. | ip dhcp pool |
| Relay agent | The router forwards client broadcasts as unicast to a server on another subnet. | ip helper-address |
| Client | A router interface gets its own address from a DHCP server. | ip address dhcp |
- 1. PC1 broadcasts a Discover. It reaches every device in VLAN 10, including R1's Gi0/0. The broadcast stops at R1.
- 2. Option A: R1 is the server. R1 has a pool for 192.168.10.0/24 and answers straight away.
- 3. Option B: R1 relays. With ip helper-address 192.168.20.10 on Gi0/0, R1 turns the broadcast into a unicast to SRV1, with giaddr 192.168.10.1.
- 4. R1 as a DHCP client. On Gi0/2, ip address dhcp lets the ISP give R1 its public address and a default route.
Why it works that way
A new client has no address and no idea where the server is, so it sends to the broadcast address 255.255.255.255. Routers never forward that broadcast to another subnet. So either the server must be on the same subnet as the client, or the router on that subnet must step in. That is all a relay agent is: the gateway catches the broadcast and sends it on, as a normal unicast packet, to a server it knows about.
The server also needs to know which subnet the client is on, to choose the right pool. When the router itself is the server, it uses the subnet of the interface the Discover arrived on. When it relays, it writes that interface's address into the giaddr (gateway IP address) field, and the server matches it against its pools.
How it works step by step (relay)
1. Discover · Broadcast in VLAN 10 · UDP 68 → 67
Any DHCP server?
Tap this step's arrow for the details.
- Address:
- 192.168.10.11/24
- Gateway:
- 192.168.10.1
- DNS:
- 192.168.20.53
How to configure it on Cisco IOS
⚠️ Based on Cisco IOS / IOS XE documentation, not run on a lab device. Interface names vary by platform. The lab assumes routing between all subnets already works.
1. R1 as the DHCP server
ip dhcp excluded-address 192.168.10.1 192.168.10.10
ip dhcp excluded-address 192.168.10.200 192.168.10.254Global configuration, before creating the pool. Addresses kept for the gateway, SW1 (192.168.10.2), printers and other static devices. Exclusions apply to all pools.
ip dhcp pool VLAN10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 192.168.20.53 198.51.100.53
domain-name hq.example.com
lease 1 12Pool configuration mode (the prompt becomes R1(dhcp-config)#). network can also take a prefix length: network 192.168.10.0 /24. lease is days, hours, minutes; the default is 1 day.
| Command | What the client gets |
|---|---|
network | An address and mask from this subnet |
default-router | Its default gateway (option 3) |
dns-server | Up to 8 DNS servers (option 6) |
domain-name | The DNS suffix (option 15) |
lease | How long it may keep the address; lease infinite never expires |
option 150 ip 192.168.20.10 | Optional: the TFTP server Cisco IP phones download their settings from |
Before it offers an address, the router pings it (two pings by default). If something answers, it records a conflict and skips that address. The DHCP service is on by default; if someone disabled it, service dhcp turns it back on.
2. R1 as a relay to SRV1
Now the company moves DHCP to SRV1. Remove the pool from R1 (or the router will keep answering) and add the helper on the interface that faces the clients:
no ip dhcp pool VLAN10
interface GigabitEthernet0/0
ip helper-address 192.168.20.10On R1. The helper goes on the interface that receives the broadcasts. You can list several helper addresses for backup servers.
SRV1 must have a scope (pool) for 192.168.10.0/24 with gateway 192.168.10.1, and a route back to that subnet. If SRV1 were another Cisco router, the pool would look exactly like the one above.
By default ip helper-address also forwards a few other UDP broadcasts, such as TFTP (69), DNS (53), TACACS (49), Time (37) and NetBIOS (137, 138). no ip forward-protocol udp <port> stops one of them.
3. R1 as a DHCP client toward the ISP
interface GigabitEthernet0/2
ip address dhcp
no shutdownThe ISP's DHCP server gives R1 its public address. R1 also installs a default route via the gateway it learns, with administrative distance 254.
Full example (R1, server version)
hostname R1
!
ip dhcp excluded-address 192.168.10.1 192.168.10.10
ip dhcp excluded-address 192.168.10.200 192.168.10.254
!
ip dhcp pool VLAN10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 192.168.20.53 198.51.100.53
domain-name hq.example.com
lease 1 12
!
interface GigabitEthernet0/0
ip address 192.168.10.1 255.255.255.0
no shutdown
!
interface GigabitEthernet0/2
ip address dhcp
no shutdownHow to verify it
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.10.11 0100.5079.6668.01 Oct 08 2026 02:15 AM Automatic 192.168.10.12 0100.1b44.11a3.7c Oct 08 2026 02:31 AM Automatic
R1#show ip dhcp pool Pool VLAN10 : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 254 Leased addresses : 2 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased addresses 192.168.10.13 192.168.10.1 - 192.168.10.254 2
R1#show ip dhcp conflict IP address Detection method Detection time VRF 192.168.10.50 Ping Oct 06 2026 09:12 AM
192.168.10.50 by hand inside the pool. The router won't offer it until you fix the device and run clear ip dhcp conflict *.R1#show ip interface brief | include GigabitEthernet0/2 GigabitEthernet0/2 203.0.113.2 YES DHCP up up
show ip route would show S* 0.0.0.0/0 [254/0] via 203.0.113.1.On the relay, check show running-config interface GigabitEthernet0/0 or show ip interface GigabitEthernet0/0, which lists the helper address. On the server side, the binding table shows whether the request ever arrived.
What goes wrong and how to troubleshoot it
- Clients get a 169.254.x.x address. No server answered. Is the pool there, does its
networkmatch the client subnet, and is the gateway interface up? With a relay, is the helper on the right interface and can the router ping the server? - Clients get an address but can't leave the subnet.
default-routeris missing or wrong in the pool. - The pool runs out. Check
show ip dhcp pool. Exclusions may be too wide, or the lease too long for a busy guest network. - Relayed requests get no answer. The server has no pool for the giaddr subnet, or no route back to it, or an ACL blocks UDP 67.
- Clients get addresses from the wrong server. A rogue DHCP server (often a home router plugged in by a user) is answering first. That is what DHCP snooping stops.
debug ip dhcp server eventsShows the router assigning, renewing and releasing addresses. Use debug ip dhcp server packet for every message.
Common mistakes
- Putting
ip helper-addresson the interface toward the server instead of the one toward the clients. - Forgetting to exclude the gateway and other static addresses, then seeing conflicts.
- Typing
ip dhcp excluded-addressinside the pool. It is a global command. - Leaving a pool on the router after moving to a central server, so two servers answer.
- Writing the mask as a wildcard (
0.0.0.255) on thenetworkline. DHCP pools use a normal subnet mask.
💡 Exam tip: the blueprint asks you to configure and verify DHCP client and relay. Expect to pick the interface where ip helper-address belongs (the client-facing one), to spot a missing default-router, and to read show ip dhcp binding. Know that ip address dhcp makes a router interface a client, and that the client sends from UDP 68 to UDP 67.
Key takeaways
- Server: global
ip dhcp excluded-address, thenip dhcp poolwithnetwork,default-router,dns-server. - Relay:
ip helper-addresson the client-facing interface turns broadcasts into unicasts and sets giaddr. - Client:
ip address dhcp, which also adds a default route with AD 254. - The router pings an address before offering it and logs conflicts.
- Verify with
show ip dhcp binding,show ip dhcp poolandshow ip dhcp conflict.
Check yourself
PC1 in VLAN 10 should get an address from SRV1 at 192.168.20.10. R1's Gi0/0 faces VLAN 10 and Gi0/1 faces R2. Where does ip helper-address 192.168.20.10 go?
Clients get addresses from R1's pool but can't reach anything outside 192.168.10.0/24. Which pool command is most likely missing?
A relayed Discover arrives at SRV1 with giaddr 192.168.10.1. Which pool does SRV1 use?
R1's Gi0/2 has 'ip address dhcp' and gets 203.0.113.2 from the ISP. What else does R1 usually learn?
show ip dhcp conflict lists 192.168.10.50. What does that tell you?