The OSI Model — 7 Layers, PDUs & Data Encapsulation
Press Next → or use ← → arrow keys
The OSI Model at a Glance
All People Seem To Need Data Processing
Application · Presentation · Session · Transport · Network · Data Link · Physical
Why the OSI Model Exists
You will hardly ever run "pure OSI" — the internet uses TCP/IP. But every network engineer thinks in OSI layers because it maps neatly onto everything that exists.
All 7 Layers — Quick Reference
| # | Layer | PDU | Key job | Devices | Sample protocols |
|---|---|---|---|---|---|
| 7 | Application | Data | User services | Host | HTTP · HTTPS · DNS · SMTP · FTP |
| 6 | Presentation | Data | Encode / encrypt / compress | Host | TLS · SSL · JPEG · ASCII |
| 5 | Session | Data | Start / manage / end sessions | Host | NetBIOS · RPC · PPTP |
| 4 | Transport | Segment / Datagram | End-to-end delivery | Firewall (L4) | TCP · UDP · SCTP |
| 3 | Network | Packet | Logical addressing & routing | Router · L3 switch | IP · ICMP · OSPF · BGP |
| 2 | Data Link | Frame | MAC addressing, framing | Switch · Bridge · NIC | Ethernet · PPP · ARP · Wi-Fi (802.11) |
| 1 | Physical | Bits | Signals on the wire | Hub · Repeater · Cable | Ethernet PHY · DSL · fibre optics |
Layer 1 — Physical Layer · What & Why
Physical Layer
The physical layer converts 1s and 0s into electrical signals (copper), light pulses (fibre) or radio waves (Wi-Fi/5G), and vice versa. It knows nothing about addresses, routing or reliability — only signals and timing.
Layer 1 — Devices, PDU & Protocols
| Devices | PDU | Protocols / standards |
|---|---|---|
| Hub · Repeater · Cable (copper / fibre) · Modem · Antenna | BITS |
Ethernet PHY (100BASE-T · 1000BASE-T) DSL · DOCSIS (cable) Fibre (SONET / SDH / DWDM) Bluetooth PHY · Wi-Fi PHY · 4G / 5G radio |
A hub forwards every incoming signal to every other port with zero intelligence. A repeater amplifies a signal so it can travel further. Neither understands MAC or IP addresses — that's what makes them L1 devices.
Hubs are effectively extinct today (replaced by L2 switches). "Modem" (modulator/demodulator) still lives at L1 — converting digital bits to analog signals over DSL / cable / fibre.
Layer 2 — Data Link · What & Why
Data Link Layer
Layer 2 wraps the network packet into a frame with a source MAC and destination MAC — a hardware address burned into every NIC. It handles local delivery on the same LAN; getting between LANs is Layer 3's job.
A4:B1:C1:D2:E3:F4. First 3 bytes = vendor, last 3 = serial.Layer 2 — Devices, PDU & Protocols
| Devices | PDU | Protocols |
|---|---|---|
|
Switch · Bridge NIC (Network Interface Card) Wireless Access Point (AP) |
FRAME |
Ethernet (IEEE 802.3) Wi-Fi (IEEE 802.11) PPP · HDLC ARP · VLAN (802.1Q) STP (Spanning Tree) |
A switch reads the destination MAC and forwards the frame only to the correct port (unlike hubs which flood everywhere). It builds a MAC address table automatically by watching source addresses on incoming frames.
ARP (Address Resolution Protocol) maps a known IP to the MAC on the same LAN — the bridge between L3 addressing and L2 delivery.
Layer 3 — Network · What & Why
Network Layer
Layer 3 gives every device a logical (IP) address that works globally, and picks the best route across many networks to reach the destination. Where Layer 2 handles "next hop on this LAN", Layer 3 handles "how to reach New York from Delhi".
Layer 3 — Devices, PDU & Protocols
| Devices | PDU | Protocols |
|---|---|---|
|
Router · Layer-3 Switch Multi-layer firewall Load balancer (L3/L4) |
PACKET |
IP (IPv4 & IPv6) — addressing ICMP — ping & error reportingOSPF · EIGRP — internal routing BGP — internet routing between ISPs IPsec — L3 encryption NAT — private↔public translation |
A router looks at each packet's destination IP, checks its routing table, and forwards the packet toward the correct "next hop" — repeating until the packet reaches its network.
ping uses ICMP. traceroute/tracert
uses ICMP+TTL. ipconfig/ifconfig show your L3 address.
All of these live at Layer 3.
Layer 4 — Transport · What & Why
Transport Layer
Layer 3 gets a packet to the right machine. Layer 4 gets it to the right application on that machine — using port numbers (HTTP=80, HTTPS=443, DNS=53, SSH=22). It also decides between reliable (TCP) and fast (UDP) delivery.
Layer 4 — Devices, PDU & TCP vs UDP
| Devices | PDU | Protocols |
|---|---|---|
|
L4 firewall (port-based) L4 load balancer (mostly end-host software) |
SEGMENT (TCP) DATAGRAM (UDP) |
TCP — reliable, ordered, connection-based UDP — connectionless, low-overhead SCTP — TCP + UDP hybrid QUIC — modern encrypted UDP-based transport |
| Feature | TCP | UDP |
|---|---|---|
| Connection | 3-way handshake first | None — just send |
| Reliability | ACK + retransmit | None — app must handle |
| Order | Guaranteed | Not guaranteed |
| Header size | 20+ bytes | 8 bytes (tiny) |
| Speed | Slower (overhead) | Very fast |
| Used by | HTTP · HTTPS · SSH · email · file transfer | DNS · VoIP · gaming · video streaming · DHCP |
Layer 5 — Session Layer
Session Layer
| PDU | Protocols |
|---|---|
| DATA | NetBIOS · RPC · PPTP · SOCKS · SIP (session initiation) |
In modern TCP/IP, session-layer functions are usually rolled into the application itself (cookies, JWTs, session IDs). L5 is more of a conceptual placeholder in real networks — but essential vocabulary in the OSI model.
Layer 6 — Presentation Layer
Presentation Layer
| PDU | Standards / protocols |
|---|---|
| DATA | TLS · SSL · ASCII · UTF-8 · JPEG · PNG · MPEG · MIME · gzip · brotli |
When you visit an https:// site, the encryption is negotiated by
TLS at Layer 6 before HTTP data (Layer 7) is sent.
That's why the padlock icon protects your credentials.
Layer 7 — Application Layer · What & Why
Application Layer
The application layer is the interface between the network and the app you're using. When you type a URL, click "Send", or open Zoom — L7 protocols like HTTP, SMTP, and RTP take over. It's the only layer users ever see.
Layer 7 — Devices, PDU & Protocols
| Devices | PDU | Protocols |
|---|---|---|
|
Application-layer firewall (WAF) API gateway Reverse proxy (Nginx, HAProxy) End hosts (browser, mail client, apps) |
DATA |
HTTP · HTTPS — web DNS — name resolution SMTP · IMAP · POP3 — email FTP · SFTP — files SSH · Telnet — remote shell DHCP — auto IP assignment SNMP — device monitoring RTP · SIP — voice / video |
The OSI Application Layer isn't your Word or Chrome program — it's the network-facing services those programs use (HTTP, DNS, SMTP…). Your app talks to L7 protocols; the protocols talk to L6 and below.
Which Device Lives on Which Layer?
The higher the layer a device operates at, the smarter — and slower — it is. Hubs blindly forward bits; L7 firewalls understand entire HTTP requests.
Data Encapsulation — the Idea
Data encapsulation in networking works exactly the same way. As data flows down the OSI stack, each layer adds its own header (and sometimes a trailer). On the receiving side, the process is reversed — each layer strips its header on the way back up. This is called decapsulation.
Encapsulation & Decapsulation — Full Journey
Data starts small at L7, then each layer wraps it with its own header (and L2 also adds a CRC trailer). By the time it hits L1 it's a fully-labelled bit stream on the wire. The receiver undoes it one wrapper at a time.
The TCP/IP Model — the Model the Internet Actually Uses
It has just 4 layers because it was built for real, working networks, not as a theoretical reference. Today it runs literally every internet-connected device — while OSI stays the vocabulary we use to talk about them.
OSI is the textbook. TCP/IP is what actually runs. TCP/IP combines OSI's Session + Presentation + Application into one Application layer, and OSI's Physical + Data Link into one Network Access layer.
The TCP/IP 4-Layer Stack
The 4 TCP/IP layers do all the same work as OSI's 7 — the model just groups related functions together (Network Access = Physical + Data Link, Application = Session + Presentation + Application).
TCP/IP — Protocols & Devices per Layer
| Layer | PDU | Key protocols | Devices |
|---|---|---|---|
| L4 · Application | Data | HTTP · HTTPS · DNS · SMTP · IMAP · POP3 · FTP · SFTP · SSH · Telnet · DHCP · SNMP · RTP · SIP · TLS | WAF · API gateway · reverse proxy · end hosts |
| L3 · Transport | Segment / Datagram | TCP · UDP · SCTP · QUIC (encrypted UDP-based) | L4 firewall · L4 load balancer |
| L2 · Internet | Packet | IPv4 · IPv6 · ICMP · IGMP · OSPF · BGP · IPsec · NAT · ARP* | Router · L3 switch · L3 firewall |
| L1 · Network Access | Frame / Bits | Ethernet (802.3) · Wi-Fi (802.11) · PPP · HDLC · MAC · DSL · fibre PHY · 4G/5G radio | Switch · Bridge · NIC · AP · Hub · Cable · Modem |
ARP maps an IP (Internet layer) to a MAC (Network Access layer). Different books place it differently — some at L1 (Network Access), some at L2 (Internet). Both are defensible.
When you open https://google.com: TLS + HTTP run at L4 (Application) →
TCP runs at L3 (Transport) → IPv4/IPv6 runs at L2 (Internet) → Ethernet/Wi-Fi runs at L1
(Network Access). Every packet you send touches all four.
OSI vs TCP/IP — Side by Side
The internet actually runs on TCP/IP — its 4 layers collapse several OSI layers into one. But engineers still describe networks using OSI's 7 layers because it's more granular and precise for teaching, troubleshooting and certification (CCNA, CompTIA Net+).
OSI vs TCP/IP — Detailed Differences
| Property | OSI Model | TCP/IP Model |
|---|---|---|
| Layers | 7 layers | 4 layers |
| Developed by | ISO (1984) | DoD / Vint Cerf & Bob Kahn (1970s) |
| Purpose | Reference / teaching model | Practical / working implementation |
| Approach | Protocols came after the model | Model came after the protocols (retrofit) |
| Session & Presentation | Separate layers (5 & 6) | Rolled into Application (L4) |
| Physical & Data Link | Separate layers (1 & 2) | Rolled into Network Access (L1) |
| Reliability | Guaranteed at Transport (Layer 4) | Guaranteed at Transport by TCP |
| Real deployment | Rarely — reference only | Runs the entire modern internet |
| Used for | Teaching · troubleshooting vocabulary · exam certs | Actual network design & operation |
Network engineers say "that's a Layer 3 issue" (OSI-speak) but the fix lands in a TCP/IP Internet layer config file. Both languages point to the same code — you just need to be fluent in both.
OSI & TCP/IP Golden Rules — 1 to 4
OSI & TCP/IP Golden Rules — 5 to 8
You Now Speak OSI & TCP/IP Fluently
Identify any layer's role, name its PDU, list its devices and protocols, and trace data as it's encapsulated down the sender's stack and decapsulated up the receiver's stack. This is the vocabulary the entire industry uses for designing and debugging networks.
Fire up Wireshark and watch real packets — every layer is right there in the capture. Do the Cisco Packet Tracer OSI labs. Read the classic Tanenbaum "Computer Networks" for the theory.
🧱 End of tutorial · Press ← to review, or click Restart