DHCP (Dynamic Host Configuration Protocol) / DHCPv6
What it is for
★★★ It solves a chicken-and-egg problem: sending a packet requires an IP address, and an IP address is exactly what this machine is asking for.
★★★ The answer is to shout in a way everyone receives: source 0.0.0.0 (I have none yet) and destination 255.255.255.255 (whoever hears me, answer).
★★ Besides the address it also hands down the gateway, the DNS servers and the mask -- everything in one go.
★★★ Why four steps and not two
★★★ Because a segment may hold two DHCP servers, and both will answer.
· D: I need an address (broadcast) -> O: each server offers one;
· R: I pick one and broadcast again to say which;
· A: the chosen server confirms, and the one not chosen hears the broadcast and takes its offer back.
★★★ Step three stays a broadcast precisely so the losing server hears it too.
★ Common misconceptions
★★★ "A DHCP address is permanent" -- it is a lease. It must be renewed before expiry, and a failed renewal means starting over.
★★★ "The server must be on the client's segment" -- it need not be; a relay on the switch converts the broadcast into a unicast and forwards it.
★★ "IPv6 also gets its addresses from DHCPv6" -- not necessarily. SLAAC is IPv6's default.