NetwNETW
Curriculum
CHAPTER 02

The OSI & TCP/IP Models

Layers, encapsulation, and the vocabulary of networking

12 min read5 sections
In this chapter
Why layers?The 7 OSI layersTCP/IP modelEncapsulationPDU names

01Why layers?

Layering separates concerns. Each layer provides a service to the one above and hides implementation details. This is why you can swap Ethernet for Wi-Fi without rewriting HTTP, and why a browser does not need to know about cable types.

02The 7 OSI layers

From bottom to top. OSI is a teaching/reference model; memorize the names and the responsibilities.

Why this exists

Layers let one part change without breaking the others. You can replace Wi-Fi with Ethernet and HTTP does not care. The model is a map of those separate jobs.

  • ▸L1 Physical: bits on wire, signals, cables
  • ▸L2 Data Link: frames, MAC, switches
  • ▸L3 Network: packets, IP, routing
  • ▸L4 Transport: segments, TCP/UDP, ports
  • ▸L5 Session: dialog control, checkpoints
  • ▸L6 Presentation: encoding, TLS, compression
  • ▸L7 Application: HTTP, DNS, SMTP, FTP

The seven layers, in three dimensions

Drag to orbit, scroll to zoom, click a slab to inspect its job.

Loading the 3D stack…
Layer 4 of 7segment / datagram
Transport
What it does
Adds ports, splits data into segments, and decides whether to guarantee delivery.
Examples
TCP, UDP, QUIC
Why it exists
One IP address can run many conversations at once. Ports tell them apart. TCP adds ordering and retransmission; UDP skips that when speed matters more than certainty.
hands segments to Network. Click another slab to follow the chain.

03TCP/IP model

The practical 4-layer model the internet actually runs: Link (L1+L2), Internet (L3), Transport (L4), Application (L5-L7 combined). OSI is the vocabulary; TCP/IP is the implementation.

04Encapsulation

As data descends the stack, each layer adds a header (and sometimes a trailer). On receive, headers are stripped in reverse. Think envelope inside envelope. This is how a packet carries an HTTP request inside TCP inside IP inside Ethernet.

Mental model

Like mailing a letter: you write a message (data), put it in an envelope with a recipient address (transport header), put that envelope in a bigger envelope with a street address (network header), then a mailbag label (link header). Each layer only reads its own envelope.

Think: Why not just one big header? Because each layer has different scope and changes independently (e.g., IP changes at each router, MAC changes at each hop).

One packet, four wrappers

Drag to orbit, click a slab to see what that wrapper adds.

Loading the 3D packet…
Wrapper20 bytes
IP

IP adds the source and destination addresses, a TTL and a protocol number. These stay the same from sender to receiver, even as the frame around them is replaced at every hop.

Fields it adds
version + header lengthTTLprotocolsource IPdestination IPheader checksum
Scope: end to end
Read by: every router along the path

05PDU names

Each layer has its own name for the data unit.

Check your understanding
0 / 1 correct
At which layer does IP addressing live?