DHCP: how a server automatically gets its network settings
Quick answer
DHCP (Dynamic Host Configuration Protocol) automatically hands a device joining a network its IP address, subnet mask, gateway and DNS servers, rather than someone typing all of that in by hand on every machine. A device broadcasts a request when it joins, a DHCP server offers it an address and the rest of the settings, and the device accepts them, usually for a defined lease period rather than permanently.
The problem it solves
Every device on a network needs a consistent set of basics before it can do anything useful: an IP address of its own, a subnet mask describing which other addresses count as "local", a gateway address for reaching anything outside the local network, and one or more DNS servers for turning names into addresses. Setting all of that by hand on every device that joins a network works, but it doesn't scale, and it's easy to get wrong, two devices with the same address by mistake, one missing a DNS server, one pointed at the wrong gateway. DHCP exists so a device can join a network and get correct, consistent settings automatically, without a person configuring it individually.
The exchange, conceptually
The mechanics vary slightly by implementation, but the shape of it is consistent:
The device asks
A device joining the network, and not yet knowing anything about it, broadcasts a request onto the local segment asking whether a DHCP server is present and can help.
The server offers
A DHCP server listening on that network responds with an offer: an available IP address, plus the subnet mask, gateway and DNS servers the device should use.
The device accepts
The device accepts the offer and starts using those settings. The server records that the address is now in use, so it won't be offered to anything else at the same time.
The lease expires, or renews
The assignment is typically a lease for a defined period, not a permanent grant. Before the lease runs out, the device usually asks to renew it, and normally keeps the same address if nothing else has claimed it in the meantime. If a device disconnects and doesn't renew, the address eventually becomes available for something else.
DHCP versus static configuration
A static configuration is the alternative: the IP address and other settings are set by hand, once, and don't change on their own. Each approach suits a different situation.
| DHCP | Static configuration | |
|---|---|---|
| How the address is set | Automatically, by a DHCP server, on joining the network | Manually, once, on the device itself |
| Does the address change | Can, particularly after a lease expires or the device rejoins later | No, stays fixed until someone changes it |
| Best suited to | Client devices that come and go: laptops, phones, anything that joins and leaves a network over time | Servers, and anything else that needs a guaranteed, unchanging address other systems rely on finding it at |
The practical reason servers usually run static configuration rather than DHCP is dependency: other systems, DNS records, firewall rules, monitoring, all typically refer to a server by a specific address, and an address that could quietly change under a lease renewal breaks all of that silently. See Static IP vs. dynamic IP: what's actually different for that distinction in more detail.
Where this fits on a wider network
DHCP is one of several pieces that make a network usable end to end, alongside the routing, addressing and gateway structure it hands out settings for in the first place. See Worldstream network architecture for how those pieces fit together more broadly.