DHCP doesn’t just hand out IP addresses; it’s a carefully orchestrated dance between a client device and a server, designed to prevent a chaotic free-for-all of network addresses.

Let’s watch it in action. Imagine a new laptop booting up on your home network. It needs an IP address to talk to anything else.

[Laptop] DORA: Discover

The laptop broadcasts a DHCPDISCOVER message onto the local network. Think of it as shouting, "Is there anyone out there who can give me an IP address?" This message contains the laptop’s unique MAC address so the server knows who’s asking.

[DHCP Server] DORA: Offer

Any DHCP server on the network hears this and responds with a DHCPOFFER. This is the server saying, "Hey, I’ve got an IP address for you! Here’s 192.168.1.100, a lease duration of 8 days, and my own IP address (192.168.1.1) as the default gateway." This offer is specific to the laptop’s MAC address.

[Laptop] DORA: Request

The laptop receives one or more offers (if multiple DHCP servers exist) and picks one. It then broadcasts a DHCPREQUEST message, stating, "I’d like to accept the offer for 192.168.1.100 from the server at 192.168.1.1." This request is also broadcast so all servers know which offer was accepted.

[DHCP Server] DORA: Acknowledge

The chosen DHCP server, upon hearing the DHCPREQUEST, sends a DHCPACK (acknowledge) message. This finalizes the lease: "Okay, 192.168.1.100 is officially yours for 8 days. Here’s your subnet mask (255.255.255.0), default gateway (192.168.1.1), and DNS server (192.168.1.1)." The laptop is now configured and can communicate.

The problem DHCP solves is IP address management. Without it, you’d have to manually assign an IP address, subnet mask, and gateway to every single device that joins the network. This is prone to errors: duplicate IPs (two devices with the same address, causing connectivity issues for both) and incorrect configurations. DHCP automates this, ensuring unique addresses and consistent network settings.

Internally, the DHCP server maintains a pool of available IP addresses and tracks which addresses are leased, to whom (via MAC address), and for how long. When a lease is nearing expiry, the client will attempt to renew it before it officially runs out, usually with a DHCPREQUEST to its current server. If the server is unavailable, the client might try to renew with another server or, if the lease expires completely, it will go back to the DHCPDISCOVER stage.

The key levers you control with DHCP are the IP address pool, lease duration, and the options provided. The IP address pool defines the range of addresses the server can hand out (e.g., 192.168.1.100 to 192.168.1.200). Lease duration (e.g., 24 hours, 7 days, 30 days) dictates how long a device can keep an IP before needing to renew. DHCP options are crucial for providing network intelligence: the default gateway tells devices where to send traffic destined for outside the local network, and DNS servers translate domain names (like google.com) into IP addresses.

A common misconception is that DHCP is just about IP addresses. In reality, the DHCP options are often more critical for day-to-day network functionality. For instance, without the correct DNS server option, devices can’t resolve hostnames, effectively crippling their ability to access most internet resources, even if they have a valid IP address.

The next step in managing network connectivity is understanding how DNS resolution works in conjunction with DHCP.

Want structured learning?

Take the full Internet Protocol Deep Dives course →