DHCP Explained: How It Works (DORA), Leases, Options & Troubleshooting
DHCP explained: the DORA process, lease renewal (T1/T2), the options that matter, scopes vs reservations, DHCP security, and step-by-step troubleshooting.
Long Nguyen
Fullstack Developer · AI Engineer · Researcher
What Is DHCP and Why Networks Need It
DHCP (Dynamic Host Configuration Protocol) is the service that hands a device an IP address, subnet mask, default gateway, and DNS servers the moment it joins a network, without anyone typing in numbers by hand. Without it, every laptop, phone, printer, and IoT device on a network would need a manually assigned static IP — workable for a handful of servers, unmanageable for anything bigger.
Three roles make this work:
| Role | What it does |
|---|---|
| Client | Broadcasts a request for configuration when it joins a network or its lease is about to expire. |
| Server | Owns one or more scopes (address pools), leases addresses out of them, and tracks every active lease in its database. |
| Relay agent | Forwards DHCP broadcasts across a router boundary so a single server can serve clients on subnets it isn\'t directly attached to — configured as ip helper-address on Cisco gear, dhcp-relay on most other platforms. |
DHCP sits directly on top of the addressing and routing concepts covered in core networking fundamentals: it only works because IP addressing, subnetting, and broadcast domains behave the way they do at Layer 2 and Layer 3.
How DHCP Works: The DORA Process (Discover, Offer, Request, Acknowledge)
A standard DHCP exchange is four UDP messages, remembered by the acronym DORA. The protocol runs over UDP port 67 on the server and UDP port 68 on the client, as defined in IETF RFC 2131, the DHCP protocol specification.
| Step | Sent by | Purpose |
|---|---|---|
| 1. Discover | Client (broadcast, source 0.0.0.0) | "Is there a DHCP server on this network?" Sent because the client has no IP yet and doesn\'t know the server\'s address. |
| 2. Offer | Server | Proposes an IP, subnet mask, lease time, and options (router, DNS, etc.). Multiple servers can answer; the client picks one. |
| 3. Request | Client (broadcast) | Announces which offer it accepted, so every server that made an offer knows whether it won or lost. |
| 4. Acknowledge (ACK) | Server | Commits the lease to its database and confirms the configuration. The client applies it and starts using the network. |
Two details trip people up in practice: first, the client stays at source address 0.0.0.0 until the ACK lands, which is why a DHCP failure looks identical to a cable-unplugged failure in some tools. Second, when the client and server sit on different subnets, the relay agent inserts its own address into the GIADDR field of the Discover message — that\'s how the server, which may be serving dozens of scopes, knows which scope to offer an address from. If GIADDR is wrong or missing, the server either offers from the wrong scope or doesn\'t answer at all.
DHCP Lease Lifecycle: T1 Renewal, T2 Rebinding, and Expiration
An IP lease isn\'t permanent — it\'s delivered with an expiry (option 51) and two internal timers that control renewal behavior:
| Timer | Default | Client behavior |
|---|---|---|
| T1 (renewal) | 50% of lease time | Client sends a unicast Request straight to the original server asking to extend the same lease. No new DORA cycle — this is the quiet, everyday case. |
| T2 (rebinding) | 87.5% of lease time | If the original server never answered T1, the client broadcasts a Request to any server, since the original one may be down or unreachable. |
| Expiration | 100% of lease time | If T2 also fails, the address is released and the client restarts the full DORA cycle from scratch. |
Lease length is a real design decision, not a default to leave alone. Short leases (minutes to a few hours) suit guest Wi-Fi and dense labs where devices churn constantly and you want addresses back fast. Long leases (days) reduce broadcast traffic and server load on stable networks like wired office segments where the same laptops reconnect daily.
APIPA and Self-Assigned Addresses (169.254.x.x): What They Mean
When a client can\'t complete DORA at all — no Offer ever arrives — most operating systems fall back to APIPA (Automatic Private IP Addressing), self-assigning a link-local address in the 169.254.0.0/16 range so at least same-segment communication still works. Seeing a 169.254.x.x address is a symptom, not a cause: it means Discover/Offer never completed, and the real fault is almost always one of physical connectivity, wrong VLAN/SSID, a missing or misconfigured relay, or a firewall/ACL silently dropping UDP 67/68.
DHCP Options Explained: The Ones That Actually Matter
Options are how DHCP delivers everything beyond the bare IP address. "I have an IP but nothing works" is almost always a wrong or missing option, not a lease problem. The full registry is maintained by IANA; the ones you\'ll actually touch day to day are a short list:
| Option | Name | What it controls |
|---|---|---|
| 1 | Subnet Mask | Defines the network/host boundary for the assigned address. |
| 3 | Router | Default gateway. Wrong value here looks like "internet is down" for every off-subnet destination. |
| 6 | Domain Name Server | DNS resolver list. Wrong or missing value produces "internet is slow / sites won\'t load" complaints. |
| 12 / 15 | Host Name / Domain Name | Client hostname and the DNS suffix appended to unqualified lookups. |
| 42 | NTP Servers | Time source — matters for Kerberos auth, TLS validation, and log correlation. |
| 44 | NetBIOS Name Server | Legacy WINS server list, still seen in older Windows environments. |
| 50 / 51 | Requested IP Address / Lease Time | Client\'s preferred address on renewal; server\'s granted lease duration. |
| 53 / 54 | DHCP Message Type / Server Identifier | Tags each DORA message (Discover/Offer/Request/ACK) and identifies which server sent it. |
| 58 / 59 | Renewal (T1) / Rebinding (T2) Time | Lets a server override the 50%/87.5% defaults explicitly. |
| 66 / 67 | TFTP Server Name / Bootfile Name | PXE network boot — imaging servers, thin clients, VoIP phone provisioning. |
| 82 | Relay Agent Information | Added by the relay/switch (circuit ID, remote ID); used for policy and DHCP snooping enforcement, not set by the client. |
| 119 / 121 | Domain Search / Classless Static Routes | Search-suffix list and extra routes pushed to the client beyond the default gateway. |
When troubleshooting "wrong DNS" or "wrong gateway," check whether the option is set at the scope level, a per-VLAN scope, or overridden by a reservation — reservations silently win over scope-wide values, and that\'s the single most common cause of "it\'s right for everyone except this one device." The authoritative source for every assigned option number is IANA\'s DHCP and BOOTP Parameters registry.
DHCP Scopes, Exclusions, and Reservations: Which One Do You Actually Need?
| Mechanism | What it is | Use it for |
|---|---|---|
| Scope | The IP pool for a subnet: start/end range, mask, options, minus any excluded addresses. | Every subnet that needs dynamic addressing. Size it to expected host count plus real growth headroom, not just today\'s device count. |
| Exclusion | A range or single address carved out of the scope so DHCP never hands it out. | Addresses already used by infrastructure that predates the scope, or reserved for future manual assignment. |
| Reservation | Maps a MAC address (or client ID) to a fixed IP, still issued and tracked through DHCP. | Devices that need a predictable IP — printers, cameras, monitoring targets — without losing centralized lease tracking, auditing, and option consistency. |
| Static IP on the device | Address configured locally on the endpoint, bypassing DHCP entirely. | Rare cases where the device must work before DHCP is reachable (some infrastructure gear). Otherwise a reservation beats a static IP: change an option once at the server and every reserved device inherits it, instead of touching each box by hand. |
DHCP Relay: Serving Clients Across VLANs and Subnets
A DHCP server only hears broadcasts from its own local segment. To serve clients on other VLANs, a Layer 3 device in each of those VLANs needs to relay the broadcast as a unicast to the server. On Cisco IOS, that\'s a single line per VLAN interface:
interface Vlan10\n ip helper-address 10.0.0.5\n
Three things go wrong here in practice, in order of frequency: the helper address points at the wrong or a decommissioned server; a firewall or ACL between the relay and the server blocks UDP 67/68; or the server has no scope defined for the relaying VLAN\'s subnet, so it silently ignores every Discover with that GIADDR. When a client on VLAN 10 falls back to APIPA, checking these three in order is faster than a packet capture in most environments.
DHCP High Availability: Failover and Split-Scope Design
A single DHCP server is a single point of failure for every device on the network it serves — when it\'s down, no new leases and no renewals for anyone stuck past T2. Two patterns handle this, and picking the wrong one for your environment is a common and avoidable mistake:
| Pattern | How it works | Trade-off |
|---|---|---|
| Split-scope (80/20 rule) | Two independent servers each own a non-overlapping slice of the same subnet\'s address range — commonly 80% on the primary, 20% on a secondary elsewhere on the network, with each side excluding the other\'s range. | Simple, works on almost any DHCP implementation, no special protocol required. But the secondary\'s smaller pool can exhaust before the primary comes back if the outage runs long. |
| DHCP failover (hot standby or load-balance) | Two servers share full lease-state replication for the same scope, so either can answer any client and both agree on who holds which lease. | No capacity cliff during an outage, but it requires both servers to run the same failover-capable implementation (e.g. Windows Server DHCP failover, ISC Kea) and adds real configuration and monitoring overhead. |
For most small-to-mid networks, split-scope is the pragmatic default: it needs no special software support and survives the failure modes that actually happen (a single server rebooting or losing power). Reach for full failover only once lease-state consistency during a multi-hour outage genuinely matters — large campus networks, VoIP-heavy environments, or anywhere a stale or duplicate lease has a real operational cost.
DHCP Security: Rogue Servers, Snooping, and Starvation Attacks
DHCP has no built-in authentication — any device that answers first wins, which creates two concrete risks on unmanaged access-layer networks:
- Rogue DHCP servers. A misconfigured device (or a hostile one) starts answering Discover broadcasts with its own bogus gateway and DNS, silently redirecting traffic. Because DORA has no "which server is authoritative" check, whichever Offer the client accepts first wins — often whichever server happens to answer fastest.
- DHCP starvation. An attacker floods a scope with Discover messages using spoofed MAC addresses until the pool is exhausted, then stands up a rogue server to answer the legitimate clients that are now unable to get a real lease.
DHCP snooping is the standard access-layer defense: switch ports facing end devices are marked "untrusted" and only forward DHCP client messages (Discover, Request); ports facing the real DHCP server or an uplink are marked "trusted" and allowed to send server messages (Offer, ACK). Untrusted ports sending Offer/ACK traffic get blocked outright, which stops both a rogue server and, paired with rate-limiting, most starvation attempts. It also builds a binding table (MAC, IP, VLAN, port) that Dynamic ARP Inspection and IP Source Guard can reuse to stop ARP spoofing and IP spoofing on the same segment — DHCP snooping is usually the first piece of a Layer 2 security baseline, not a standalone control.
DHCP Troubleshooting: A Step-by-Step Method
Work through failures in this order rather than jumping straight to a packet capture — most issues resolve in the first three checks:
| Symptom | Check first | Likely fix |
|---|---|---|
| No IP / stuck on 169.254.x.x | Physical link, correct VLAN/SSID, DHCP service actually running, scope has free addresses. | Fix the link/VLAN assignment, restart the DHCP service, or expand the scope. |
| IP conflict / duplicate address | ARP table and switch MAC table to identify both holders of the address. | Remove overlapping scopes or stale static IPs, clear the bad binding from the lease database. |
| Scope shows 0 available | Utilization trend, not just the current count — is this a spike or steady growth? | Short-term: reclaim stale leases or shorten lease time. Long-term: expand or redesign the subnet. |
| Discover sent, no Offer returns | Relay config (ip helper-address), routing between relay and server, ACLs on UDP 67/68. |
Correct the helper address or open the blocked port; confirm a scope exists for that subnet. |
| IP assigned but wrong gateway/DNS | Option 3/6 at the scope level, and whether a reservation is silently overriding it. | Fix the option at the correct scope, or the specific reservation causing the mismatch. |
Confirming platform-side state before reaching for a packet capture:
# Windows\nipconfig /all\nipconfig /release\nipconfig /renew\n\n# Linux\nsudo dhclient -v eth0\nnmcli device show eth0\n\n# Cisco IOS\nshow ip dhcp binding\nshow ip dhcp conflict\nshow running-config | include helper-address\n
When those don\'t explain the symptom, capture the exchange directly and look for exactly where DORA breaks — a Discover that never gets an Offer points at the relay/server path, while an Offer that never gets a Request usually means a duplicate or conflicting response confused the client:
sudo tcpdump -n -i eth0 \'port 67 or port 68\'\n
For the broader diagnostic habits this fits into — isolating layers, checking the obvious before the exotic — a general network troubleshooting method is worth having on hand, covered in Netalith\'s network troubleshooting basics guide.
DHCP for IPv6: How DHCPv6 and SLAAC Differ from DHCPv4
IPv6 hosts don\'t rely on DHCP by default the way IPv4 hosts do. Routers advertise prefixes via Router Advertisements, and a client can self-generate its own address through SLAAC (Stateless Address Autoconfiguration) without any server tracking who holds what. DHCPv6 layers on top in one of two modes: stateful, where the server assigns and tracks the full address much like DHCPv4, or stateless, where the client keeps its SLAAC address and only asks DHCPv6 for extras like DNS servers (option equivalent to IPv4\'s option 6). The practical takeaway: if IPv6 clients on your network have addresses but no DNS, you\'re most likely missing stateless DHCPv6 for option delivery, not a broken address assignment.
DHCP Best Practices Checklist
- Match lease time to churn — short for guest/high-turnover networks, longer for stable wired segments.
- Use reservations for infrastructure (printers, cameras, monitoring targets) instead of static IPs on the endpoint.
- Document scope ranges and option values per VLAN, with change control on edits — "who changed option 6 last Tuesday" should never require guesswork.
- Monitor scope utilization and alert before exhaustion, not after clients start failing.
- Enable DHCP snooping on access-layer switches wherever the hardware supports it.
- Plan redundancy deliberately — split-scope for simplicity, full failover only when lease-state consistency during an outage has real cost.
- Retain lease logs long enough to speed up incident response; a DHCP binding table is often the fastest way to tie a MAC address to an incident timestamp.
Conclusion: DHCP in Three Ideas
Everything above collapses into three operational facts: DORA assigns the address, the T1/T2 timers control how and when it gets renewed, and options carry everything that makes the address actually usable. Most real-world DHCP incidents trace back to one of a small number of causes — a relay misconfiguration, a scope running dry, an option overridden by a stray reservation, or a rogue server on an unprotected access port. Work through those in order and DORA/scope/option problems stop being mysterious.
If DHCP or broader network reliability issues are affecting an online business you run or support, Netalith offers a free consultation to help scope out what\'s actually going on.
FAQ
Frequently asked questions
What is APIPA and why does my device get a 169.254.x.x address?
APIPA (Automatic Private IP Addressing) is a fallback most operating systems use when a DHCP client never receives an Offer. It self-assigns an address in 169.254.0.0/16 so the device can still reach other devices on the same segment. Seeing this address means DORA failed, usually due to a physical link, VLAN, relay, or firewall issue blocking UDP 67/68 — not a problem with APIPA itself.
What's the difference between a DHCP scope and a reservation?
A scope is the whole IP pool DHCP draws from for a subnet. A reservation maps one specific device's MAC address to a fixed IP within that pool, so the device always gets the same address while staying centrally managed through DHCP, unlike a static IP configured directly on the device.
How long should a DHCP lease last?
It depends on churn. Short leases (minutes to hours) suit guest Wi-Fi and dense labs where devices connect and leave constantly. Longer leases (a day or more) reduce broadcast traffic and server load on stable, mostly-wired networks where the same devices reconnect daily.
What is DHCP snooping and why does it matter?
DHCP snooping is a switch feature that marks ports as trusted (facing the real DHCP server) or untrusted (facing end devices), blocking any DHCP server response from an untrusted port. It stops rogue DHCP servers and most starvation attacks, and its binding table also feeds Dynamic ARP Inspection and IP Source Guard.
Does DHCP work the same way for IPv6?
Not by default. IPv6 hosts commonly self-configure via SLAAC using router advertisements, with no server tracking leases. DHCPv6 can run stateful (assigning and tracking the address, like DHCPv4) or stateless (only delivering extras like DNS servers on top of a SLAAC address).
Why does one device get the wrong DNS server or gateway from DHCP?
This is almost always an option set at the wrong scope, or a reservation silently overriding the scope-wide option 3 (router) or option 6 (DNS) value for that specific device. Check the reservation before assuming the scope itself is misconfigured.