When a test DHCPv4 server is plugged into a production access switch, what do clients on that VLAN get, and why is it possible?
answer
- who hears a broadcast Discover
- first acceptable offer often wins
- router and DNS options ride the offer
- renewals go to the server identifier
- RFC 2131 section 7
basics
~20 sClients that accept the test server's offer take its address, default router and DNS servers, and keep renewing with it. DHCPv4 allows this because RFC 2131 gives a client no way to authenticate a server.
solid answer
~40 sA client's `DHCPDISCOVER` is broadcast, so every server on the VLAN hears it and may answer with a `DHCPOFFER`. RFC 2131 lets a client wait for several offers, but many implementations take the first acceptable one, so a nearby test server wins a share of the clients. Those clients get its `yiaddr`, subnet mask, router (option 3) and DNS servers (option 6): a lab range with no route out, a duplicate of production addresses, or a gateway and resolver you do not run. The client records the winner's `server identifier` (option 54) and unicasts its T1 renewals there, so the bad lease lasts as long as the test server keeps answering. Nothing lets a client verify who sent an offer; RFC 2131 section 7 says unauthorized servers "may be easily set up".
go deeper
Recall that the Discover is broadcast, so any server on the VLAN can answer, and that the offer sets the default gateway and DNS servers, not just the address.
Explain the race between offers, why renewals return to the server identifier at T1, and why a server with no record of an INIT-REBOOT client stays silent.
Show how you would scope the damage: which leases name the wrong server identifier, how long their timers keep them there, and how to force recovery without waiting out leases.
Weigh where the fix belongs: clients cannot authenticate DHCPv4 servers, so the guarantee must come from the access layer, and every switch that lacks it is a gap.
## What the client asks, and who can answer A DHCPv4 client with no address starts in the **INIT** state and broadcasts a `DHCPDISCOVER` from source `0.0.0.0` to `255.255.255.255`. A broadcast reaches every port in the VLAN, so the production server (or the relay agent forwarding to it) and a test server someone plugged into a spare access port both hear it. RFC 2131 says each server "may respond" with a `DHCPOFFER`, and that the client "may choose to wait for multiple responses" and pick one. Many client implementations simply take the first acceptable offer, so the outcome is a race: a test server on the same switch, one hop away and idle, often answers before a production server reached through a relay agent. ## What an offer hands the client An offer is not just an address. Its fields and options set the host's whole view of the network: | Field or option | What the client does with it | What a wrong value causes | |---|---|---| | `yiaddr` | Uses it as its IPv4 address | A lab range with no route out, or a duplicate of a production address | | Option 1, subnet mask | Decides which destinations are on-link | Local peers sent to a router, or remote ones treated as local | | Option 3, router | Installs it as the default gateway | Every off-subnet packet goes to whatever host the offer names | | Option 6, domain name server | Sends DNS queries there | Names resolve to whatever that resolver answers | | Option 51, lease time | Sets the lease length, and with it T1 and T2 | A long lease keeps the bad configuration for days | | Option 54, server identifier | Records which server to renew with | Renewals go back to the test server, not to production | RFC 2131 section 7 lists these outcomes as the protocol's known exposure: unauthorized servers can send "incorrect or duplicate IP addresses, incorrect routing information (including spoof routers, etc.), incorrect domain nameserver addresses". An accidental test server usually breaks connectivity loudly. A deliberate one names a gateway and resolver it controls, so traffic keeps flowing — through it. ## Why the wrong lease persists Unplugging the box does not fix the hosts at once, because the lease lives on the clients: 1. **Renewing.** At T1 (by default half the lease) the client unicasts a `DHCPREQUEST` to the address in its `server identifier` — the test server. While that server answers, the lease is extended and production never sees the client. 2. **Rebinding.** Only if renewal gets no answer does the client, at T2 (by default 0.875 of the lease), broadcast its `DHCPREQUEST`; any server may answer, including the test server. 3. **Rebooting.** A client that restarts with a cached lease enters **INIT-REBOOT** and broadcasts a `DHCPREQUEST` naming its old address. RFC 2131 says a server that finds the client on the wrong network SHOULD send `DHCPNAK`, but a server with no record of the client "MUST remain silent". If the test server handed out production-subnet addresses, the production server stays silent and the test server's `DHCPACK` is the only reply. 4. **Expiry.** The client returns to INIT when the lease expires or a `DHCPNAK` sends it there — and the race starts again. ## Why DHCPv4 cannot tell the servers apart Nothing in an offer proves who sent it. The `server identifier` is an IPv4 address the server chose for itself, the options carry no signature, and the message rides plain UDP from port 67 to port 68. RFC 2131 states that "DHCP in its current form is quite insecure", because configuring hosts "with passwords or keys may be difficult and inconvenient". RFC 3046 repeats that DHCP "provides no authentication or security mechanisms". A client therefore has no protocol-level way to prefer the production server; the defence has to live in the network that carries the offer. ## Accident or attack: the same mechanics - A **test server or spare home router** plugged in by mistake usually offers its own private range and gateway, so hosts lose the network — a burst of "no connectivity" tickets from one VLAN. - A **deliberate rogue** offers plausible values: an address on the right subnet, plus a router and DNS server it controls. Hosts look healthy while their traffic passes through it. It may drain the real pool first, so its offer is the only one. - **Detection** comes from the clients: a lease showing an unexpected `server identifier`, duplicate-address complaints, or a switch counting server messages on an access port. - **Prevention** sits in the switch: **DHCP snooping**, a vendor feature with no RFC, drops server messages that arrive on access ports. The IETF's counterparts are DHCPv6-Shield (RFC 7610) and SAVI-DHCP (RFC 7513).
- If the test server hands out addresses from the production subnet itself, why can that be worse than a foreign subnet?Two servers now allocate from the same range without knowing about each other, so the same address can go to two hosts. RFC 2131 says a client SHOULD probe an offered address with ARP and send `DHCPDECLINE` on a conflict, but that only catches a conflict that exists at that moment. A foreign subnet fails loudly and at once; an overlapping one fails intermittently, host by host, and is much slower to diagnose.
- The test server set a very long lease. How does that change the cleanup once it is unplugged?T1 and T2 scale with the lease, so clients keep a wrong gateway until their unicast renewal to the missing server fails and they reach T2, then broadcast to rebind. RFC 2131 reserves `0xffffffff` for an infinite lease, which gives the client no renewal deadline at all. The quickest recovery is to make clients release and request again, rather than wait out the timers.
saying these in an interview costs you the question
- The client always compares offers and picks the production server's.
- A rogue DHCP server can only cause address conflicts, nothing worse.
- DHCPv4 clients check the server identifier against a list of trusted servers.
- At T1 the client broadcasts its renewal, so the real server takes over.
- Unplugging the rogue server fixes every client within seconds.