How the Internet Works: A Step-by-Step Guide from Wi-Fi to Web

Have you ever tried to think how the internet works, why ISPs charge for it, and do they provide plans according to data?
When we turn on Wi-Fi or mobile data, what actually happens is the device tries to communicate or setup listening mode with a frequency range of 2.4GHz to 5GHz and lists out all available devices. We select our Wi-Fi SSID and provide credentials to validate it so that no unknown person gets into the network. (Security Tip: This is where hackers use "Evil Twin" attacks to mimic your SSID and steal those credentials).
Now it looks simple that we connect with Wi-Fi or mobile network and start using internet, but what happens behind the scenes is this: after the Wi-Fi router validates the credentials, we need a unique ID to distinguish the traffic flowing through the network. This unique ID is called an IP address.
Most of the time, this is set dynamically using the DHCP protocol.
DHCP Discover: Our device sends out a request to see if any DHCP servers are on the network.
DHCP Offer: The DHCP server replies back with an IP address the device could use.
DHCP Request: The device sends a reply confirming it wants that offered IP.
DHCP ACK: The DHCP server sends a reply acknowledging it is done.
Why is this necessary? You might wonder, "Can't we just give every laptop a permanent IP?" The answer is: IP Wars. If you had a permanent IP and took your laptop to a café where someone else was already using that same IP, neither of you could connect. DHCP acts as the "Peacekeeper," giving you a temporary ID that fits perfectly in whatever network you just joined.
Admin Perspective: We get a unique ID that is an IP address; however, this is called a logical address (think of it as a temporary one) and added at Layer 3. We use a logical address and not a physical address (permanent address) because if I leave a network and join another, but the physical address remains the same, it would be impossible to route to the device. The router wouldn't know where the device is located globally.
But there is another problem: what happens if we disconnect from the Wi-Fi and connect again? We get a new IP address. So how does the router know this is the actual device that requested the data? Here is where the MAC address comes in. It is a "burned-in" address added to the NIC during manufacturing. It is a 48-bit address where the first 24 bits show the OEM (Manufacturer) and the other 24 bits are a unique ID. (Hacker Perspective: Attackers use "MAC Spoofing" to hide their original identity or bypass security filters).
If I want to send data to a particular IP, how would I send it since IPs change? We don't use the MAC address to forward data over long distances, so here comes the logic of ARP (Address Resolution Protocol).
ARP allows a device to associate its MAC address with an IP address.
Devices send a broadcast searching for the specific device asking: "What is the MAC address that owns this IP address?"
Security Risk: Attackers use ARP Poisoning here to "lie" to the network and intercept your data by claiming their MAC address belongs to the Router's IP.
Now you understand how devices joined and formed a network (Topologies). In small home and office (SOHO) networks, we use Star Topology. But to reach other networks where the data resides (Google, Netflix, etc.), we use DNS (Domain Name System)—a record table that maps domain names to IP addresses, so we don't have to memorize numbers.
However, there are still key features to know. The small network in our home is a Private Network, while the networks connecting them are Public Networks. Because IPv4 addresses are limited, we use NAT (Network Address Translation).
Why is this necessary? Could we just buy more IPv4 addresses? No. We literally ran out of them years ago. NAT was the "Emergency Surgery" for the internet. It allows hundreds of devices in your house to share one single Public IP. Your router creates a NAT Table that maps your Private IP to a Public IP port, so when the response comes back from the world, the router knows exactly which device in your house requested it.

Because of IPv4 limitations, scientists discovered IPv6, which is 128 bits long—meaning 340 trillion-plus addresses. This removes the scarcity of IPs and the need for complex NAT tables.
Finally, where does the ISP role come in? Moving data is technically free, but to create the Internet, many ISPs must build the infrastructure (cables, satellites, routers). To cover this infrastructure cost, research, and development, they create the data plans we pay for.

