Python · SQL · Web Dev · Java · AI/ML tracks launching soon — your one platform for all of IT

DHCP — Dynamic Host Configuration Protocol

From the broadcast storm of DORA to the precision of DHCP snooping and stateless DHCPv6: how the protocol that configures every device on your network actually works.

28–38 min May 2026
Chapter 1

Before DHCP: The Pain of Static Addresses

1993. A university IT administrator manages 600 workstations spread across 20 buildings. Every IP address is assigned manually. When a machine moves floors, someone must physically reconfigure it. A new student lab of 30 machines means 30 separate visits. IP conflicts — two machines claiming the same address — bring down network segments without warning. A Stanford researcher named Ralph Droms has been working on a solution for two years. In March 1993, RFC 1541 defines DHCP. The administrator can finally go home on time.

DHCP's predecessor was BOOTP (Bootstrap Protocol, RFC 951, 1985), which could assign IP addresses to diskless workstations from a static table. BOOTP required manually configured MAC-to-IP mappings for every device — better than pure static configuration, but still not dynamic. DHCP extended BOOTP to add dynamic address pools, lease-based allocation, and a rich options framework.

Today, DHCP is invisible infrastructure. Every device you connect to any network — home Wi-Fi, corporate LAN, mobile data, coffee shop — receives its IP configuration via DHCP within seconds. The DORA exchange (Discover, Offer, Request, ACK) runs before the first application packet leaves the machine.

WOW: DHCP runs over UDP — a connectionless, unreliable transport — even though it needs to reliably exchange IP configuration. The protocol handles reliability itself: timeouts (4s, 8s, 16s, 32s with random jitter), retransmissions, and the broadcast fallback (rebinding). The choice of UDP is deliberate: the client has no IP yet, so TCP's connection establishment would require state that doesn't exist.

Chapter 2

The DORA Handshake: Four Messages, Full Configuration

A laptop connects to a new Wi-Fi network. The wireless association completes; the radio link is up. But the laptop cannot send any IP packets yet — it has no IP address. The OS triggers the DHCP client, which constructs a UDP datagram with source IP 0.0.0.0 (it has none) and destination 255.255.255.255 (limited broadcast, reaches everyone on the local segment). The first message lands on every DHCP server on the subnet. The race begins.

Message 1: DHCPDISCOVER (Client Broadcast)

The DISCOVER message is a UDP datagram with:

Source IP: 0.0.0.0 (client has no address)

Destination IP: 255.255.255.255 (limited broadcast)

Source port: 68 (DHCP client port)

Destination port: 67 (DHCP server port)

The DISCOVER payload is a BOOTP-derived message with the client's MAC address in the chaddr field and a random transaction ID (xid) used to match subsequent messages. The client includes Option 55 (Parameter Request List) asking for specific configuration: subnet mask, gateway, DNS, domain name, NTP, etc.

Message 2: DHCPOFFER (Server Response)

Each DHCP server that receives the DISCOVER responds with an OFFER. The server selects an available IP from its pool, temporarily reserves it, and sends the offer with:

yiaddr: the offered IP address ("your IP address")

— Option 51: proposed lease time

