How does the internet work?

Melih Firat
4 min readSep 21, 2024

--

The internet is a network of networks.

So what is this network, how networks form their own network, I will explain it with an allegory just below, here you go:

For example in an office, let’s say the red office. The computers in the red office are connected to each other with the help of switch, this switch is connected to the world through a router (modem). The neighbor of this office is another office, let’s say the blue office. The computers in the blue office are also connected to each other with switch and it’s also connected to the world via a router.

Basic diagram of internet

Local Area Network

The structure in which the offices are connected to the router is called a network. The structure in the red office is a network. So is the blue office. Computers connected to the modem in your home, phones, tablets, even TVs, robot vacuum cleaners, anything connected to the internet forms a network, Local Area Network (LAN).

The place where these networks open to the world with routers is called the internet, that is, the networks formed by networks. As I mentioned in a quote at the beginning of this story.

If you ask what is the opening of Local Area Networks to the world, what is this world, I will explain immediately:

Wide Area Network

What we are talking about here is really our world. We call it the Wide Area Network, or WAN. Here, Internet providers now have their own Routers and DNS Servers (ISP). The requests we send from our home or office (LAN) go out into the world (WAN) and reach our destination thanks to the ISPs that are connected to Internet Exchange Points (IXP).

Undersea Internet Cable Map

on the picture above you can see that our world is surrounded by internet cables. These cables are connected to Internet Exchange Points (IXPs). The ISPs, the internet services connected to the IXPs, bring the internet to your home, office and the devices there.

Cable Internet

Cellular Base Stations are also connected to these cables, and you can use the cellular data feature of your phones wirelessly with the internet signals generated and received from them.

Cellular Internet

Now that we know what the Internet is, let’s get to the answer to why you are here:

How Does the Internet Work?

If we reduce the internet to just getting cat images from a website that serves cat pictures,

I will explain that step by step, and by doing so, answer will mostly understood.

When you ask your browser to give you a random cat picture, you usually visit the “cataas.com/cat” address. At least, that’s what I would do.

Your browser checks the DNS Cache of your computer to see if it already has the IP address of this domain.

If this website is not in the DNS Cache, a DNS query is made to find the IP address of “cataas.com”. This DNS query typically uses UDP. The UDP packet carrying the DNS query is sent to the router and then to the rest of the internet, known as the WAN. The UDP packet reaches your ISP’s DNS server in the WAN, which processes the DNS query and returns the IP address of the website to your browser.

DNS Query

The computer then saves this IP address in the DNS Cache.

Now, your computer knows the IP address, but it doesn’t know whether this IP address is in the LAN or WAN. It will check for a device with this IP address in the LAN using ARP. Once it realizes the server is in the WAN, your computer and other components know that the protocols need to route the request to the WAN through the router.

Connection between your computer and Server

At this point, your computer can send a secure TCP connection request using the HTTPS protocol with SSL/TLS encryption (See: 3-way handshake). This request is sent via your router, through routing protocols, to global routers, and finally reaches the server hosting “cataas.com”.

Once the connection is established, your browser sends an HTTP GET request to the server. Since “cataas.com” supports HTTPS, the request is encrypted and securely sent to the server.

The server then responds with an HTTP response containing a random cat picture. This HTTP response is routed back to your router via global routers, and finally processed by your browser, allowing you to see your cat picture.

Todo:

/* Explain HTTP, DNS, UDP, TCP & 3-Way Handshake, ARP, SSL/TLS in another story and link them from here */

--

--

Melih Firat

Turkish Computer Engineer, trying to explain every step on Backend Roadmap GitHub: firatmelih LinkedIn: firatmelih