DHCP and its options: more than just an IP address


Every device on a network starts out the same way: it has no address, no idea who else is there, and no way to ask anyone directly. So it shouts… DHCP is the protocol that answers.

It's easy to take for granted, but most of what makes a network feel like it "just works" (the printer that appears on its own, the laptop that behaves on a new Wi-Fi network) comes down to DHCP doing its job quietly in the background. It's also one of the first places to look when something stops working.

Why DHCP exists

Before DHCP, addressing was manual. Every device got a static IP, recorded somewhere: a spreadsheet if you were lucky, a sticky note if you weren't. That falls apart quickly at any kind of scale.

DHCP (Dynamic Host Configuration Protocol) solves one problem: getting a device everything it needs to talk on the network, automatically, without anyone touching it.

The important phrase there is everything it needs. An IP address is only part of it. A device also needs a subnet mask, a default gateway and DNS servers, and sometimes a boot server or a time source. Those extras are delivered as options, which are covered below.

DORA: how a device gets its address

The exchange is four packets, and it has a name worth remembering: DORA.

  1. Discover. The device has no IP yet, so it can't address anything directly. It broadcasts to 255.255.255.255, effectively asking whether any DHCP server is out there.
  2. Offer. A DHCP server replies with a candidate lease: an IP address, a lease time and its own identity.
  3. Request. This is the step that catches people out. The client doesn't simply accept the offer. It broadcasts again, naming the specific offer and server it wants. If there's more than one DHCP server on the segment, that broadcast tells the others their offers weren't chosen.
  4. Acknowledge. The chosen server confirms the lease and hands over the full set of options.

Four packets take a device from nothing to fully configured.

It also explains something you'll see in the wild: APIPA. If a device ends up with a 169.254.x.x address, DORA failed somewhere. No Offer came back, so the device gave itself a fallback address that can only talk to other APIPA devices on the same segment. It isn't broken, just a client giving up gracefully.

Scopes, leases and reservations

A scope is the pool of addresses a DHCP server is allowed to hand out, along with the rules attached to it: the subnet, any exclusions and the lease duration.

Lease time

Lease time is a setting most people leave on the default and forget about. That's usually fine, until it isn't.

A long lease can also be perfectly sensible. If DHCP is running on a modest router and your network rarely changes, there's no reason to make it work harder than it needs to.

Reservations

A reservation sits between static and dynamic addressing. The device still uses DHCP, but its MAC address is pinned so it always receives the same IP. It's the sensible way to give a printer or server a predictable address without configuring it by hand on the device itself.

One real-world note: end users tend to think of a reservation as a static address. It's worth knowing the difference, because the configuration lives on the DHCP server, not the device.

Options: where the real configuration lives

The IP address is almost the least interesting thing DHCP provides. The options carry the configuration that makes that address useful, and each one has a number.

A few come up constantly when managing a real estate:

Option Name What it does
3 Router The default gateway. Without it, a device knows its own subnet but can't reach anything beyond it.
6 DNS servers Get this wrong across a large estate and you'll spend a day chasing "the internet's down" tickets that turn out to be DNS in disguise.
15 Domain name Feeds suffix search lists, which is why a device can resolve "fileserver" without the full FQDN being typed. Using FQDNs everywhere is still the better habit.
66 / 67 TFTP server and boot filename Essential for PXE boot, imaging and zero-touch provisioning. The device is told not just an address, but where to go to boot an operating system.

Vendor-specific options

Option 43 is the classic vendor-specific option. Wireless controllers use it so that an access point can find its controller automatically on first boot, with no manual configuration. It's the difference between unboxing 200 access points and having them configure themselves, and touching every one by hand.

Options are also where platform differences show up in a mixed estate. Not every operating system honours every option in the same way, so it's worth checking before assuming a setting will work everywhere.

There's a further catch: different vendors sometimes use the same option number for entirely different things. If DHCP isn't running on a proper server, it can be very hard to specify an option on a per-vendor, per-device basis.

Where DHCP breaks

Three failure patterns turn up again and again.

Scope exhaustion

The pool runs dry, usually because the lease time is too long for the number of devices passing through the subnet. New devices get nothing.

Take a pub running residential kit for customer Wi-Fi on a busy day. Two hundred customers, nearly all on a phone, and half of them with a watch as well, is 300 addresses. But the router's default setup is 192.168.1.0/24, a Class C network with the mask 255.255.255.0, which only has room for 254 usable addresses. The customers who arrived last can't get online.

Rogue DHCP servers

Someone plugs in a cheap router with DHCP enabled by default, and now part of the segment is getting offers from two servers. This is exactly what DHCP snooping on managed switches is for: it lets you specify that only certain ports are allowed to answer DHCP requests.

The usual explanation is that they were only trying to get five devices online from the one ethernet port they'd been given.

Option drift

Someone updates the DNS servers on one scope and forgets the other four. A chunk of the estate then quietly resolves against a decommissioned server until every lease naturally expires.

Summary

DORA hands out the lease. Scopes define the pool and the rules around it. Options are the payload that makes the address worth having. Get the options wrong, and the address barely matters.

Understanding DHCP also raises an obvious question: once a device has its default gateway, what does that gateway actually do with its traffic? That's covered in the next article, on what a router really does.