AlgoViz
Networking
Networking · MediumLesson 4 of 13

The protocol stack

The internet looks impossibly complicated until you learn its one organizing trick: it's built in LAYERS, like a stack of helpers, each doing one small job and handing off to the next. The top layer cares about your web page; the bottom layer cares about electrical signals on a wire. Each layer trusts the one below to handle its part. Once you see the stack, everything else in networking slots into place.

Layers: each helper does one job, then hands off

ApplicationHTTP — the actual page you wanttop — what you seeTransportTCP — split into packets, deliver in orderInternetIP — address each packet, route itLinkWi-Fi / cable — the physical bits on the wirebottom — the wiresend
Four layers (the TCP/IP model). Your message travels DOWN the stack on the way out — each layer wraps it in its own envelope — and back UP on the way in.

Think of mailing a gift. You wrap it in a box (one job), the box goes in a van (another job), the van drives a route (another job). Nobody does everything; each step adds its part and trusts the next. Networking is the same. The top layer (Application) is your actual request — 'give me this web page' in a language called HTTP. It hands that down to Transport (TCP), which chops it into packets and promises in-order delivery. That hands down to Internet (IP), which stamps each packet with addresses and figures out the route. That hands down to Link (Wi-Fi or cable), which turns it into actual signals on the wire. Four helpers, one message.

Down on the way out, up on the way in

When you send something, it travels DOWN the stack: your page request gets wrapped by Transport, then by Internet, then by Link — like putting a letter in an envelope, in a bigger envelope, in a mailbag. Each layer adds a label with the info the matching layer on the other side will need. At the destination, it travels UP the stack: Link unwraps the signals, Internet checks the address, Transport reassembles the packets in order, and finally the Application layer hands the server your clean original request. Same envelopes, opened in reverse. The beauty: each layer on your machine 'talks to' its twin on the other machine, never worrying about the layers below.

Why layers? So each part can change without breaking the rest

Layering isn't just tidy — it's why the internet survives change. You can switch from Wi-Fi to a cable (swap the bottom Link layer) and nothing above notices: TCP, IP, and your web page work exactly the same. We invented a whole new addressing scheme (IPv6 in the Internet layer) without rewriting websites. HTTPS added encryption at the top without touching how packets route. That's the payoff of one job per layer: you can improve or replace any single layer as long as it keeps the same 'handoff' to its neighbors. (You may also hear about the OSI model with seven layers — it's the same idea sliced more finely. The four-layer view here is the practical one.)

It's a tradeoff

Option👍 Pro👎 Con
TCP/IP model (4 layers)Matches how the real internet is actually built; easy to hold in your head.Lumps some details together — less precise for teaching every nuance.
OSI model (7 layers)Very precise; great shared vocabulary for pinpointing exactly where a problem lives.More layers to memorize; some are rarely used in practice, so it can feel academic.

Questions you might have

Do I have to memorize all the layers?

Not at first. The one idea that matters: the internet is built as a stack where each layer does one job and trusts the one below. The names (Application, Transport, Internet, Link) and their jobs come naturally once you've seen DNS, TCP, and IP each in action — they each live on one of these layers.

What's the difference between TCP and IP, then?

They're two different layers. IP (Internet layer) handles ADDRESSING and ROUTING — getting each packet to the right machine. TCP (Transport layer) sits just above and handles RELIABILITY — splitting your data into packets and making sure they arrive complete and in order. IP delivers; TCP keeps it correct.

Why is HTTP at the 'top'?

Because it's closest to you — it's the language of your actual request ('give me this page'). The lower layers don't care what you're asking for; they just carry the bytes. HTTP is the meaning; the layers below are the delivery. That's why we say it sits on top of the stack.

Is the OSI model wrong, then?

Not wrong — just a different slicing. OSI splits the same journey into seven layers instead of four, which gives a more precise vocabulary (engineers say 'that's a layer 7 problem'). The 4-layer TCP/IP model maps more directly onto how the internet really runs, so it's the better one to learn first.

🧠The internet is a stack of layers, each doing one job and trusting the one below: your request (HTTP) rides on reliable delivery (TCP), which rides on addressing (IP), which rides on the wire (Link). Layering is why any one part can change without breaking the rest.
✅ Check yourself4 quick questions — prove the idea stuck.Start →

Best read after: IP addresses, Client & server