Serve two LANs from one IOS DHCP server, one of them through a relay

short · 40 min · Packet Tracer · Exam topic 1.7

Task

Make a router the DHCP server for its own LAN and for a second LAN behind another router, with the second router relaying by ip helper-address. You plant and fix two of lesson 7's faults: a pool with no default-router, whose clients get an address but no gateway, and a missing relay, whose clients fall back to 169.254. By the end you can read show ip dhcp pool and show ip dhcp binding and say which client holds which lease.

Topology

Devices

Device Model Role
R1 ISR4331 DHCP server and LAN A gateway
R2 ISR4331 DHCP relay and LAN B gateway
S1 2960-24TT LAN A switch
S2 2960-24TT LAN B switch
PC1 PC-PT LAN A client
PC2 PC-PT LAN B client

Links

From To
R1 G0/0/0 S1 G0/1
R1 G0/0/1 R2 G0/0/0
R2 G0/0/1 S2 G0/1
PC1 Fa0 S1 Fa0/1
PC2 Fa0 S2 Fa0/1

Addressing

Device Interface Address Default gateway
R1 G0/0/0 192.168.10.1/24 none
R1 G0/0/1 10.0.0.1/30 none
R2 G0/0/0 10.0.0.2/30 none
R2 G0/0/1 192.168.20.1/24 (relays to 10.0.0.1) none
PC1 NIC DHCP from pool LAN-A (expect 192.168.10.11/24) 192.168.10.1
PC2 NIC DHCP from pool LAN-B via the relay (expect 192.168.20.11/24) 192.168.20.1

Steps

  1. Place the devices and cable them as the Links table lists. Use Copper Straight-Through from each router to its switch and from each PC to its switch, and Copper Cross-Over between R1 and R2 (two routers are like devices).
  2. Address R1 and give it a route back to LAN B. A relayed request arrives with LAN B's gateway address in giaddr, and R1 sends its offer back to that address, so R1 needs a route to the giaddr subnet (lesson 7's return-path check; lesson 14 covers static routes in full):
Router> enable
Router# configure terminal
Router(config)# hostname R1
R1(config)# interface g0/0/0
R1(config-if)# ip address 192.168.10.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# interface g0/0/1
R1(config-if)# ip address 10.0.0.1 255.255.255.252
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# ip route 192.168.20.0 255.255.255.0 10.0.0.2
  1. Address R2, leaving out the relay for now (the change record forgot it):
Router> enable
Router# configure terminal
Router(config)# hostname R2
R2(config)# interface g0/0/0
R2(config-if)# ip address 10.0.0.2 255.255.255.252
R2(config-if)# no shutdown
R2(config-if)# interface g0/0/1
R2(config-if)# ip address 192.168.20.1 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# end
  1. Build the two pools on R1, typing LAN-A exactly as the change record gives it (it has a line missing). The exclusions are global commands and keep each gateway and room for static devices out of the pools; 192.168.10.10 is reserved for a DNS server a later lab adds:
R1(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
R1(config)# ip dhcp excluded-address 192.168.20.1 192.168.20.10
R1(config)# ip dhcp pool LAN-A
R1(dhcp-config)# network 192.168.10.0 255.255.255.0
R1(dhcp-config)# dns-server 192.168.10.10
R1(dhcp-config)# exit
R1(config)# ip dhcp pool LAN-B
R1(dhcp-config)# network 192.168.20.0 255.255.255.0
R1(dhcp-config)# default-router 192.168.20.1
R1(dhcp-config)# dns-server 192.168.10.10
R1(dhcp-config)# end

Before any client asks, predict the first address each pool will lease. 5. Fault 1, no gateway handed out. On PC1, open Desktop > IP Configuration and select DHCP. PC1 gets an address. Open the Command Prompt:

C:\> ipconfig
C:\> ping 10.0.0.1

PC1 has 192.168.10.11, the first address after the exclusions, but its Default Gateway reads 0.0.0.0, so the ping to R1's far interface fails. The pool has no default-router line. Add it, then make PC1 lease again:

R1# configure terminal
R1(config)# ip dhcp pool LAN-A
R1(dhcp-config)# default-router 192.168.10.1
R1(dhcp-config)# end
C:\> ipconfig /release
C:\> ipconfig /renew
C:\> ping 10.0.0.1

The gateway now reads 192.168.10.1 and the ping succeeds. 6. Read the server's side:

R1# show ip dhcp pool
R1# show ip dhcp binding

The pool view gives counts only: LAN-A has one leased address and LAN-B none. The binding view says who holds what: 192.168.10.11 against PC1's MAC address. Check it against the Physical Address line of ipconfig /all on PC1. 7. Fault 2, no relay. On PC2, select DHCP. It gets no offer and falls back to an address beginning 169.254 with mask 255.255.0.0. Work it through the lesson's fault-finding order: the client asked and nobody answered; the server is on another subnet; R2 does not forward broadcasts, and nothing on R2 tells it to relay. show ip dhcp pool on R1 still shows LAN-B with no leases, so no request ever reached it. 8. The fix. Configure the relay on the interface that faces the clients, pointing at the server:

R2# configure terminal
R2(config)# interface g0/0/1
R2(config-if)# ip helper-address 10.0.0.1
R2(config-if)# end

On PC2, run ipconfig /renew. PC2 now leases 192.168.20.11. R1 chose pool LAN-B because the giaddr, 192.168.20.1, falls inside that pool's network, and it unicast the offer back to 192.168.20.1 over the route you added in step 2. 9. Prove the path from PC2:

C:\> ping 10.0.0.1

Then run show ip dhcp binding on R1 once more and match each lease to its PC.

Verify

R1# show ip dhcp binding
C:\> ipconfig /all
C:\> ping 10.0.0.1

Expected output: the binding table lists 192.168.10.11 and 192.168.20.11, each with the type Automatic. Run ipconfig /all on PC2: IPv4 Address 192.168.20.11, Default Gateway 192.168.20.1 and DNS Servers 192.168.10.10. The ping from PC2 returns Reply from 10.0.0.1 lines.

Save your work

Save the topology as ccna-lab07-dhcp-relay.pkt (File > Save As).

Notes

Step 2 adds R1's route to LAN B before any test, rather than leaving it out as a fault, because whether a simulated server still answers a relay it has no route to is not something this lab can promise. On real IOS, an offer to a giaddr with no route never leaves the server, and show ip route on the server is the check. The capstone builds on this lab's design.

This is an independent study companion for the Cisco CCNA 200-301 v2.0 exam and is not produced by or endorsed by Cisco. Cisco, CCNA and IOS are trademarks of Cisco Systems, Inc.

This is an independent study companion for Cisco CCNA 200-301 and is not produced by or endorsed by CompTIA.