What Is DHCP?
DHCP (Dynamic Host Configuration Protocol) is a network protocol that automatically assigns IP addresses and other network configuration parameters to devices when they connect to a network. Without DHCP, every device on a network would need to be manually configured with a unique IP address, subnet mask, gateway, and DNS server - A significant administrative burden for any network larger than a handful of devices.
The DHCP Lease Process (DORA)
| Step | Name | Who Sends | What Happens |
|---|---|---|---|
| 1 | Discover | Client (new device) | Broadcasts a DHCPDISCOVER message to find available DHCP servers on the network |
| 2 | Offer | DHCP Server (router) | Responds with a DHCPOFFER containing a proposed IP address, subnet mask, lease time, gateway, and DNS |
| 3 | Request | Client | Broadcasts a DHCPREQUEST accepting the offer (also informs other DHCP servers their offer was declined) |
| 4 | Acknowledge | DHCP Server | Sends a DHCPACK confirming the lease - The client can now use the assigned IP for the lease duration |
DHCP Lease Times
Every DHCP assignment has a lease time - The period for which the IP assignment is valid. Before the lease expires, the client sends a renewal request (DHCPREQUEST) to keep the same IP. Typical lease times: home routers default to 24 hours; corporate networks often use 8 hours; mobile hotspots may use as little as 1 hour. Short lease times mean IPs are recycled faster; long lease times reduce DHCP traffic.
Static vs Dynamic IP Assignment
- Dynamic assignment: the DHCP server assigns an available IP from its pool - The device may get a different IP on the next connection.
- Static IP (manual): configured on the device itself, bypassing DHCP entirely - Must be chosen outside the router's DHCP pool to avoid conflicts.
- DHCP reservation (static DHCP): configured in the router to always assign the same IP to a specific MAC address - The device still uses DHCP but always gets the same address. Best practice for devices requiring a fixed IP (printers, servers, consoles for port forwarding).
- DHCP scope: the range of IPs the server is configured to distribute, e.g. 192.168.1.100 to 192.168.1.200.
- DHCP conflict: if a device is manually configured with an IP already in use, both devices will have communication issues - Always check the DHCP pool before setting static IPs.
More Than an Address: What Else DHCP Hands Out
DHCP (defined in RFC 2131, with options in RFC 2132) configures far more than the IP. Each lease can carry dozens of "options" - Numbered configuration fields the client applies automatically.
| Option | Name | What It Configures |
|---|---|---|
| 1 | Subnet Mask | Which addresses count as local - See subnets |
| 3 | Router | The default gateway - Where non-local traffic is sent |
| 6 | DNS Servers | Who resolves names for the device - The reason changing router DNS affects every device |
| 15 | Domain Name | The local search domain appended to bare hostnames |
| 51 | Lease Time | How long the assignment is valid before renewal |
| 66/67 | Boot Server / File | Network booting (PXE) for thin clients and OS deployment |
Why this matters for security
Because clients trust whatever DHCP server answers first, a rogue DHCP server on the network can silently hand out a malicious DNS server or gateway, redirecting every device that joins. This is a classic attack on open Wi-Fi - One more reason public hotspots deserve caution and enterprise networks deploy DHCP snooping on their switches.
Troubleshooting DHCP Failures
- Symptom: address starting 169.254.x.x - The device broadcast a Discover and nobody answered. Check that the router is up, DHCP is enabled in its LAN settings, and (on Wi-Fi) that you are on the right network.
- Symptom: "DHCP pool exhausted" - More devices than addresses. Widen the pool range in the router or shorten lease times; common in homes with dozens of smart devices and a default /24 pool of 100 addresses.
- Symptom: same device keeps stealing another's address - A manual IP set inside the pool. Move the manual address out of the pool or convert it to a reservation.
- Force a retry: Windows
ipconfig /release+ipconfig /renew; Mac System Settings → Wi-Fi → Details → TCP/IP → Renew DHCP Lease; iPhone Settings → Wi-Fi → ⓘ → Renew Lease; Android: forget and rejoin the network.
What This Means for You
DHCP is why networking is plug-and-play: join a network, get a working configuration in about a second, no typing. You interact with it consciously in only three situations - When it fails (the 169.254 address), when you need predictability (use the router's reservation feature, which keeps DHCP's convenience while pinning the address), and when you want to change network-wide behaviour such as DNS, which is most cleanly done by editing what the router's DHCP server hands out rather than touching every device. Devices pick up such changes at their next renewal, so reboot or toggle Wi-Fi to apply immediately.
Frequently Asked Questions
What happens when a DHCP lease expires?
Nothing dramatic, usually. Clients renew at half the lease time, so an active device keeps its address seamlessly. Only a device that was offline through the whole lease window returns its address to the pool - And on reconnecting it will often request, and receive, the same one back.
Is DHCP only for IPv4?
No. IPv6 has DHCPv6, but it is optional: IPv6 devices can configure themselves with SLAAC, deriving an address from the router's advertised prefix with no server at all. Many networks use SLAAC for addresses and DHCPv6 or router advertisements just for DNS information.
Can two networks both use 192.168.1.x without conflict?
Yes - That is the point of private ranges. Millions of homes run identical 192.168.1.0/24 networks because the addresses never appear on the internet. A conflict only arises within one network, or when you VPN between two networks that happen to use the same range.