— Option 54: server identifier (server's own IP)

— Options 1, 3, 6: subnet mask, gateway, DNS

The OFFER may still be broadcast (if the client's IP is not yet set) or unicast to the MAC address. Multiple servers may offer; the client accepts the first response by default.

Message 3: DHCPREQUEST (Client Broadcast)

The client broadcasts a REQUEST selecting one server's offer. Broadcasting is deliberate: all servers that sent offers hear the REQUEST. Servers not selected see their IP reservation released. The REQUEST includes Option 54 (Server Identifier) naming the chosen server and Option 50 (Requested IP Address) confirming the offered IP.

Message 4: DHCPACK (Server Confirmation)

The selected server sends an ACK confirming the lease. The client configures its interface: sets the IP, subnet mask, default route, and DNS servers. Starts the lease timers. The client may run ARP probing (sending gratuitous ARPs) to verify the assigned IP is not already in use.

DHCP DORA Handshake

Click each step to see the UDP packet fields and what they mean.

1DHCPDISCOVER0.0.0.0:68255.255.255.255:67
2DHCPOFFER192.168.1.1:67255.255.255.255:68
3DHCPREQUEST0.0.0.0:68255.255.255.255:67
4DHCPACK192.168.1.1:67255.255.255.255:68

Chapter 3

DHCP Lease Timers: T1, T2, and Expiry

A developer plugs into a conference room Ethernet port. The lease time is 8 hours. She works there all day, disconnects at 5 PM, and comes back at 9 AM. The lease expired overnight. Her laptop starts DORA again and gets a new IP. But wait — DHCP has a mechanism to prevent this: renewal. The client is supposed to renew its lease before it expires, as long as it is still connected.

DHCP leases have three time points that drive the lease state machine:

T1 — Renewal Time (Option 58)

At T1 (typically 50% of the lease duration), the client enters RENEWING state and unicasts a DHCPREQUEST directly to its DHCP server. This is an efficient unicast renewal — the server simply extends the lease. If the server responds with ACK, the lease resets to a fresh duration.

T2 — Rebind Time (Option 59)

At T2 (typically 87.5% of the lease), the client enters REBINDING state. The original server hasn't responded to renewals (it may be down). The client now broadcasts to any DHCP server. Any server can extend the lease — not necessarily the original one. This allows DHCP failover to transparently serve rebinding clients.

Lease Expiry

If no server responds by expiry, the client must stop using the IP. It returns to INIT state and starts DORA again. During INIT, the client has no valid IP — ongoing connections are broken. This is why DHCP servers should be redundant (DHCP failover) and lease times should be long enough to survive server maintenance windows.

DHCP Lease State Machine

Click a state to see what happens there and what triggers transitions.

BOUND
Client has a lease. IP is configured. T1 timer running (50% of lease time). Normal network operation.
TRANSITIONS
T1 expiresRENEWING

Choosing Lease Times

Short leases (minutes to hours): good for environments with high device turnover (cafes, conferences, hotels), but increase server load and cause more DORA exchanges. If a server is down during T1/T2, clients lose connectivity faster.

Long leases (days to weeks): stable addresses, less protocol chatter, better for corporate desktops and servers. But address pool exhaustion risk if many devices disconnect without releasing.

DHCP RELEASE: clients should send a RELEASE message when they disconnect voluntarily (e.g., at shutdown or when the interface goes down). This immediately frees the address. However, servers must not depend on this — mobile devices often vanish without sending RELEASE.


Chapter 4

DHCP Options: The Configuration Payload

DHCP is often described as "the protocol that gives you an IP address." But that description misses half the value. DHCP can push dozens of configuration parameters to clients: DNS servers, default gateway, NTP servers, domain search list, proxy auto-config URL, VoIP phone provisioning server, PXE boot parameters, and custom vendor-specific data. A fully configured DHCP server can bring a factory-fresh device from zero to fully configured in seconds.

DHCP options are Type-Length-Value (TLV) encoded fields appended to the base BOOTP packet. The magic cookie (0x63825363) at the start of the options field identifies the packet as DHCP. Options range from code 0 to 255; code 255 signals end of options. The base packet format (chaddr, siaddr, giaddr, etc.) comes from BOOTP; everything else is in options.

DHCP Options Explorer

Select a category, then click an option to see what it does.

1Subnet Mask
3Router (Default Gateway)
6DNS Servers
12Hostname
15Domain Name
28Broadcast Address
42NTP Servers
119DNS Search Domain List

Option 82: DHCP Relay Agent Information

Option 82 is added by DHCP relay agents (routers that forward DHCP packets between VLANs). It contains sub-options identifying which switch port the client connected to. The DHCP server can use this to assign addresses from pool appropriate for that VLAN, log exact client location, or enforce security policies. This is critical in large networks where clients connect from many different VLANs but the DHCP server is centralized.

Option 121: Classless Static Routes

Option 121 (RFC 3442) pushes static routes to clients: a list of CIDR prefix + next-hop pairs. RFC 3442 mandates that if Option 121 is present, clients must use it and MUST ignore Option 3 (default gateway) for routing purposes. This allows DHCP to install specific routes for split tunnels, VPN routing, or steering traffic to specific next-hops.

WARN: Option 121 has been used in VPN bypass attacks. By pushing a specific route for the VPN server's IP via the local gateway (rather than the VPN tunnel), malicious DHCP can cause VPN traffic to bypass the tunnel entirely while appearing connected. This was publicly disclosed (CVE-2024-3661, "TunnelVision"). Verify your VPN client handles this correctly.

Chapter 5

DHCP Relay Agents: Crossing VLAN Boundaries

A corporate network has 50 VLANs — one per department. DHCP broadcasts do not cross VLAN boundaries by design. Installing a DHCP server in each VLAN is wasteful and hard to manage. The solution: DHCP relay agents. One DHCP server in the datacenter serves all 50 VLANs by having routers relay DHCP broadcasts as unicasts.

A DHCP relay agent (also called a BOOTP relay or IP helper) is typically configured on a router or L3 switch. When a DHCP broadcast arrives on a VLAN interface, the relay agent:

1. Intercepts the DHCPDISCOVER broadcast on the client's subnet.

2. Sets the giaddr (gateway IP address) field in the DHCP packet to the relay agent's own interface IP.

3. Unicasts the modified packet to the configured DHCP server address.

4. When the server replies, the relay agent forwards the response back to the client (broadcast if ciaddr=0.0.0.0).

# Cisco IOS L3 interface configuration
interface Vlan10
  ip address 10.1.10.1 255.255.255.0
  ip helper-address 10.0.0.5    # Unicast DHCP to server at 10.0.0.5

interface Vlan20
  ip address 10.1.20.1 255.255.255.0
  ip helper-address 10.0.0.5

# The DHCP server sees giaddr=10.1.10.1 or 10.1.20.1
# and allocates from the matching scope/pool

The DHCP server uses giaddr to determine which subnet pool to allocate from. Configure a matching scope for each VLAN's subnet in the DHCP server. Without giaddr, the server would have no idea which network the client is on.


Chapter 6

DHCP Reservations and Static Assignments

A network printer has a DHCP-assigned IP that changes every time it reboots after a power outage. Users cannot find it. The help desk spends 30 minutes per incident. The fix: a DHCP reservation. The printer keeps using DHCP, but the server always assigns the same IP to that specific MAC address. Same protocol simplicity for the printer; predictable address for the users.

MAC-Based Reservations

DHCP reservations bind a specific MAC address to a specific IP. The IP is allocated from the DHCP pool, but it is always given to that MAC. Configuration varies by server:

# ISC DHCP (dhcpd.conf)
host printer-a3 {
  hardware ethernet AA:BB:CC:DD:EE:FF;
  fixed-address 192.168.1.50;
  option host-name "printer-a3";
}

# Windows DHCP Server PowerShell
Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.50   -ClientId "AA-BB-CC-DD-EE-FF" -Description "Printer A3"

# Dnsmasq
dhcp-host=AA:BB:CC:DD:EE:FF,192.168.1.50,printer-a3

Client Identifier vs. MAC Address

DHCP uses the client's hardware address (MAC, chaddr) for identification by default. But clients can also send a Client Identifier (Option 61) — typically a string. This allows servers to identify clients by something other than MAC, useful for VMs with changing MAC addresses or virtual interfaces.

Dynamic DNS Updates

Modern DHCP servers (ISC DHCP, Windows DHCP) can update DNS records when leases are assigned. When a client gets IP 192.168.1.100 with hostname "laptop42", the DHCP server updates the DNS zone to add an A record for laptop42.corp.example.com. This keeps DNS in sync with DHCP assignments — critical for environments where hosts need to be reachable by name.


Chapter 7

DHCP Security: Attacks and Defenses

An attacker connects a laptop to a corporate network and runs a rogue DHCP server. The legitimate DHCP server is a few milliseconds away across the network. The rogue server is on the same switch — it responds faster. Within minutes, new clients connecting to the network receive the attacker's DNS server, pointing all name resolution to a server that returns forged responses. The attacker has compromised the entire network's DNS without touching a single server.

Rogue DHCP Server Attack

Any device on a network can run a DHCP server — there is no authentication in the protocol. A rogue DHCP server can:

— Assign arbitrary DNS servers → DNS hijacking, phishing, MITM

— Assign the attacker as default gateway → full traffic intercept

— Assign wrong subnet masks → network communication failures

— Assign the same IP to multiple clients → address conflict denial-of-service

DHCP Snooping: The Defense

DHCP snooping is a Layer 2 switch feature that validates DHCP messages and limits which ports can send DHCP server responses:

Trusted ports: uplinks to routers, DHCP servers, and aggregation switches. DHCP OFFER and ACK are allowed through.

Untrusted ports: access ports connected to end users. DHCP OFFER and ACK are dropped — only DISCOVER and REQUEST (client messages) are permitted. DHCP server responses from these ports are blocked.

# Cisco IOS DHCP snooping
ip dhcp snooping
ip dhcp snooping vlan 10,20,30

interface GigabitEthernet0/1   # uplink to DHCP server
  ip dhcp snooping trust

interface GigabitEthernet0/2   # access port (end user)
  # untrusted by default
  ip dhcp snooping limit rate 15  # rate limit: 15 DHCP pkt/s per port

DHCP Snooping Binding Table

DHCP snooping maintains a binding table: MAC address → IP address → VLAN → switch port → lease time. This table is consumed by other security features:

Dynamic ARP Inspection (DAI): validates that ARP replies map to binding table entries, preventing ARP spoofing.

IP Source Guard (IPSG): drops packets from ports where the source IP doesn't match the binding table, preventing IP spoofing.

DHCP Starvation Attack

An attacker sends thousands of DHCPDISCOVER messages with spoofed MAC addresses, exhausting the DHCP pool. Legitimate clients cannot get addresses (DHCPNAK or no response). Defense: DHCP snooping rate limiting per port, 802.1X port authentication before allowing DHCP traffic.

WARN: DHCP snooping must be enabled before devices connect to the network, or on a maintenance window — re-enabling it after the network is live requires careful handling of existing leases and the binding table (which does not survive reboots by default; configure write to flash or use an external database).

Chapter 8

PXE Boot: DHCP as Network Boot Infrastructure

A data center needs to provision 500 new servers. No one walks up to each server with a USB drive. Instead, the servers are configured to PXE boot: they broadcast a DHCPDISCOVER with a special vendor class identifier, receive options pointing to a TFTP server and bootloader filename, download the bootloader over UDP, and boot from a network-hosted OS image. DHCP is the first step in automated bare-metal provisioning.

PXE Boot DHCP Flow

1. Client broadcasts DISCOVER with Option 60 (Vendor Class Identifier) set to PXEClient:Arch:00000:UNDI:002001 (or similar, encoding architecture and network driver version).

2. DHCP server recognizes the PXE client and includes in the ACK:

Option 66: TFTP server hostname (where to download the bootloader)

Option 67: Boot filename (e.g., pxelinux.0 for BIOS, bootx64.efi for UEFI)

3. Client downloads the bootloader via TFTP (UDP port 69) from the specified server.

4. Bootloader may issue a second DHCP exchange (ProxyDHCP) for additional PXE-specific options.

5. Bootloader downloads OS image/kernel and boots.

DHCP and UEFI HTTP Boot

Modern UEFI systems support HTTP boot as an alternative to TFTP. DHCP delivers the boot URL via Option 67 as an HTTP/HTTPS URL (http://deploy.corp/grubx64.efi). The UEFI firmware fetches the bootloader via HTTP, enabling faster and more reliable delivery than TFTP (which uses unreliable UDP).


Chapter 9

DHCPv6: IPv6 Address Configuration

IPv6 was designed with stateless address autoconfiguration (SLAAC) built in — hosts generate their own addresses from the network prefix announced in Router Advertisements. DHCPv6 was added later for environments that need centralized address management, additional options, and client tracking. The two systems coexist in complex ways.

SLAAC vs. DHCPv6

SLAAC (Stateless Address Autoconfiguration, RFC 4862): router sends Router Advertisement (RA) with the /64 prefix. Host generates its interface ID using Modified EUI-64 (from MAC address) or a random stable address (RFC 7217). No server needed, no lease records, no central tracking. Address persists until RA stops.

DHCPv6 Stateful: like DHCPv4 — server maintains a lease database, assigns specific addresses from pools, records client MAC/DUID and assigned address. Enables per-host tracking and central address management.

DHCPv6 Stateless: the host uses SLAAC for its address but sends a DHCPv6 Information-Request to get other options (DNS, NTP, SIP servers) that SLAAC alone cannot provide.

The M and O Flags in Router Advertisements

Router Advertisements include two flags that tell hosts which method to use:

M flag (Managed): if set, hosts should use DHCPv6 for addresses.

O flag (Other): if set, hosts should use DHCPv6 for other configuration (DNS, etc.) even if using SLAAC for addresses.

M=0, O=0: pure SLAAC, no DHCPv6. M=0, O=1: SLAAC + stateless DHCPv6 for options. M=1, O=1: full stateful DHCPv6.

DHCPv6 Uses Multicast, Not Broadcast

IPv6 has no broadcast. DHCPv6 uses multicast: clients send to ff02::1:2 (All_DHCP_Relay_Agents_and_Servers, link-local multicast). Servers respond with unicast back to the client's link-local address. Relay agents forward using ff05::1:3 (site-scoped multicast) to reach servers across routers.

# DHCPv6 message types
SOLICIT (1)         → Like DISCOVER — client looks for servers
ADVERTISE (2)       ← Like OFFER — server responds
REQUEST (3)         → Client requests address from chosen server
REPLY (7)           ← Server confirms
RENEW (5)           → Client renews lease directly with server
REBIND (6)          → Client broadcasts to any server (T2 expired)
RELEASE (8)         → Client releases address
INFORMATION-REQUEST (11) → Stateless: only wants options, not address

Chapter 10

DHCP Failover and High Availability

A single DHCP server goes down at 2 AM for unplanned maintenance. By morning, every device whose lease expires before the server comes back is offline. A company with a 12-hour lease time and 8-hour server downtime loses all devices in the last 4 hours. The solution is DHCP failover — two servers, synchronized state, automatic takeover.

ISC DHCP Failover Protocol

ISC DHCP implements a load-sharing/failover protocol (RFC 3074 / ISC proprietary for DHCPv4). Two servers — primary and secondary — share a pool and synchronize lease states over TCP. In normal operation, both servers actively allocate from their half of the pool. If one fails, the other takes over the full pool after a configured split timeout.

# Primary dhcpd.conf failover
failover peer "dhcp-failover" {
  primary;
  address 10.0.0.5;
  port 519;
  peer address 10.0.0.6;
  peer port 519;
  max-response-delay 30;
  max-unacked-updates 10;
  load balance max seconds 3;
  split 128;               # 50/50 split of addresses
  mclt 1800;               # Max Client Lead Time: 30 min
}

subnet 192.168.1.0 netmask 255.255.255.0 {
  pool {
    failover peer "dhcp-failover";
    range 192.168.1.100 192.168.1.200;
  }
  option routers 192.168.1.1;
}

Windows DHCP Failover

Windows Server 2012+ includes built-in DHCP failover configured via the DHCP Manager GUI or PowerShell. It supports hot standby (one active, one standby) and load balance (both active, 50/50 split by default). State replication is automatic.

# Windows PowerShell DHCP failover
Add-DhcpServerv4Failover   -ComputerName dhcp1.corp   -Name "DHCP-Failover"   -PartnerServer dhcp2.corp   -ScopeId 192.168.1.0   -LoadBalancePercent 50   -MaxClientLeadTime (New-TimeSpan -Hours 1)   -AutoStateTransition $true

Chapter 11

DHCP in Cloud and Containerized Environments

In AWS, every EC2 instance gets an IP from a DHCP server managed by the hypervisor — there is no option to disable this. The DHCP server is behind the VPC router (169.254.169.254), responding in microseconds before the instance boot completes. Kubernetes runs its own DHCP-like system (IPAM plugins) to assign pod IPs from cluster subnets. The protocol and its concepts permeate every layer of modern infrastructure.

AWS VPC DHCP

Every VPC has a DHCP options set that specifies: domain-name, domain-name-servers, ntp-servers, netbios-name-servers. The default options push AmazonProvidedDNS (VPC resolver at base VPC CIDR +2, e.g., 10.0.0.2). Custom options sets can override to point to private DNS resolvers. The DHCP server itself is the AWS-managed router; you cannot change it.

Kubernetes IPAM and CNI Plugins

Kubernetes pod networking uses a CNI (Container Network Interface) plugin to assign IPs. Some CNIs (Flannel, Calico, Cilium) use their own IPAM without DHCP; others (like Multus with Whereabouts) support DHCP delegation for specific pod NICs. The concepts remain the same: IP pool management, lease allocation, conflict avoidance — just implemented in software without the UDP protocol overhead.

Docker and DHCP

Docker's bridge network uses its own built-in DHCP-like system (implemented in libnetwork) to assign IPs to containers on the docker0 bridge. The macvlan driver allows containers to appear as physical hosts on the network and receive IPs from the upstream DHCP server — useful for containers that need to be reachable at a specific network address.


Chapter 12

DHCP Server Configuration Examples

Configuration is where theory meets practice. A DHCP server with wrong options causes mysterious network failures: DNS that doesn't resolve, routes that don't work, NTP drift that breaks certificate validation. Getting the options right — and in the right scope — is as important as the protocol mechanics.

ISC DHCP (dhcpd.conf)

# /etc/dhcp/dhcpd.conf
default-lease-time 86400;      # 24 hours
max-lease-time 604800;         # 7 days maximum
authoritative;                 # This server is authoritative for these networks

option domain-name "corp.example.com";
option domain-name-servers 10.0.0.53, 10.0.0.54;
option ntp-servers 10.0.0.123;

# Production subnet
subnet 10.1.10.0 netmask 255.255.255.0 {
  range 10.1.10.50 10.1.10.200;
  option routers 10.1.10.1;
  option broadcast-address 10.1.10.255;
  # Classless static routes: 10.2.0.0/16 via 10.1.10.254
  option rfc3442-classless-static-routes 16, 10, 2, 10.1.10.254;
}

# Guest VLAN (shorter lease, no internal DNS)
subnet 10.1.99.0 netmask 255.255.255.0 {
  range 10.1.99.10 10.1.99.250;
  option routers 10.1.99.1;
  default-lease-time 3600;     # 1 hour for guest
  option domain-name-servers 8.8.8.8, 1.1.1.1;  # Public DNS only
}

# Static reservation
host fileserver {
  hardware ethernet DE:AD:BE:EF:00:01;
  fixed-address 10.1.10.20;
  option host-name "fileserver";
}

Dnsmasq (Lightweight, Common in Home/SMB)

# /etc/dnsmasq.conf
interface=eth0
dhcp-range=192.168.1.100,192.168.1.200,24h
dhcp-option=3,192.168.1.1          # default gateway
dhcp-option=6,8.8.8.8,8.8.4.4     # DNS servers
dhcp-option=42,192.168.1.1         # NTP server
dhcp-host=AA:BB:CC:DD:EE:FF,192.168.1.10,printer,infinite  # reservation

Chapter 13

Misconceptions About DHCP

MISCONCEPTION: "DHCP assigns permanent addresses." — DHCP assigns leases with expiry times. Unless you configure a reservation (fixed address bound to a MAC), the IP is returned to the pool when the lease expires. That said, most clients renew their leases successfully and effectively keep the same IP for a long time — but this is a side effect of lease renewal, not guaranteed permanence.
MISCONCEPTION: "DHCP is not secure because it has no authentication." — Plain DHCP (RFC 2131) has no client or server authentication. However, DHCP snooping on managed switches, Dynamic ARP Inspection, and IP Source Guard together create a robust security posture at Layer 2. The absence of cryptographic authentication in the protocol does not mean DHCP environments cannot be secured.
MISCONCEPTION: "Option 3 (default gateway) can be overridden by Option 121." — According to RFC 3442, clients that support Option 121 MUST use Option 121 routes and MUST ignore Option 3 for routing to destinations covered by Option 121 routes. If Option 121 contains a 0.0.0.0/0 route, it overrides the default gateway entirely — this is the basis of the TunnelVision VPN bypass attack (CVE-2024-3661).
MISCONCEPTION: "DHCP and DNS are independent systems." — In modern networks they are tightly coupled. DHCP servers typically perform dynamic DNS updates (DDNS) when assigning leases, so that hostnames resolve to their current DHCP-assigned IPs. Without this integration, DNS records become stale. Windows Active Directory environments depend on this integration for workstation name resolution.
MISCONCEPTION: "DHCPv6 replaces IPv4 DHCP in all IPv6 deployments." — Many IPv6 deployments use SLAAC (stateless address autoconfiguration) rather than DHCPv6 for addresses, potentially supplemented by stateless DHCPv6 for options like DNS. Whether to use DHCPv6, SLAAC, or both is a network design decision controlled by the M/O flags in Router Advertisements. DHCPv6 is optional in IPv6 networks, whereas DHCPv4 is essentially universal in IPv4 networks.

Chapter 14

IQ Depth Check: How Deep Does Your DHCP Knowledge Go?

Beginner
What are the four steps of the DHCP DORA process?
DISCOVER — client broadcasts to find DHCP servers (source: 0.0.0.0, destination: 255.255.255.255). OFFER — each server responds with a proposed IP and configuration. REQUEST — client broadcasts selecting one server's offer (all servers hear this; unselected servers release their reserved IPs). ACK — selected server confirms the lease; client configures its interface.
Intermediate
What are T1 and T2 timers, and what happens at each?
T1 (Option 58, typically 50% of lease): client enters RENEWING state and unicasts a DHCPREQUEST to its server to extend the lease. If ACK received, lease resets. T2 (Option 59, typically 87.5% of lease): client enters REBINDING state after server hasn't responded to T1 renewal. Client now broadcasts REQUEST to any DHCP server. Any server can ACK and extend. If lease expires without any ACK, client releases the IP and restarts DORA.
Senior
Explain DHCP snooping and what other security features depend on it.
DHCP snooping is a switch feature that classifies ports as trusted (uplinks to servers/routers) or untrusted (access ports). On untrusted ports, it drops DHCP OFFER and ACK messages, blocking rogue DHCP servers. It builds a binding table mapping MAC+IP+VLAN+port+lease-time from observed legitimate DHCP exchanges. Dynamic ARP Inspection uses this table to validate ARP replies — an ARP mapping not matching the binding table is dropped, preventing ARP spoofing. IP Source Guard uses the binding table to create per-port ACLs that drop packets where source IP doesn't match the binding — preventing IP spoofing. Together these three features form a complete Layer 2 security framework.
PhD
Why does DHCP run over UDP instead of TCP, and how does RFC 3442 Option 121 create the TunnelVision VPN bypass vulnerability?
DHCP must operate before the client has a valid IP address. TCP's three-way handshake requires maintaining state (SYN-SENT, SYN-RECEIVED, ESTABLISHED) with specific source/destination IP addresses — impossible when the source IP is 0.0.0.0 and must be bound to a socket. UDP allows sending datagrams with any source IP without connection state, enabling DHCP's broadcast-based discovery. The kernel can receive the UDP response even with no assigned IP because the DHCP client binds to port 68 before having an address, and the response is delivered to the MAC address layer. RFC 3442 states that Option 121 classless routes, when present, supersede Option 3 (default gateway). A malicious DHCP server (or a server on the same network as a VPN client) can push Option 121 with a /32 route for the VPN server's IP pointing to the local gateway instead of the VPN tunnel. The OS routes VPN handshake traffic directly to the gateway, bypassing the tunnel. The VPN appears connected (the tunnel is up) but traffic leaks in plaintext. Mitigations: VPN clients that explicitly ignore Option 121 (requires vendor fix), network-level firewall rules, or routing-based VPN architectures that don't rely on policy routing.

🎯 Key Takeaways

  • DHCP DORA: Discover (client broadcast, 0.0.0.0→255.255.255.255), Offer (server proposes IP), Request (client selects, all servers hear), ACK (server confirms lease).
  • DHCP uses UDP (not TCP) because clients have no IP address before DHCP completes — TCP connection establishment requires valid source IPs.
  • T1 (50%) triggers unicast renewal to the original server; T2 (87.5%) triggers broadcast rebinding to any server; lease expiry forces DORA restart.
  • DHCP options (TLV-encoded, 0–255 codes) deliver subnet mask, gateway, DNS, NTP, domain, static routes, PXE boot parameters, and vendor-specific data.
  • Option 121 (classless static routes) overrides Option 3 (default gateway) per RFC 3442 — enabling the TunnelVision VPN bypass attack (CVE-2024-3661).
  • DHCP relay agents (ip helper-address) forward broadcasts as unicasts to centralized DHCP servers; giaddr identifies the client subnet for pool selection.
  • DHCP snooping blocks rogue DHCP servers by dropping OFFER/ACK on untrusted ports; its binding table powers Dynamic ARP Inspection and IP Source Guard.
  • DHCPv6 uses multicast (ff02::1:2) instead of broadcast, and coexists with SLAAC; M/O flags in Router Advertisements control which method clients use.
  • PXE boot uses Options 43, 60, 66, 67 to deliver TFTP server and bootloader filename; UEFI HTTP boot delivers a URL instead.
  • DHCP failover (ISC or Windows) synchronizes lease state between two servers; MCLT (Max Client Lead Time) is the maximum time a server can extend a lease without the peer confirming.
Share

Discussion

0

Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.

Continue with GitHub
Loading...