Sub topic 3
DHCP Fallbacks, Relays, Troubleshooting, and IPv6
Assume you know IPv4 addresses, subnet masks, default gateways, DNS, LANs, and broadcasts. This chapter focuses on what happens when normal DHCP assignment fails or must cross a router.
Link-local fallback: 169.254.0.0/16
If an IPv4 DHCP client receives no usable response, it may assign itself an address from 169.254.0.0/16. This is called a link-local address or APIPA address. The client checks for an address conflict with ARP before using it.
A link-local address works only with devices on the same local network. Routers do not forward it, so it cannot reach other subnets or the Internet.
Relay agents across subnets
Routers normally stop broadcasts, but DHCP clients initially use broadcasts. A DHCP relay agent solves this problem. It receives the client broadcast, sends the request to a DHCP server, and forwards the server's reply back to the client subnet.
The relay records the receiving subnet in the DHCP message, commonly through the giaddr field. The server uses that information to choose the correct scope.
Other DHCP messages
| Message | Purpose |
|---|---|
| NAK | Rejects a request because the address or network is invalid |
| Decline | Client reports that an offered address is already in use |
| Release | Client gives up its current lease |
| Inform | Client asks for options without requesting an address |
Inspecting and troubleshooting DHCP
Capture DHCP traffic on the client-facing interface:
sudo tcpdump -n -i eth0 -vv 'udp and (port 67 or port 68)'Look for Discover, Offer, Request, and Acknowledge messages. If Discover leaves but no Offer returns, check the server, relay, VLAN, and firewall. If the client receives the wrong subnet, inspect the relay configuration and server scopes.
On Linux, release and renew a lease with dhclient. On Windows, use ipconfig /release and ipconfig /renew. Check the assigned address, DHCP server, gateway, and lease times.
DHCP security
A rogue DHCP server can give clients a malicious gateway or DNS server. A starvation attack rapidly requests many leases, exhausting the address pool. DHCP snooping on a managed switch helps prevent both problems by allowing DHCP server replies only through trusted ports and limiting client requests on untrusted ports.
IPv6: SLAAC and DHCPv6
IPv6 usually uses SLAAC, where a router advertisement supplies a prefix and the host creates its own address. DHCPv6 can provide addresses and other settings, or only additional information such as DNS. IPv6 uses multicast rather than IPv4 broadcast, and its exchange uses messages such as Solicit, Advertise, Request, and Reply.
Exercise
A client has a 169.254.20.8 address, and a packet capture shows Discover messages but no Offers. What should you check first?
Show answer
Check the DHCP server, relay path, client VLAN, and filters blocking UDP ports 67 and 68.