Originally published at https://blog.pathvector.dev/protocol-lab-dhcp-22/ — part of the free Protocol Lab series.

This post is part of Protocol Lab, a free, hands-on series for learning networking protocols by building and breaking them in a container lab. All the lab material — topologies, configs, and scripts — lives in the repo: github.com/pathvector-studio/protocol-lab.

Every host in the labs so far had its address configured for it. But how does a machine that just booted — with no IP at all — get one? The answer is DHCP, and it takes exactly four messages, often called DORA:

Discover — the client shouts "is there a DHCP server?" (broadcast, from 0.0.0.0),

Offer — a server replies "you can have 10.0.0.193",