Skip to content
Network Foundations

OSI Model

The OSI Model explained for network beginners — from physical signals to application data.

7 Layers Encapsulation TCP/IP Comparison ~8 min read
01

What is the OSI Model?

A conceptual reference for understanding how data travels through networks

A Standardized Framework

The Open Systems Interconnection (OSI) model is a conceptual framework developed by the International Organization for Standardization (ISO) to standardize network communication by dividing it into seven abstract layers, each handling specific functions to enable interoperability across diverse systems.

A Universal Language

This reference model provides a universal language to understand how data travels across networks, from physical transmission to application-level interaction, without specifying particular protocols.

02

OSI vs. TCP/IP Model

Reference framework vs. real-world implementation

ISO · 1970s

OSI Model (7 Layers)

  • Theoretical reference framework
  • Developed by ISO in the late 1970s
  • Strict layer separation
  • Used for education and conceptual understanding
  • Distributed error handling across layers
DARPA · ARPANET

TCP/IP Model (4 Layers)

  • Practical, real-world implementation
  • Developed by DARPA for ARPANET
  • Flexible layer interaction
  • Foundation of the modern Internet
  • Error handling at the Transport layer
03

The Seven Layers

Each layer provides services to the layer above and relies on the one below

Layer 7

Application Layer

Provides network services directly to end-user applications. Supports protocols like HTTP, FTP, SMTP for file transfer, email, and web browsing.

HTTP FTP SMTP DNS
Layer 6

Presentation Layer

Handles data translation, encryption, and formatting. Ensures secure representation via SSL/TLS and manages syntax conversion (ASCII to EBCDIC).

SSL/TLS Encryption Compression
Layer 5

Session Layer

Establishes, manages, and terminates communication sessions between applications. Handles dialog control and synchronization points for recovery.

NetBIOS RPC Session Mgmt
Layer 4

Transport Layer

Provides reliable end-to-end communication. Segments data into packets, ensures delivery with acknowledgment using TCP or UDP.

TCP UDP Ports
Layer 3

Network Layer

Manages end-to-end routing and logical addressing. Uses protocols like IP to forward packets across multiple networks through routers.

IP ICMP Router
Layer 2

Data Link Layer

Responsible for node-to-node data transfer. Frames bits into logical units, detects errors via checksum using protocols like Ethernet.

Ethernet MAC Switch
Layer 1

Physical Layer

Handles transmission of raw bits over physical media. Defines electrical and mechanical specifications for devices like cables, hubs, and repeaters.

Cables Hub Bits
04

Data Flow — Two Mirror Directions

The same 7 layers work both ways: sender encapsulates on the way down; receiver decapsulates on the way up.

Encapsulation

Sender Path · L7 → L1
7

Adds L7 · Application

The end-user interacts with the application and triggers a network request; the Application layer selects the appropriate protocol (e.g., HTTP for web, SMTP for email) and prepares the raw data for transmission.

6

Adds L6 · Presentation

Translates the data into a standardised, interoperable format; applies compression to reduce size; and encrypts the payload using SSL/TLS to ensure confidentiality in transit.

5

Adds L5 · Session

Establishes and maintains the communication session between the two applications; manages dialog control (who speaks when); and inserts synchronisation checkpoints to enable recovery if the connection is interrupted mid-transfer.

4

Adds L4 · Transport

Segments the data stream into discrete Segments (TCP) or Datagrams (UDP); prepends source and destination port numbers to identify the target application; appends sequence numbers (TCP) for ordered reassembly; and calculates a checksum for error detection.

3

Adds L3 · Network

Prepends an IP header containing the source and destination IP addresses and a Time-to-Live (TTL) value; makes the routing decision to determine the next-hop path; and fragments the Packet if it exceeds the Maximum Transmission Unit (MTU) of the outbound link.

2

Adds L2 · Data Link

Encapsulates the Packet into an Ethernet Frame by prepending a header with the source and destination MAC addresses; appends a Frame Check Sequence (FCS) trailer for error detection; and governs access to the shared physical medium.

1

Sends L1 · Physical

Converts the complete Frame into a stream of raw bits and encodes them as physical signals — electrical voltages on copper, pulses of light on fibre, or radio waves over wireless — and transmits them across the physical medium to the next device.

Decapsulation

Receiver Path · L1 → L7
1

Receives L1 · Physical

Receives the raw physical signals from the medium and decodes them back into a stream of bits; performs clock recovery and bit synchronisation to reconstruct the original digital data reliably before passing it to the layer above.

