Lesson 6 of 6 · 10 min
How DHCP gives your device an IP address
Join a four-message conversation, follow an address offer into a lease, and see how renewal keeps your connection configured.
By Calxo AI · Updated
You join Wi-Fi. Who fills in the address?
You enter the Wi-Fi password, wait a moment, and open a website. Somewhere in that short pause, your laptop usually picks up an IP address, a subnet mask, a default gateway, and information about DNS servers. You did not type any of them. Who did the paperwork?
On many IPv4 networks, that job belongs to DHCP: Dynamic Host Configuration Protocol. A device asks for configuration, and a DHCP server supplies it. At home the server is often built into the router. In an office it might be a separate service.
Think of a hotel reception desk. The receptionist assigns an available room and tells you when your booking ends. DHCP assigns an address for a period called a lease. The analogy helps, but a lease can be renewed without changing the address or interrupting a working connection.
Connecting to Wi-Fi and getting an IPv4 configuration are separate steps. Wi-Fi association and authentication establish the link; DHCP then helps configure IP on that link. A Wi-Fi icon alone does not prove that all of this succeeded.
Four messages, one new lease
Let’s follow a laptop joining a simple home LAN without a usable remembered lease. Our server can offer 192.168.1.104. The familiar four-message exchange is often remembered as DORA.
1 · Laptop → local network
Discover“Is a DHCP server available?”
2 · DHCP server → laptop
Offer“I can offer 192.168.1.104.”
3 · Laptop → local network
Request“I would like that offer from this server.”
4 · DHCP server → laptop
Acknowledge“Confirmed: here is your lease and configuration.”
- Discover: the laptop asks whether a DHCP server is available. Without a usable address, it can broadcast using source
0.0.0.0and destination255.255.255.255. - Offer: a server proposes an address and configuration. More than one server can respond. An offer is a proposal, not the final lease.
- Request: the client selects an offer. In this initial exchange, it broadcasts DHCPREQUEST identifying the chosen server and requested address.
- Acknowledge: the chosen server confirms with DHCPACK. The client completes its checks before using the configuration. If it finds the address already in use, it declines the address and tries again.
DHCPv4 uses UDP: the server listens on port 67 and the client on 68. Server replies may be broadcast or unicast depending on client state, flags, and delivery arrangements. A DHCP relay can carry requests to a server on another subnet; ordinary routers do not simply forward the original local broadcast everywhere.
The address comes with useful instructions
| Setting | Example | Job |
|---|---|---|
| IPv4 address | 192.168.1.104 | Identifies this interface on the LAN |
| Subnet mask | 255.255.255.0 (/24) | Identifies the local subnet boundary |
| Default gateway | 192.168.1.1 | Next hop for destinations using the default route |
| DNS server | 192.168.1.1 | Resolver to ask about domain names |
| Lease duration | 8 hours | How long the allocation is valid without extension |
Here the home router is both gateway and DNS forwarder, so those two entries match. They do not have to match in another network. DHCP can supply these settings through options; actual configuration depends on the server and client.
DHCP does not look up website names itself—that is DNS’s job. It does not share your public IPv4 address either—that is the separate translation job covered in our NAT lesson.
A pool is smaller than the whole subnet
Suppose the LAN is 192.168.1.0/24, but the administrator offers only .100 through .119 through DHCP. That is 20 addresses, because both endpoints count: 119 − 100 + 1 = 20.
All addresses below begin with 192.168.1.
The /24 has more conventional host addresses than this pool. Addresses outside the pool may be set aside for routers, servers, or other purposes. A reservation associates an address with a client identity in the server’s configuration; manual static configuration sets it on the device. Plan both carefully to avoid conflicts.
If the pool is full, the Wi-Fi link may still connect while a new client cannot obtain a lease. That is one possible failure, not a diagnosis you can make from the Wi-Fi icon alone.
An eight-hour lease does not mean an eight-hour cutoff
A client normally tries to extend a lease before it expires. Unless the server supplies different timer values, T1 is halfway through the lease and T2 is seven eighths of the way through.
- 0 hours: lease begins.
- 4 hours · T1: try renewing with the leasing server.
- 7 hours · T2: if still unanswered, broadcast a request to any suitable server.
- 8 hours: if no extension succeeds, stop using the expired address and seek configuration again.
Renewing an existing lease usually uses DHCPREQUEST and DHCPACK rather than repeating every initial DORA step. A returning device can also request a remembered address. The four-message story is a useful first lesson, not every possible DHCP exchange.
Connected, but still waiting for an address?
Check the device’s assigned address, mask, gateway, and DNS information before changing anything. A missing lease could involve an unavailable server, an exhausted pool, a VLAN or relay problem, or blocked traffic. A complete lease with failed web browsing could instead point to DNS, routing, a captive portal, or an upstream problem.
Some systems choose an IPv4 link-local address in 169.254.0.0/16 when no ordinary IPv4 configuration is available. That can be a clue to investigate DHCP, but it is not proof of one specific fault and is not an ordinary Internet-routable address. Do not fix it by guessing an unused address.
DHCPv4 and DHCPv6 are different protocols. IPv6 can also use SLAAC and Router Advertisements. And DHCP configuration does not authenticate a network’s intentions: unmanaged or rogue servers can supply unwanted settings.
Use the explorer below to watch the conversation and change the lease duration. Then try the quiz. You are ready when you can distinguish an offer, a confirmed lease, and a renewal.
Try it · Join the conversation
DHCP conversation explorer
Follow a new IPv4 lease on one LAN. This is an illustration, not a live network test.
Laptop → local network
Is a DHCP server available?
Starting without an IPv4 lease, the client sends DHCPDISCOVER. In this direct-LAN example it uses source 0.0.0.0 and broadcasts to 255.255.255.255.
Looking for a server
The new lease is not confirmed yet.
Default example: T1 at 4 hours · T2 at 7 hours · Expiry at 8 hours.
Times are relative to the lease start. Server-supplied timers can differ. A successful renewal resets the lease timing; expiry only happens if the lease is not extended.
Check your understanding
Choose an answer for every question, then check your work. You can retry as often as you like.
Sources and scope
This lesson covers an illustrative initial DHCPv4 lease, a sample address pool, and default lease timer fractions. Actual options, renewal timers, relay paths, and client behaviour depend on the network.
- RFC 2131 — DHCPv4 exchanges, allocation, and renewal
- RFC 2132 — DHCP options for masks, routers, DNS, and leases
- Microsoft Learn — DHCP server overview
- RFC 3927 — IPv4 link-local addressing