DHCP — Addresses on Arrival
A new designer joins Kite Studio, opens her laptop, connects to the Wi-Fi and is online within seconds. Nobody typed an IP address, a mask, a gateway or a DNS server into her laptop. A service called DHCP handed her all four, on loan.
The rule
DHCP lends settings in four steps: Discover, Offer, Request, Acknowledge.
The job. DHCP (Dynamic Host Configuration Protocol) automatically gives each new host its network settings:
- an IP address from a pool (Kite Studio's pool is
192.168.10.100to192.168.10.199); - the subnet mask (
255.255.255.0); - the default gateway (
192.168.10.1); - the DNS servers to use;
- a lease time, after which the address must be renewed or returned.
At Kite Studio the router runs the DHCP server. Devices that must never move, such as files (.20) and the printer (.30), get fixed addresses outside the pool, either typed in by hand or as a reservation that always hands the same address to the same MAC.
The four steps (DORA). A brand-new laptop has no address and does not know where the server is, so it starts by shouting:
- Discover — the client broadcasts "is there a DHCP server?"
- Offer — the server offers a free address and settings.
- Request — the client asks formally for that offer (also by broadcast, so any other server that made an offer knows it was declined).
- Acknowledge — the server confirms, and the lease starts.
DHCP runs over UDP: servers listen on port 67, clients on port 68. Because Discover is a broadcast, it stops at the router; a network without its own DHCP server needs a relay on the router to forward requests to one.
No server? A laptop that gets no answer gives itself a link-local address from 169.254.0.0/16. It can then talk only to neighbours on the same link — a clear sign DHCP failed.