← Lessons

quiz vs the machine

Silver1130

Networking

How DHCP Assigns Addresses

Watch a new device negotiate an IP address and settings the moment it joins a network.

4 min read · intro · beat Silver to climb

Configuration Without Manual Work

When a device joins a network it needs an IP address, a subnet mask, a default gateway, and DNS servers. Setting these by hand on every device does not scale. The Dynamic Host Configuration Protocol, or DHCP, hands them out automatically.

The Four Step Exchange

DHCP uses a four message dance often remembered as discover offer request acknowledge.

  • The client broadcasts a discover because it has no address yet.
  • One or more servers reply with an offer of an address and settings.
  • The client broadcasts a request accepting one specific offer.
  • The chosen server sends an acknowledge confirming the lease.

Leases

An address is granted as a lease for a limited time. The client must renew before the lease expires, usually contacting the server at the halfway point. If it leaves the network, the address eventually returns to the pool for reuse.

What Else It Delivers

Beyond an address, DHCP supplies the subnet mask, the default gateway for off network traffic, and the DNS servers to resolve names. This is why a laptop can join a new network and reach the internet with no manual setup.

Key idea

DHCP leases an IP address and network settings through a discover offer request acknowledge exchange so devices configure themselves automatically when they join a network.

Check yourself

Answer to earn rating on the learn ladder.

1. What is the correct order of the DHCP messages?

2. Why must a DHCP client renew its lease?