Computer Networks22 min readBeginner

How the Internet Actually Works

Packets, layers, and the basic plumbing that gets a webpage from a server to your screen.

Networks are layered

A computer network isn't one system — it's many systems stacked on top of each other. Each layer does one job and trusts the layers below it. The standard model has 4-7 layers depending on which textbook you read; the practical one is the TCP/IP model:

  • Link layer — transmit bits over a physical medium (Ethernet, Wi-Fi, fiber).
  • Internet layer (IP) — get a packet from one machine to another, possibly across many networks. Best-effort: packets may arrive out of order, late, or not at all.
  • Transport layer — provide useful semantics on top of IP. TCP gives reliable, ordered streams; UDP is lightweight datagrams.
  • Application layer — HTTP, DNS, SMTP, SSH — protocols that real applications speak.
📮
Real-life analogy — A package in the mail
IP is the postal service: it picks up envelopes and tries to deliver them, but envelopes can get lost or arrive in the wrong order. TCP wraps your data in NUMBERED envelopes and re-sends lost ones, so the receiver gets them all in order. The application layer is what's INSIDE the envelope — the letter, the contract, the photo.

What a packet looks like

A packet is a chunk of data with a stack of headers, one per layer. As a packet goes UP the stack on the receiver side, each layer peels off its header and hands the rest to the layer above.

text
[ Ethernet header | IP header | TCP header | HTTP request | ... payload bytes ... ]