How IP Addresses Work
How Your Device Gets an IP Address: DHCP Explained
Plug in a laptop or join a Wi-Fi network and it just works — an address appears as if by magic. That magic has a name: DHCP.
What DHCP does
The Dynamic Host Configuration Protocol automatically assigns IP addresses and related network settings to devices as they join a network. Without it, someone would have to configure every phone, laptop, and gadget by hand — an impossible task on a network of any size.
The four-step handshake
When a device joins a network, it negotiates with the DHCP server (usually built into your router) in four quick steps, often remembered as DORA:
- Discover — the device broadcasts, "Is there a DHCP server here?"
- Offer — a server replies with an available address.
- Request — the device says, "I'll take that one."
- Acknowledge — the server confirms and records the lease.
This all happens in a fraction of a second.
What else DHCP hands out
Beyond the IP address, DHCP typically provides the subnet mask, the default gateway (the router's address), and DNS server addresses. That last item is why joining a network gives you working name resolution without touching any settings.
Leases
Addresses are handed out as leases with an expiration time. A device renews its lease periodically; if it leaves and does not return, the address eventually returns to the pool for reuse. This is exactly why home IP addresses are usually dynamic — DHCP is designed to reassign them.
Reservations: predictable addresses
You can tell a router to always give a specific device the same address — a DHCP reservation, tied to the device's hardware (MAC) address. This is handy for a printer, server, or security camera that other devices need to find reliably, combining the convenience of DHCP with the stability of a fixed address.