← Module 05 · Application Layer & Name Resolution

DHCP Process (DORA)

How a device with no IP (Internet Protocol) address yet gets one automatically, in exactly four steps, most of them broadcasts.

A walk-in guest with no reservation

Picture a traveler arriving at a row of hotels with no reservation, asking loudly enough for every hotel on the street to hear: "does anyone have a room?" That's DHCP's (Dynamic Host Configuration Protocol's) entire opening move, and it has to be shouted, since the device doesn't have an IP address yet and can't address a single specific server directly. One hotel calls back: "yes, room 204 is free, here are the house rules." The traveler shouts their acceptance loud enough for every other hotel to hear too, in case more than one offered a room, so the others know to stop holding theirs. The chosen hotel confirms: checked in.

DORA: Discover, Offer, Request, Acknowledge

LOCAL SEGMENT (broadcast domain) CLIENT SERVER 1. DISCOVER: client broadcasts to the whole segment "Anyone have an IP for me?" (UDP :68 → :67) 2. OFFER: a DHCP server broadcasts back 203.0.113.50, lease, gateway, DNS (UDP :67 → :68) 3. REQUEST: client broadcasts its choice "I'll take .50", other servers back off (UDP :68 → :67) 4. ACKNOWLEDGE: the chosen server confirms Lease active until it needs renewing (UDP :67 → :68)
All four DORA messages are typically broadcasts on the local segment. The client has no IP yet to unicast with, and the broadcast Request specifically lets any other DHCP server that made an offer know it lost.
StepDirectionBroadcast?UDP port (src → dst)Contains
DiscoverClient → segmentYes68 → 67"I need an IP address"
OfferServer → segmentUsually67 → 68Proposed IP, lease time, subnet mask, gateway, DNS servers
RequestClient → segmentYes68 → 67"I accept the offered IP", visible to every server that offered
AcknowledgeServer → segmentUsually67 → 68Confirms the lease is now active

DHCP on the wire: Ethernet, IP, and UDP headers

A Discover message can't be addressed to anyone specific, so that shows up at every single layer wrapped around it. Here's exactly what a Discover packet's headers look like, stacked from the bottom up.

Src MAC: client's real MAC Dst MAC: FF:FF:FF:FF:FF:FF Src IP: 0.0.0.0 Dst IP: 255.255.255.255 Src Port: 68 (client) Dst Port: 67 (server) DHCP payload: message type = DISCOVER, chaddr = client's MAC
Broadcast at Layer 2, broadcast at Layer 3, and fixed well-known ports at Layer 4, all for the same reason: there's no specific device, and no established socket, to address this to yet.
PortUsed byRole
67DHCP serverListens here for client broadcasts, replies from here
68DHCP clientListens here for server replies, sends from here
WHY FIXED PORTS INSTEAD OF AN EPHEMERAL ONE

Almost everything else on this site, DNS included, has a client pick a random ephemeral source port (see Ports & Sockets) and send to a server's well-known port. DHCP can't quite do that: before an address is assigned, there's no real socket to speak of yet, and a broadcast reply has to reach every listening client on the segment, not one specific socket. Both sides use fixed, well-known ports instead, 67 and 68, so any DHCP client and server can find each other's traffic without needing a socket already set up.

Three roles: Client, server, and relay

Everything above assumes the client and server share the same local segment. Broadcasts don't cross routers (see Collision Domain vs Broadcast Domain), so a DHCP server living on a different subnet would never hear a client's Discover at all, unless a third role bridges the gap.

The relay does one more important thing on the way out: it stamps the packet's giaddr (gateway IP address) field with its own local interface's IP. That's how the remote server knows which scope to actually hand out an address from, and it's also the address the server sends its reply back to.

SUBNET A CLIENT ROUTER (relay) SUBNET B SERVER 1. Discover: broadcast locally, then unicast onward the relay stamps giaddr with its own subnet A address 2. Offer/Ack: server replies to that giaddr the relay broadcasts it back onto subnet A for the client
The client never learns it's talking through a relay. As far as it's concerned, it broadcast a Discover and got an Offer back, exactly like the single-segment case.
WHY DISCOVER AND REQUEST ARE BOTH BROADCASTS

Discover has to be a broadcast because the client genuinely has no address to send from or to yet. Request is a broadcast for a different reason: if more than one DHCP server replied with an Offer, broadcasting the acceptance lets every server see which offer won, so the ones that lost know to release the address they'd tentatively reserved instead of holding it forever.