2

Strips L2 · Data Link

Reassembles the bit stream into a complete Ethernet Frame; validates data integrity by verifying the Frame Check Sequence (FCS); confirms the destination MAC address matches the local interface; then strips the frame header and trailer to expose the encapsulated Packet.

3

Strips L3 · Network

Validates the IP header integrity; confirms the destination IP address matches the local host; reassembles any fragmented packets into the original Segment; then removes the IP header and forwards the payload upward.

4

Strips L4 · Transport

Reads the destination port number to identify the target application process; verifies the checksum for transport-level errors; reorders out-of-sequence Segments using sequence numbers (TCP); and removes the Transport header before delivering the data stream to the Session layer.

5

Strips L5 · Session

Matches the incoming data to the correct active session; manages dialog sequencing to maintain orderly communication; and verifies synchronisation checkpoints to confirm the data arrived completely and in the expected order.

6

Strips L6 · Presentation

Decrypts the payload using the negotiated SSL/TLS keys; decompresses the data back to its original size; and translates the encoding from the transmission format into the character set and data format understood by the destination application (e.g., UTF-8, JSON).

7

Delivers L7 · Application

Processes the application-layer protocol (e.g., HTTP response parsing, email rendering via SMTP/IMAP); interprets the received data according to the protocol specification; and presents the final, human-readable result to the end-user application.

Same 7 layers, mirror-image directions

The sender adds headers going down (L7 → L1); the receiver strips headers going up (L1 → L7). Each peer layer on both sides speaks the exact same protocol — a virtual conversation happening layer-by-layer.

05

Key Concepts

Protocol Data Units, peer-layer and adjacent-layer interactions

Protocol Data Unit (PDU)

The name of the data unit changes at each layer as headers are added. See the transformation chain below.

Peer-Layer Interaction

Each layer on the sender communicates virtually with the matching layer on the receiver. HTTP talks to HTTP; TCP talks to TCP; Ethernet talks to Ethernet.

Adjacent-Layer Interaction

Each layer serves the layer above it and uses services from the layer below — a strict service contract in both directions.

PDU Transformation Through Layers

How the same payload is named as it descends the stack

Packet Anatomy — Byte by Byte

Each layer adds its own header (and sometimes trailer) in front of the payload

L5–L7
Data
Application Payload
L4
Segment
TCP
Application Payload
L3
Packet
IP
TCP
Application Payload
L2
Frame
MAC
IP
TCP
Application Payload
FCS
L1
Bits
01001010 11010110 01100111 10110010 00101101 …
TCP header (L4) IP header (L3) MAC header / FCS (L2) Application payload
Notice how the total frame size grows at each layer — that is header overhead. The payload itself never changes.

PDU Transformation — Flowing Down the Stack

Watch the packet travel through each layer, growing as headers are appended

DataL5 – L7
SegmentL4
PacketL3
FrameL2
BitL1
500 B
payload only
540 B
+ 40 B TCP hdr
560 B
+ 20 B IP hdr
574 B
+ 14 B MAC + 4 B FCS
574 B
on the wire
The packet grows by ~78 bytes from pure payload to the complete frame on the wire. This is the real cost of encapsulation.

PDU Flow — Encapsulation ⇄ Decapsulation

Two mirror pyramids showing how the same PDU name appears on both sides of the wire

Sender · Encapsulation

L7 → L1 · Headers added
AddDataL5–L7
AddSegmentL4 · + TCP
AddPacketL3 · + IP
AddFrameL2 · + MAC / FCS
01001010 11010110 …L1 · BITS

Receiver · Decapsulation

L1 → L7 · Headers stripped
01001010 11010110 …L1 · BITS
StripFrameL2 · − MAC / FCS
StripPacketL3 · − IP
StripSegmentL4 · − TCP
DeliverDataL5–L7

Over the wire: only bits

The bottom of the sender's pyramid and the top of the receiver's pyramid meet as raw bits on the physical medium. Every layer above that is a virtual conversation reconstructed from those bits.

06

Get In Touch

Complex infrastructure challenges deserve elegant solutions. Let's realize it together.

Email

gynlam328@gmail.com

Send email

Phone

+84-83314-1685

Call now

Location

Ban Co Ward - Previously known as District 3, HCMC

Connect with me

© 2025 - 2026 Lâm Trịnh Chí Tài (Gyn)

All rights reserved

OSI Model