Skip to main content
DHCP

Dynamic Host Configuration Protocol

Active

Network management protocol used to automatically assign IP addresses and other configuration to devices joining a network.

Network ManagementRFC 21311997Internet Standard

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

FieldSizeDescription
op1 byteMessage type: 1=BOOTREQUEST, 2=BOOTREPLY
htype1 byteHardware type (1=Ethernet)
xid4 bytesTransaction ID – matches requests to replies
ciaddr4 bytesClient IP address (if already has one)
yiaddr4 bytes'Your' IP address – offered to client
siaddr4 bytesServer IP address
chaddr16 bytesClient hardware address (MAC address)
optionsVariableDHCP 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

linuxsince systemd-networkd / dhcpcdbuilt-in
macosbuilt-in
windowsbuilt-in
freebsdbuilt-in
androidbuilt-in
iosbuilt-in

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).

Related protocols