Serve DHCP to a local and a remote subnet from one IOS router
Cisco IOSCore
Tasks
- Address the interfaces and give R1 a route back to LAN B and R2 a default route to R1.
- Exclude .1 to .10 in both LANs from DHCP.
- Create one pool per LAN on R1 with gateway, DNS server, domain name and a 2-day lease.
- Make R2 relay DHCP from LAN B to R1.
- Prove that a client on each LAN gets the right address and options, and that LAN B's requests arrive through the relay.
Solution
1Interfaces and routing on R1R1
R1 on Cisco IOS interface GigabitEthernet0/0/0 ip address 10.0.12.1 255.255.255.252 no shutdown interface GigabitEthernet0/0/1 ip address 10.10.0.1 255.255.255.0 no shutdown ip route 10.20.0.0 255.255.255.0 10.0.12.2Without the route to 10.20.0.0/24, R1 builds the OFFER for LAN B and cannot deliver it to the relay address.
2Exclusions and pools on R1R1
R1 on Cisco IOS ip dhcp excluded-address 10.10.0.1 10.10.0.10 ip dhcp excluded-address 10.20.0.1 10.20.0.10 ! ip dhcp pool LAN-A network 10.10.0.0 255.255.255.0 default-router 10.10.0.1 dns-server 10.0.0.53 domain-name corp.example.com lease 2 ! ip dhcp pool LAN-B network 10.20.0.0 255.255.255.0 default-router 10.20.0.1 dns-server 10.0.0.53 domain-name corp.example.com lease 2R1 picks the pool by matching the subnet of the receiving interface for local clients, and the
giaddrwritten by the relay for remote clients.lease 2is 2 days; the default is 1 day.3Relay on R2R2
R2 on Cisco IOS interface GigabitEthernet0/0/0 ip address 10.0.12.2 255.255.255.252 no shutdown interface GigabitEthernet0/0/1 ip address 10.20.0.1 255.255.255.0 ip helper-address 10.0.12.1 no shutdown ip route 0.0.0.0 0.0.0.0 10.0.12.1The helper goes on the interface facing the clients. R2 writes 10.20.0.1 into
giaddr, which is how R1 knows to use pool LAN-B.
Verify
R2# show ip interface GigabitEthernet0/0/1 | include Helper
Helper address is 10.0.12.1The relay is on the client-facing interface and points at R1.
R1# debug ip dhcp server packet
DHCPD: DHCPDISCOVER received from client 0100.5079.6668.14 through relay 10.20.0.1.
DHCPD: Sending DHCPOFFER to client 0100.5079.6668.14 (10.20.0.11).
DHCPD: unicasting BOOTREPLY for client 0050.7966.6814 to relay 10.20.0.1.
DHCPD: DHCPREQUEST received from client 0100.5079.6668.14.
DHCPD: Sending DHCPACK to client 0100.5079.6668.14 (10.20.0.11).
DHCPD: unicasting BOOTREPLY for client 0050.7966.6814 to relay 10.20.0.1.PC20's DISCOVER arrives "through relay 10.20.0.1" (the giaddr), R1 offers 10.20.0.11 from LAN-B,
and every reply goes back to the relay. Turn the debug off with undebug all afterwards.
R1# show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type State Interface
Hardware address/
User name
10.10.0.11 0100.5079.6668.0a Nov 12 2026 09:31 AM Automatic Active GigabitEthernet0/0/1
10.20.0.11 0100.5079.6668.14 Nov 12 2026 09:33 AM Automatic Active GigabitEthernet0/0/0Each client got the first address after the exclusions, from the right pool. The remote lease shows the interface toward the relay. The client ID is 01 (Ethernet) followed by the MAC.
PC20# ipconfig /all
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 10.20.0.11(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Tuesday, November 10, 2026 9:33:12 AM
Lease Expires . . . . . . . . . . : Thursday, November 12, 2026 9:33:12 AM
Default Gateway . . . . . . . . . : 10.20.0.1
DHCP Server . . . . . . . . . . . : 10.0.12.1
DNS Servers . . . . . . . . . . . : 10.0.0.53Two-day lease, the LAN B gateway, and DHCP Server 10.0.12.1: that is R1's server identifier, not the relay. Renewals at T1 go straight to 10.0.12.1 by unicast.
Mistakes people make
- Putting
ip helper-addresson R2's link toward R1 instead of on the LAN B interface. - Forgetting R1's route back to 10.20.0.0/24. DISCOVERs arrive, OFFERs go nowhere.
- Excluding addresses after clients already got them. Exclusions only stop future leases; clear the bindings or wait.
- Expecting
ip dhcp excluded-addressinside the pool. It is a global command. - Leaving
debug ip dhcp server packetrunning on a busy server.
On other platforms
The relay on an NX-OS SVI.
feature dhcp
feature interface-vlan
ip dhcp relay
interface Vlan20
no shutdown
ip address 10.20.0.1/24
ip dhcp relay address 10.0.12.1The LAN B scope on an ISC Kea DHCPv4 server. Kea selects the subnet from giaddr for relayed requests.
{
"Dhcp4": {
"interfaces-config": { "interfaces": [ "eth0" ] },
"valid-lifetime": 172800,
"subnet4": [
{
"id": 20,
"subnet": "10.20.0.0/24",
"pools": [ { "pool": "10.20.0.11 - 10.20.0.254" } ],
"option-data": [
{ "name": "routers", "data": "10.20.0.1" },
{ "name": "domain-name-servers", "data": "10.0.0.53" },
{ "name": "domain-name", "data": "corp.example.com" }
]
}
]
}
}Say it in the interview
"The server holds a pool per subnet and the relay on the client-facing interface turns the broadcast into a unicast with giaddr set to its LAN address. The server picks the pool from giaddr and replies to the relay, so it needs a route back. I check it end to end with the debug showing 'through relay' and the binding table."