Home › Labs & Reference › OSI Encapsulation

🧅 One HTTPS request, all seven layers

You type https://example.com and press Enter. Here is exactly what happens to that request on the way down the stack, and what happens to it in reverse at the other end.

Module 1 companionEncapsulation Decapsulation

The whole picture

L7 Application │ │ Data ▼ L6 Presentation │ │ Data ▼ L5 Session │ │ Data ▼ L4 Transport │ │ [TCP Header][Data] ▼ L3 Network │ │ [IP Header][TCP Header][Data] ▼ L2 Data Link │ │ [MAC Header][IP][TCP][Data][FCS] ▼ L1 Physical │ │ 010101010101... ▼ NETWORK
One correction before we start

Layers 5, 6 and 7 do not necessarily add a fixed header the way TCP and Ethernet do. Their functions are largely implemented by application protocols and software. Do not teach "Layer 6 always adds a presentation header" — it is misleading.

Layer 7 — Application

Your browser generates the request. This layer is concerned with what network service the application wants.

┌─────────────────────────────┐ │ HTTP Data │ │ GET / HTTP/1.1 │ │ Host: example.com │ └─────────────────────────────┘ PDU: Data

Examples of Layer 7 protocols: HTTP, DNS, SMTP, FTP, SSH.

Layer 6 — Presentation

Format, encoding, compression and encryption. For HTTPS, TLS encryption happens conceptually here — although TLS does not map perfectly onto OSI Layer 6.

┌─────────────────────────────┐ │ Presentation processing │ ├─────────────────────────────┤ │ HTTP Data │ └─────────────────────────────┘ PDU: Data

Layer 5 — Session

Conceptually manages the conversation: start communication, maintain it, synchronise, end it. Modern TCP/IP implementations generally do not have a separate session-layer protocol stack in the strict OSI sense.

Session ↓ "Start communication" "Maintain communication" "Synchronize" "End communication" PDU: Data

Layer 4 — Transport

Now TCP adds its header. The unit is called a segment.

┌─────────────────────────────┐ │ TCP Header │ │ Source Port │ │ Destination Port = 443 │ │ Sequence Number │ │ ACK Number │ │ Flags, Window ... │ ├─────────────────────────────┤ │ HTTP Data │ └─────────────────────────────┘ PDU: Segment
The key idea

Port identifies the application or process. For HTTPS the destination port is 443. This is the same port number you type into an AWS security group rule.

Layer 3 — Network

IP adds its header in front of the TCP segment. The unit is now a packet.

┌─────────────────────────────┐ │ IP Header │ │ Source IP 192.168.1.10│ │ Destination IP 142.x.x.x │ │ TTL, Protocol ... │ ├─────────────────────────────┤ │ TCP Header │ ├─────────────────────────────┤ │ HTTP Data │ └─────────────────────────────┘ PDU: Packet

IP identifies the host. Routers — and AWS route tables — operate primarily at this layer.

Layer 2 — Data Link

Ethernet adds a header and a trailer. The unit is now a frame.

┌─────────────────────────────┐ │ Ethernet Header │ │ Destination MAC │ │ Source MAC │ │ EtherType │ ├─────────────────────────────┤ │ IP Header │ ├─────────────────────────────┤ │ TCP Header │ ├─────────────────────────────┤ │ HTTP Data │ ├─────────────────────────────┤ │ Ethernet FCS │ └─────────────────────────────┘ PDU: Frame

MAC identifies the device on the local link. Notice that the IP packet is encapsulated inside the Ethernet frame — that nesting is the whole idea.

Layer 1 — Physical

The frame is converted into signals on the medium.

Ethernet Frame ↓ 101101001010010101101010... ↓ Electrical / Optical / Radio signals Copper → electrical signals Fiber → light Wi-Fi → radio waves PDU: Bits

At the receiver — the exact reverse

0101010101... ↓ Physical ↓ Ethernet Frame ↓ Remove Ethernet Header / FCS ↓ IP Packet ↓ Remove IP Header ↓ TCP Segment ↓ Process TCP Header ↓ Application Data → "Give me the webpage."

Adding headers on the way down is encapsulation. Removing them on the way up is decapsulation. Each layer reads and removes only its own information.

The four terms you need to remember

LayerPDUAddressIdentifies
Layer 4SegmentPortThe process or application
Layer 3PacketIPThe host on the network
Layer 2FrameMACThe local network interface
Layer 1BitsPhysical transmission
The one-line version

HTTPS → TCP → IP → Ethernet/Wi-Fi → Bits
 L7     L4    L3        L2          L1

Application tells what you want → Transport manages the conversation → IP finds where → MAC handles the next local device → Physical sends the bits.