Dynamic Host Configuration Protocol (DHCP)
1. Overview and Architecture
The Dynamic Host Configuration Protocol (DHCP) (RFC 2131) is an application-layer network management protocol that automates the process of configuring devices on IP networks.
DHCP extends the BOOTP architecture and message format, maintaining backward compatibility while introducing Dynamic IP Address Pools and Temporary Leases:
- UDP Port 67: DHCP Server listens on Port 67.
- UDP Port 68: DHCP Client listens on Port 68.
Three Address Allocation Mechanisms in DHCP:
- Dynamic Allocation: DHCP leases an IP address to a client from an available pool for a limited duration of time (a Lease). When the lease expires, the IP is automatically returned to the pool for reuse.
- Automatic Allocation: DHCP assigns a permanent IP address to a client from a pool on a first-come, first-served basis (no lease expiration).
- Manual / Static Reservation: The administrator binds a specific IP address permanently to a specific MAC address (used for web servers, default printers, and routers).
2. The DHCP "DORA" Four-Way Handshake
When a new client joins a network, it obtains its network configuration via the DORA sequence:
1. Discover (DHCPDISCOVER)
- The client boots with no IP address () and broadcasts a
DHCPDISCOVERpacket to destination255.255.255.255on UDP Port 67 to locate any available DHCP servers on the subnet.
2. Offer (DHCPOFFER)
- Each DHCP server that receives the broadcast checks its pool, reserves an available IP, and transmits a
DHCPOFFERcontaining the proposed IP address, subnet mask, lease duration, and the server's own IP address.
3. Request (DHCPREQUEST)
- The client may receive multiple offers from different servers. It selects one offer (typically the first received) and broadcasts a
DHCPREQUEST. - Why Broadcast? It informs the selected server of its acceptance while simultaneously alerting all other competing servers that their offers were rejected, allowing them to release their reserved IPs back into the pool!
4. Acknowledgment (DHCPACK)
- The chosen server sends a
DHCPACKfinalizing the transaction and delivering complete network parameters:- Assigned Client IP Address.
- Subnet Mask (e.g.,
255.255.255.0). - Default Gateway Router IP (e.g.,
192.168.1.1). - DNS Server IP Addresses (e.g.,
8.8.8.8). - Lease Time duration (e.g., ).
3. DHCP Lease Renewal Lifecycle
To prevent long-disconnected devices from permanently occupying IP addresses, DHCP uses timed leases:
- At 50% of Lease ( Renewal Timer):
- Client sends a unicast
DHCPREQUESTdirectly to the original leasing server. If the server is online, it replies withDHCPACK, resetting the lease timer back to .
- Client sends a unicast
- At 87.5% of Lease ( Rebinding Timer):
- If the original server failed to respond at , the client broadcasts a
DHCPREQUESTto any active DHCP server on the network to extend its lease.
- If the original server failed to respond at , the client broadcasts a
- At 100% (Lease Expiration):
- If no server responds, the client must immediately stop using the IP address, release it, and restart the full DORA process from
DHCPDISCOVER.
- If no server responds, the client must immediately stop using the IP address, release it, and restart the full DORA process from
4. DHCP Relay Agent across Subnets
Like BOOTP, DHCP relies on the DHCP Relay Agent (RFC 3046 / Cisco ip helper-address) running on default routers. When the router intercepts a local broadcast DHCPDISCOVER on UDP 67, it converts it into a unicast IP datagram, inserts its incoming interface IP into the Gateway IP (giaddr) field, and forwards it to the central enterprise DHCP server across the WAN.
5. Comprehensive Comparison: ARP vs. RARP vs. BOOTP vs. DHCP
| Feature | ARP | RARP | BOOTP | DHCP |
|---|---|---|---|---|
| Layer | Data Link / Network | Data Link | Transport / App (UDP 67/68) | Transport / App (UDP 67/68) |
| Resolves | IP MAC | MAC IP | MAC IP + Boot info | Dynamic IP + Full Configuration |
| Crosses Routers? | No (L2 broadcast) | No (L2 broadcast) | Yes (via Relay Agent) | Yes (via Relay Agent) |
| Allocation | N/A (Address lookup) | Static table | Static manual table | Dynamic Leases, Auto, Manual |
| Delivered Info | Hardware MAC only | Single IP only | IP, Mask, Gateway, TFTP | IP, Mask, Gateway, DNS, Lease, NTP |
| Status | Active (IPv4) | Obsolete | Legacy | Universal Standard |
Frequently Asked Questions
QWhat does the acronym DORA represent in DHCP?
Discover, Offer, Request, Acknowledgment.
QWhy is DHCPREQUEST broadcast rather than unicast?
The client broadcasts the request to notify the selected DHCP server of its acceptance while simultaneously notifying all other offering servers to release their reserved IP addresses back to the pool.
QWhat happens during the T1 and T2 timers in DHCP?
fires at of lease duration, prompting a unicast renewal request to the original server. If unacknowledged, fires at of lease duration, broadcasting a rebinding request to any available DHCP server.
QWhat are the three DHCP address allocation mechanisms?
Dynamic (leased from a pool for a limited time), automatic (permanent address from the pool, first come first served) and manual (administrator binds a fixed IP to a MAC address).