IP Address & Network

DHCP (Dynamic Host Configuration Protocol)

About 4 min read

What Is DHCP

DHCP (Dynamic Host Configuration Protocol) is a protocol that automatically assigns network settings - such as an IP address, subnet mask, default gateway, and DNS server address - to devices that connect to a network.

Without DHCP, you would need to manually configure an IP address on every device that connects to the network. The reason you can simply connect to a home router via Wi-Fi and immediately use the internet is that the router's DHCP server function is automatically distributing IP addresses in the background.

The DHCP Workflow - The DORA Process

IP address acquisition via DHCP involves a four-step message exchange known as DORA.

  1. Discover: When a device connects to the network, it sends a broadcast message asking, "Is there a DHCP server?" At this point, the device has no IP address.
  2. Offer: The DHCP server proposes an available IP address. If multiple DHCP servers exist, multiple Offers may arrive.
  3. Request: The device selects one Offer and requests, "Please give me this IP address."
  4. Acknowledge: The DHCP server confirms the assignment and responds with detailed information including the lease period.

This entire exchange typically completes in a few hundred milliseconds. The reason you can use the internet within seconds of connecting to Wi-Fi is thanks to this fast DORA process.

Lease Periods and IP Address Management

IP addresses assigned by DHCP have a "lease period." When the lease expires, the device requests a renewal from the DHCP server.

  • Home routers: Lease periods are typically 24 hours to several days. Set longer because device turnover is low.
  • Public Wi-Fi: Lease periods are around 1-2 hours. Set shorter to efficiently reclaim addresses due to high user turnover.
  • Enterprise networks: Typically 8-24 hours. Determined by the balance between device count and address pool size.

For devices that need a fixed IP address (printers, NAS, servers, etc.), use DHCP's "static assignment (reservation)" feature. By linking a device's MAC address to an IP address, you can maintain the convenience of DHCP while always assigning the same IP address.

DHCP Troubleshooting

Many network connectivity issues are caused by DHCP. Here are common problems and solutions.

  • A 169.254.x.x address is assigned: When there is no response from the DHCP server, the OS performs self-assignment using APIPA (Automatic Private IP Addressing). Try restarting the router, checking the LAN cable, or reconnecting to Wi-Fi.
  • IP address conflicts: If a manually configured device's address overlaps with the DHCP assignment range, the same IP address may be assigned to two devices. Separate the DHCP assignment range from the manually configured range.
  • Rogue DHCP server: If an unintended DHCP server exists on the network, incorrect settings may be distributed. Enterprise networks use DHCP snooping as a countermeasure.

On Windows, you can release and renew a DHCP lease with ipconfig /release and ipconfig /renew. On macOS/Linux, the equivalent commands are sudo dhclient -r and sudo dhclient.

To learn more about this topic, see What Is an IP Address? How It Works and How to Check Yours.

Common Misconceptions

Using DHCP means your IP address changes every time
DHCP servers tend to reassign the same IP address within the lease period. In home environments, the same IP address is usually maintained unless the router is restarted. For guaranteed fixed assignment, use static reservation.
DHCP only distributes IP addresses
In addition to IP addresses, DHCP distributes subnet masks, default gateways, DNS servers, NTP servers, domain names, and many other network configuration settings all at once.
Share

Related Terms

Related Articles