Dynamic Host Configuration Protocol
ActiveNetwork management protocol used to automatically assign IP addresses and other configuration to devices joining a network.
In one line
DHCP automates IP address assignment on networks, defined in RFC 2131. When a device joins a network, it broadcasts a DHCPDISCOVER; the server responds with DHCPOFFER containing an IP lease; the client accepts with DHCPREQUEST; the server confirms with DHCPACK. DHCP operates over UDP ports 67 (server) and 68 (client) and assigns addresses with configurable lease durations.
Quick Reference
| Field | Size | Description |
|---|---|---|
| op | 1 byte | Message type: 1=BOOTREQUEST, 2=BOOTREPLY |
| htype | 1 byte | Hardware type (1=Ethernet) |
| xid | 4 bytes | Transaction ID – matches requests to replies |
| ciaddr | 4 bytes | Client IP address (if already has one) |
| yiaddr | 4 bytes | 'Your' IP address – offered to client |
| siaddr | 4 bytes | Server IP address |
| chaddr | 16 bytes | Client hardware address (MAC address) |
| options | Variable | DHCP message type, subnet mask, router, DNS, lease time |
Key Characteristics
DORA Handshake
Discover → Offer → Request → Acknowledge. 4-step address assignment.
Lease Management
Addresses are leased for a duration. Clients renew before expiry.
Option-based Config
Delivers subnet mask, gateway, DNS servers, NTP, domain name.
Broadcast-based
Uses broadcast (255.255.255.255) since client has no IP yet.
Implementations
Edge cases
- •DHCP starvation attacks exhaust the address pool using spoofed requests.
- •Rogue DHCP servers can redirect clients to malicious gateways (DHCP spoofing).
- •DHCP relay agents needed for clients on different subnets from the server.
- •Lease time tuning: short for high-churn networks, long for stable ones.
History
DHCP evolved from BOOTP (RFC 951, 1985), adding dynamic leasing. RFC 2131 (March 1997) defined the current DHCPv4 protocol, superseding the earlier RFC 1531/1541 drafts. DHCPv6 was added in RFC 3315 (2003) and consolidated in RFC 8415 (2018).