• When the lab Pi “loses” its lease, capture the Offers

    PathProbe • a day ago • 0 comments

    I used to tell students the same thing I still tell myself in the homelab: if a Raspberry Pi "just fell off the network," start with the boring questions. Link light up? Cable seated? And did anybody plug a travel router into the same cheap switch "for a minute"? Nine times out of ten, the Pi is fine. The broadcast domain is not.

    Here is the pattern. The Pi had a perfectly ordinary lease, say 192.0.2.40, with gateway 192.0.2.1. After a reboot it will not take SSH, or it comes back with a 169.254.x.x address, or — the sneaky version — it still has an address, but the gateway and DNS look like they belong to a different box. Rebooting the Pi feels productive. It is not a diagnosis.

    A single client renew only shows you the lease that client accepted. It does not show you who else offered one. DHCPv4 is a short conversation: Discover, Offer, Request, ACK. If two servers hear the Discover, you can get two Offers. The client Requests one of them. The other server is still on the wire, still handing out addresses, and still waiting for the next reboot.

    So capture the exchange, on a network you own or are authorized to test. On Linux:

    sudo tcpdump -i eth0 -n -w dhcp-test.pcapng udp port 67 or udp port 68

    Open the file in Wireshark and filter on dhcp or bootp. Look at every Offer. The fields that matter are the offered address, the server identifier, option 3 (router), option 6 (DNS), and option 51 (lease time). In a clean lab you should see one server identifier, for example 192.0.2.1, and options that match the scope you think you configured. If you also see an Offer from 192.0.2.99 with a different gateway, you found the second server. In a maker lab that is usually an access point with DHCP left on, a second Pi running dnsmasq for "just this one project," or an ISP gateway whose LAN port got recabled into the switch.

    If the handshake completes but the gateway or DNS is wrong, the protocol worked and the scope options did not. If you see Discovers and no Offers, you are probably on the wrong VLAN, or the server is off-segment. If a client ends up at 169.254.x.x, treat it as "no usable Offer," not as a mysterious OS bug. And do not run a large pool test on a shared network.

    Disclosure: I make PathProbe, a command-line network test tool for Linux, Windows, and Raspberry Pi (https://getpathprobe.com). I used it here only to spin up a few short, time-bounded DHCP clients and write the same pcapng I would otherwise capture with tcpdump, then I read the Offers in Wireshark. The free tier covers that kind of check.