Vol. I · No. 46The protocol sectionSat, 10 Oct 2026
Layer 7 · Config · how a device joins a network

DHCP

Dynamic Host Configuration Protocol

DHCP is the welcome desk. When a device joins a network it has no address, no gateway, no resolver — DHCP hands it all of that in one short exchange, then leases the address for a fixed time. It is why plugging in or joining Wi-Fi simply works, with nothing to configure by hand.

DHCP gives a joining device its address, gateway and resolver in one exchange — on a lease it must renew.

You can run this one

Open the DHCP lab →

A machine with no address shouts into the whole subnet—and four packets later it has an IP, a gateway, DNS and a lease with an expiry date.

Beginner
Operates at
Layer 7
a config service
Ports
67 · 68
UDP — server, client
Exchange
DORA
4 messages
Grants a
Lease
time-limited, renewed

How it works

The DORA handshake — Discover, Offer, Request, Acknowledge
Client (no address yet)DHCP server
1 · DISCOVER — broadcast “is anyone a DHCP server?”
2 · OFFER — “you can have 192.168.1.42”
3 · REQUEST — “yes, I’ll take that one” (still a broadcast)
4 · ACK — address + gateway + DNS + lease time
What the ACK carries
IP address + subnet mask192.168.1.42 / 24
Default gateway192.168.1.1
DNS resolveroption 6
Lease timee.g. 24 h

The client starts with no address at all, so it broadcasts. Halfway through the lease it quietly renews with the same server — no broadcast needed.

The main points

What DHCP does, step by step

1
Discover a server

With no address, the client broadcasts to 255.255.255.255 — any DHCP server on the segment hears it.

2
Take an offer

Servers offer a free address from the pool; the client picks one and formally requests it.

3
Receive the config

The ACK brings the address, subnet, gateway, DNS resolvers and a lease time in one packet.

4
Renew the lease

At about half the lease the client renews directly; let it lapse and the address returns to the pool.

Beyond one segment
Relay agent — forwards broadcasts across a router
Reservation — a fixed IP pinned to a MAC
DHCPv6 — the IPv6 counterpart

In cybersecurity

DHCP begins with unauthenticated discovery on the local network, so whoever answers first sets your gateway and DNS — a powerful position for an attacker on the same segment.

Rogue DHCP server

A fake server answers first and hands out its own gateway & DNS — a clean man-in-the-middle.

DHCP snooping

Switches learn which port the real server is on and drop offers from any other — the core defence.

Pool starvation

Flooding requests with spoofed MACs drains the pool so no one else can get an address.

DNS redirection

Because DHCP sets the resolver, a bad lease quietly points every lookup at an attacker’s DNS.

Rogue routes (opt 121)

Classless static routes in a lease can steer traffic around a VPN — the “TunnelVision” trick.

Port security & 802.1X

Authenticating the device before it ever reaches DHCP keeps rogue clients off the segment.

Rides in the stack

IPUDPDHCP

Broadcast UDP: server on 67, client on 68 — it must work before the device has any address at all.

Works with

DNSIPv4

See it on Linux

ip addrnmcliip routeresolvectl

DORA & options

DORA
Discoverclient
Offerserver
Requestclient
Ackserver
Key options
1subnet mask
3gateway
6DNS
51lease time