DHCP (Dynamic Host Configuration Protocol)

DHCP (Dynamic Host Configuration Protocol) automatically gives a device joining a network an IP address, subnet mask, default gateway and DNS server, so nobody configures each device by hand. A DHCP server leases addresses from a pool for a limited time through four steps known as DORA: Discover, Offer, Request and Acknowledge.

4 min read

DHCP (Dynamic Host Configuration Protocol) is how a device joining a network, a laptop connecting to WiFi, a phone joining a cellular network, gets an IP address, a subnet mask, a default gateway, and a DNS server address automatically, without a person typing any of it in manually.

How it works

A DHCP server holds a pool of available IP addresses for a given network and hands one out (leases it) to a device for a limited time. When the lease is about to expire, the device asks to renew it; if it doesn't renew, the address eventually goes back into the pool for someone else to use.

The DHCP process, step by step (DORA)

  1. Discover. The joining device has no IP address yet, so it broadcasts a DHCPDISCOVER message to the entire local network, asking "is there a DHCP server here?"
  2. Offer. Any DHCP server that receives the broadcast responds with a DHCPOFFER, proposing an available IP address along with the subnet mask, gateway, and lease time.
  3. Request. The device picks one offer (usually the first one it receives) and broadcasts a DHCPREQUEST, formally asking to use that specific address. This is broadcast, not sent directly to just that server, so any other DHCP servers that made offers know their offer wasn't accepted and can release those addresses back to their own pools.
  4. Acknowledge. The chosen server sends a DHCPACK, confirming the lease. The device now configures itself with that IP address, subnet mask, gateway, and DNS server, and can start using the network.

This four-step sequence is commonly remembered by the acronym DORA.

A worked example

A laptop joins an office WiFi network. It broadcasts a DHCPDISCOVER. The office's DHCP server, which manages the pool 192.168.1.100 through 192.168.1.200, responds with a DHCPOFFER of 192.168.1.147, subnet mask 255.255.255.0, gateway 192.168.1.1, DNS server 192.168.1.1, and a lease time of 24 hours. The laptop sends a DHCPREQUEST for 192.168.1.147, the server DHCPACKs it, and the laptop is now fully configured and can reach the internet, all without anyone typing a single number into a settings screen.

12 hours into the lease (the halfway point, a common renewal trigger), the laptop quietly sends a renewal request directly to the same server, and gets the same address reassigned with a fresh 24-hour lease, all invisibly in the background.

Where this matters in real systems

Nearly every home router, corporate network, and public WiFi hotspot runs a DHCP server, which is exactly why devices "just work" the moment you connect to a new network rather than needing manual IP configuration. This scales to genuinely large networks too: enterprise networks with thousands of devices, and even ISPs handing out addresses to home routers, use DHCP (or close variants of it) to manage address allocation at scale. The alternative, statically assigning an IP address by hand to every device on a network, is really only used today for servers and infrastructure devices that need a permanently fixed, predictable address.

What interviewers actually ask about DHCP

  • "What problem does DHCP solve?" Automatically assigning IP addresses and network configuration to devices, instead of requiring manual configuration on every device that joins a network.
  • "Walk me through the DHCP process." DORA: Discover (broadcast, looking for a server), Offer (server proposes an address), Request (device asks to use it), Acknowledge (server confirms the lease).
  • "Why is the Request step broadcast instead of sent directly to the chosen server?" So that any other DHCP servers who made competing offers can see their offer wasn't accepted and release those addresses back into their own pool.
  • "What happens when a DHCP lease expires without renewal?" The address returns to the server's available pool and can be assigned to a different device; the original device loses its network configuration until it requests a new one.

Key takeaways

  • DHCP automatically assigns IP addresses and network settings to devices joining a network.
  • The process follows four steps, commonly remembered as DORA: Discover, Offer, Request, Acknowledge.
  • Addresses are leased for a limited time and renewed automatically before expiry.
  • DHCP is why devices can join almost any network and get online without manual IP configuration.
All 101 Computer Networks interview questions

More in Application Layer

Log in to save which topics you've read across every subject.

Frequently asked questions

What problem does DHCP solve?

Automatically assigning IP addresses and network configuration to devices, instead of requiring manual configuration on every device that joins a network.

Walk me through the DHCP process.

DORA: Discover (broadcast, looking for a server), Offer (server proposes an address), Request (device asks to use it), Acknowledge (server confirms the lease).

Why is the Request step broadcast instead of sent directly to the chosen server?

So that any other DHCP servers who made competing offers can see their offer wasn't accepted and release those addresses back into their own pool.

What happens when a DHCP lease expires without renewal?

The address returns to the server's available pool and can be assigned to a different device; the original device loses its network configuration until it requests a new one.