DHCP offer (dhcp)
Broadcasts a DHCP DISCOVER on the probe's network and reports whether an offer came back, which server made it, which address it offers and how long it took. It can present a vendor class (option 60) and can require the offer to come from a particular server. Use it to know that clients can get an address, and to find out when a second server starts answering on a network that should have one.
It never sends a REQUEST. A DISCOVER only asks what is on offer. The server holds the address it offered for a short while and then takes it back; nothing is leased, so a poll leaves no lease behind and uses up no address for longer than that moment. The sensor presents the same hardware address every time for the same device and vendor class (a locally administered address starting 02:50:57), so a server that holds offers for a while holds one address for the sensor and not one per poll.
What it looks like

The sensor's page after a few polls, expecting an offer from one server on a network where a second one also answers. In the dark theme: the sensor's page. The form for adding it, with its parameters filled in: light, dark.
Channels
| Key | Name | Unit | Default limits |
|---|---|---|---|
offer_received | Offer received | none | error below 1 (0 is No offer, 1 is Offer received) |
response_ms | Time to the first offer | ms | warning above 1000, error above 5000; unknown when nothing answered |
offer_count | Servers that offered | none | warning above 1 |
After the first offer the sensor listens for another 300 ms, so that a second server answering the same DISCOVER is counted. Two servers are normal only when they are not both answering: a failover pair answers from one at a time. offer_count above 1 is therefore a warning, and the message names the others. When a server is expected, the offer that is reported is that server's; an offer from anyone else is named as "also answered".
No offer is not a failed poll but a reading: offer_received is 0 and the sensor is Down, with the time that was waited. A poll fails only when the probe cannot send or listen at all, as the next section explains.
What the probe needs
A DHCP client listens on UDP port 68 and broadcasts, and neither is allowed to every program.
Port 68 is privileged on Linux. A process that is not root may bind it only with the capability
CAP_NET_BIND_SERVICE. The packaged services drop every capability, so give this one back with a drop-in, for the server's local probe (probeward.service) or a remote probe (probeward-probe.service):ini# systemctl edit probeward-probe.service [Service] AmbientCapabilities=CAP_NET_BIND_SERVICE CapabilityBoundingSet=CAP_NET_BIND_SERVICEthen
systemctl restartthe service. Do not usesetcapon the binary: an update replaces the file and the file capability with it. Loweringnet.ipv4.ip_unprivileged_port_startto 68 also works, but it opens that port and every one above it to every user on the machine. On Windows no privilege is needed to bind the port; the Windows firewall has to allow the probe's inbound UDP on it.The probe must be on the network it checks. A broadcast does not cross a router. A probe in another network segment sees only that segment's server. Put a probe (a small one will do) on each network whose DHCP you want to check; a DHCP relay answers on the relayed network's behalf and says nothing of the server behind it.
A host with more than one network interface sends the broadcast out of the one the system chooses, which is the one with the default route. Set
interfaceto choose another (Linux only). Tying the sensor to an interface needs the kernel to allow it for an unprivileged process (Linux 5.7 and later, as long as the socket was not bound before), orCAP_NET_RAWon older kernels.A container needs the host network (
docker run --network host): on Docker's own network the broadcast never reaches the real one. It runs as root inside, so port 68 is not a problem there.A DHCP client on the same host (NetworkManager, dhclient) listens on port 68 too. The sensor shares the port with it where the other program allows (
SO_REUSEADDR); if another program holds the port without sharing it the sensor says so.
If the probe cannot open the port, the poll fails with kind config and a message that says what to do:
cannot bind UDP port 68, which a DHCP client must listen on: permission denied. Port 68 is privileged: give the probe the CAP_NET_BIND_SERVICE capability (systemd: AmbientCapabilities=CAP_NET_BIND_SERVICE) or run it as rootParameters
| Parameter | Default | Meaning |
|---|---|---|
wait_ms | 3000 | How long to wait for an offer, 200 to 30000. The poll's own timeout is the upper bound. |
vendor_class | none | Present this vendor class (option 60), up to 64 printable characters. Some servers, or some pools, answer only clients that carry one. |
expected_server | none | The address of the DHCP server an offer must come from. An offer from another server makes the sensor Down. |
interface | the system's choice | The network interface to send on and listen on, such as eth0. Linux only. |
Suggested interval: 300 seconds. No credential. The device the sensor is attached to only gives it a place in the tree and a fixed hardware address: the broadcast goes to the network, not to the device.
Failures
| Message | Meaning |
|---|---|
cannot bind UDP port 68 ... permission denied (kind config) | See what the probe needs. |
cannot bind UDP port 68: another program on this host holds it and does not share it (kind config) | Something that does not use SO_REUSEADDR has the port. Stop it, or check from another host. |
cannot use the network interface "...": ... (kind config) | The interface does not exist, or the probe may not tie itself to it. |
broadcast a DHCP DISCOVER (is there a network route or an interface up?): ... (kind unreachable) | The probe has no route for a broadcast: no interface up, or none with an address. |
no DHCP offer within N ms | A successful poll that is Down. The server is down, its pool is exhausted, it does not answer this vendor class, or the probe is not on its network. |
no offer from the expected server <address>; offer of ... from ... | A successful poll that is Down. Someone else answered, and the message says who. |
Verification
Run against Kea and a second DHCP server on a test network, with a probe on it that sent the broadcast out of the network's own interface: an offer for the vendor class it answers, the two servers answering the same DISCOVER (the second one is listed and counted), an expected server that did answer and one that did not. No REQUEST is ever built: the DISCOVER is checked byte for byte, including that no message type other than DISCOVER is in it. The reading of offers (server identifier, lease, mask, router, an offer without a server identifier, another client's exchange, ACK and NAK ignored, damaged option lists) is tested on hand-built packets.
The live test needs port 68, so it does not run as an ordinary user: it says so and returns. It was run once in a container on the host network, with the test binary mounted into it:
cargo test -p probeward-sensors --test live_protocols --no-run # prints the path of the test binary
docker run --rm --network host -v "$BIN:/t/live_protocols:ro" \
-e PROBEWARD_TEST_DHCP_VENDOR -e PROBEWARD_TEST_DHCP_INTERFACE -e PROBEWARD_TEST_DHCP_SERVER \
debian:stable-slim /t/live_protocols dhcp --nocapture| Variable | Meaning |
|---|---|
PROBEWARD_TEST_DHCP_VENDOR | A vendor class the server answers. Also what turns the test on. |
PROBEWARD_TEST_DHCP_INTERFACE | Optional: the network interface to use. |
PROBEWARD_TEST_DHCP_SERVER | Optional: an address an offer must come from. With it set, the test also checks that another address is refused. |