Back to blog
4 min read

DHCP: How Devices Get Their IP Addresses

The DORA process explained, lease lifecycle, and what I've learned from troubleshooting DHCP issues in production.

NetworkingDHCP

Static IP assignment doesn't scale. I tried it once on a network with 50 devices - tracking which IP went where became a spreadsheet nightmare, and duplicate addresses caused random connectivity issues. DHCP automates all of this.

What DHCP Does

When a device connects to a network, DHCP automatically provides:

  • IP address
  • Subnet mask
  • Default gateway
  • DNS servers
  • Lease duration

No manual configuration needed. The device just works.

The DORA Process

DHCP uses a four-step handshake called DORA:

1. Discover - New device broadcasts "I need an IP address" to everyone on the network segment. It uses 0.0.0.0 as source since it doesn't have an address yet.

2. Offer - DHCP servers respond with available addresses from their pools. The offer includes all the network configuration.

3. Request - Device picks one offer (usually the first) and broadcasts "I'm taking this one." This tells other servers to release their offers.

4. Acknowledge - Selected server confirms the assignment. Device configures its interface and starts communicating.

Lease Lifecycle

DHCP addresses aren't permanent - they're leased for a specific duration.

T1 timer (50%) - At half the lease time, the device tries to renew directly with the original server. If successful, the lease resets.

T2 timer (87.5%) - If the original server doesn't respond, the device broadcasts to any available DHCP server. Failover mechanism.

Expiration - No response? The device loses its IP. You'll see it grab a 169.254.x.x address (APIPA) - that's the sign DHCP failed.

Production Considerations

Redundancy matters. I always deploy DHCP with failover. Options:

  • Split scope (80/20 between servers)
  • Hot standby
  • Load balancing

DHCP relay for multi-subnet networks. DHCP broadcasts don't cross routers. Configure ip helper-address on routers to forward requests to central DHCP servers.

Lease duration trade-offs:

  • Short leases (1-4 hours) - Good for guest networks, high device turnover
  • Long leases (days/weeks) - Reduces DHCP traffic, better stability during server outages

Troubleshooting

When a device gets 169.254.x.x, DHCP failed. Check:

  1. Is the DHCP server running?
  2. Is there a route between client and server? (relay configured?)
  3. Is the address pool exhausted?
  4. Are there network issues blocking UDP 67/68?
# Windows - release and renew
ipconfig /release
ipconfig /renew

# Linux - restart DHCP client
sudo dhclient -r
sudo dhclient

# Check DHCP lease info
cat /var/lib/dhcp/dhclient.leases

Key Takeaways

  • DORA: Discover โ†’ Offer โ†’ Request โ†’ Acknowledge
  • 169.254.x.x addresses mean DHCP failed - investigate immediately
  • Lease timers T1 (50%) and T2 (87.5%) handle renewal and failover
  • Always run redundant DHCP in production
  • Multi-subnet networks need DHCP relay configured on routers
BT

Written by Bar Tsveker

Senior CloudOps Engineer specializing in AWS, Terraform, and infrastructure automation.

Thanks for reading! Have questions or feedback?