how/network
You join Wi-Fi, and a second later you already have an IP. Where it comes from, who picks it, and why all of it works in 4 packets.
You join the Wi-Fi at a cafe, and a couple of seconds later sites are already loading. But for them to load, your laptop needs four things:
192.168.1.50)Without them the laptop does not know who it is, where to send data, or who to ask questions. You can set all of it by hand, but the cafe will not hand you a slip with the parameters when you walk in. DHCP solves this: a protocol that hands out network settings automatically in 4 short messages.
Press ▶ and watch the laptop get its IP half a second after connecting.
The link is up (cable plugged in / Wi-Fi connected), but the laptop has no IP address. Without an IP you cannot reach the network, not the internet, not even the neighbor in the next room.
To ask for settings, the laptop will send packets with a temporary
src address 0.0.0.0, which means "I have no address". Then the
request flies out by broadcast, so that "any DHCP server hears it".
recap
What to remember:
169.254.0.0/16. There will be no internet, but
local neighbors will be visibleIf you are curious how packets work at L2 (what broadcast is and how a packet even travels without an IP), see arp and ethernet-frame.