Ever wondered how your device automatically connects to the internet whenever you join a Wi‑Fi network? In this article, I’ll walk you through this concept step by step.
Computer networks are built on protocols and systems that define how packets reach their destinations. Without these rules, data would loop endlessly with no structured path to follow.
In this article, I’ll be discussing one of the main protocols devices rely on before they can establish external communication on any network: the Dynamic Host Configuration Protocol (DHCP).
As the name suggests, DHCP allows devices on a network to obtain the initial configuration provided by the network. It supplies the essential parameters required for network communication, enabling devices to access internet services.
A representation of a simple computer network designed using Cisco Packet Tracer
For DHCP to work effectively, it goes through four stages to ensure clients receive the correct network configuration from the DHCP server.
When a client joins a network, it begins by broadcasting a message to all available DHCP servers. This message is known as a DHCP DISCOVER packet. Once this broadcast reaches the network, any DHCP server that receives it responds with a DHCP OFFER.
A DHCP OFFER contains the configuration details the client can use on the network. These details typically include an IP address, subnet mask, default gateway, DNS servers, and other optional parameters. After receiving an offer, the client replies with a DHCP REQUEST, indicating that it accepts the configuration provided by a specific DHCP server.
To complete the four‑step exchange, the server sends a DHCP ACK packet. This final message confirms the lease and stores the IP‑to‑client mapping in the server’s database.