4.4 Troubleshoot DHCP for IPv4 and IPv6: clients, the IOS server, relay and options
ENARSI 300-410 v1.1 · 4.0 Infrastructure Services
DHCP hands out addresses. ENARSI troubleshoots every role an IOS device can play: DHCP client (ip address dhcp), IOS DHCP server (pools, exclusions, options), relay agent (ip helper-address, option 82), and the IPv6 versions: SLAAC, stateless and stateful DHCPv6 and DHCPv6 relay.
What you must know
- Follow DORA (and SARR for DHCPv6) and say which messages are broadcast.
- Configure an IOS DHCP server with exclusions and options.
- Relay DHCP across routers and know what giaddr does.
- Choose SLAAC, stateless or stateful DHCPv6 with the RA M and O flags.
- Configure a router as a DHCPv4 or DHCPv6 client.
Relaying DHCPv4
! R1, on the client-facing interface
interface GigabitEthernet0/1
ip address 10.10.10.1 255.255.255.0
ip helper-address 10.0.50.10
!
! If the server is an IOS router:
ip dhcp excluded-address 10.10.10.1 10.10.10.20
ip dhcp pool VLAN10
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
dns-server 10.0.50.53
option 150 ip 10.0.50.60The relay (1) sets giaddr to its own interface address; the server uses it to choose the pool and to send the reply back. ip helper-address also forwards seven other UDP services (TFTP, DNS, NetBIOS, TACACS, time); limit them with no ip forward-protocol udp <port>.
| Symptom | Cause |
|---|---|
| Clients get 169.254.x.x | No helper, wrong helper address, or no route from the server back to giaddr |
| Server log: no pool for giaddr | No pool whose network includes giaddr |
| Clients get the router's own address | Missing excluded-address; IOS detects the conflict and marks it |
| Relay works, then the server drops it | Option 82 added by a snooping switch with giaddr 0.0.0.0 (ip dhcp relay information trust-all on the router) |
DHCPv6 and the RA flags
| Method | RA flags | Address from | DNS and options from |
|---|---|---|---|
| SLAAC | M=0, O=0 | The host (prefix from the RA) | RDNSS in the RA, or none |
| Stateless DHCPv6 | M=0, O=1 | SLAAC | DHCPv6 (no state on the server) |
| Stateful DHCPv6 | M=1 | DHCPv6 server | DHCPv6 |
ipv6 dhcp pool V6-LAN
address prefix 2001:db8:10::/64
dns-server 2001:db8:50::53
domain-name ntpath.lab
!
interface GigabitEthernet0/1
ipv6 address 2001:db8:10::1/64
ipv6 nd managed-config-flag ! M=1: stateful
ipv6 dhcp server V6-LAN
! or, as a relay on another router:
ipv6 dhcp relay destination 2001:db8:50::10The router as a client
interface GigabitEthernet0/0
ip address dhcp
ipv6 address dhcp
ipv6 address autoconfig default
R1# show dhcp lease
Temp IP addr: 203.0.113.42 for peer on Interface: GigabitEthernet0/0
Temp sub net mask: 255.255.255.0
DHCP Lease server: 203.0.113.1, state: 5 Bound
DHCP transaction id: 1A2B
Lease: 86400 secs, Renewal: 43200 secs, Rebind: 75600 secs
Temp default-gateway addr: 203.0.113.1Commands
show ip dhcp binding / pool / conflict | Leases, pool usage and detected conflicts. |
show ip dhcp server statistics | Messages received and sent. |
debug ip dhcp server packet | Each DHCP message the server or relay handles. |
show ipv6 dhcp binding / pool / interface | DHCPv6 leases, pools and interface roles. |
show dhcp lease | The router's own DHCP client lease. |
Exam traps
- The helper goes on the interface that receives the clients' broadcasts.
- The server needs a route back to giaddr.
- Forgetting
excluded-addresshands out the gateway's own address. - DHCPv6 never gives a default gateway; the RA does.
- M=1 with no DHCPv6 server leaves hosts with only a link-local address (plus SLAAC if the A flag is set).
Check yourself
- What does a relay put in giaddr, and why?
- Its receiving interface address, so the server picks the right pool and can reply.
- Which RA flag combination is stateless DHCPv6?
- M=0, O=1.
- Clients behind R1 get 169.254 addresses; the server is fine. First check?
ip helper-addresson R1's client-facing interface and the server's route back to it.- Where does a stateful DHCPv6 client get its default route?
- From router advertisements.
Labs
- DHCP relay to a central IOS server, and a router as a DHCP client
- DHCPv6: stateless at HQ, stateful through a relay at the branch
Try it live: DHCP relay to a central IOS server, and a router as a DHCP client