1. Introduction to the OSI Model
The Open Systems Interconnection (OSI) Model is a conceptual framework published in 1984 by the International Organization for Standardization (ISO 7498). It characterizes and standardizes the communication functions of a telecommunication or computing system without regard to its underlying internal structure and technology.
In the early days of computing (1970s–1980s), computer networks were proprietary silos. IBM mainframes ran SNA (Systems Network Architecture), DEC computers ran DECnet, and Apple Macintosh networks ran AppleTalk. These systems could not communicate with one another. The OSI model established a vendor-agnostic 7-layer architecture, allowing engineers from different organizations and hardware vendors to build interoperable networking components.
How to Remember the 7 Layers (Mnemonics)
Engineers commonly memorize the layers using two popular mnemonics:
- Top-to-Bottom (Layer 7 → Layer 1): All People Seem To Need Data Processing (Application, Presentation, Session, Transport, Network, Data Link, Physical).
- Bottom-to-Top (Layer 1 → Layer 7): Please Do Not Throw Sausage Pizza Away (Physical, Data Link, Network, Transport, Session, Presentation, Application).
2. Master Summary: The 7 Layers at a Glance
Layer Layer Name PDU (Unit) Primary Hardware Key Protocols
───── ────────── ────────── ──────────────── ─────────────
L7 Application Data Gateway, Proxy, WAF HTTP/HTTPS, DNS, SSH, SMTP
L6 Presentation Data Operating System, TLS TLS/SSL, JSON, gzip, ASCII
L5 Session Data OS, Network Sockets RPC, NetBIOS, SIP, SOCKS
L4 Transport Segment Firewall, L4 Balancer TCP, UDP, QUIC, SCTP
L3 Network Packet Router, Layer 3 Switch IPv4, IPv6, ICMP, BGP, OSPF
L2 Data Link Frame Switch, Bridge, NIC Ethernet, Wi-Fi, ARP, VLAN
L1 Physical Bits Hub, Transceiver, Cable Fiber, RJ45 Cat6, PAM4, RF
3. Layer-by-Layer Breakdown: Layer 1 through Layer 7
Layer 1: The Physical Layer (Bits)
The Physical Layer is responsible for the physical transmission of unstructured raw data bits (0s and 1s) across a physical transmission medium. It specifies electrical, optical, radio frequency, and mechanical interfaces.
- Core Responsibilities: Voltage levels, bit timing, radio frequencies, optical wavelengths, pinouts, cable geometries, signal modulation (e.g. QAM, PAM4).
- Physical Mediums: Category 6/6A/8 twisted-pair copper cables, Single-Mode and Multi-Mode fiber-optic strands, 802.11 Wi-Fi radio frequencies (2.4 GHz, 5 GHz, 6 GHz), and 5G NR mobile radio.
- Hardware Devices: Network interface transceivers (SFP+, QSFP28), repeaters, legacy network hubs, patch panels, and optical amplifiers.
Layer 2: The Data Link Layer (Frames)
The Data Link Layer provides node-to-node data transfer across a single physical link or local area network (LAN) segment. It handles framing, physical hardware addressing, and local error detection.
- Core Responsibilities: Packaging Layer 3 packets into Frames, assigning 48-bit physical MAC addresses (EUI-48), collision handling (CSMA/CD / CSMA/CA), and cyclic redundancy error checking (FCS/CRC).
- Sublayers: Divided into the MAC (Media Access Control) sublayer (hardware addressing) and the LLC (Logical Link Control - IEEE 802.2) sublayer (synchronization and multiplexing).
- Protocols: Ethernet (IEEE 802.3), Wi-Fi (IEEE 802.11), Address Resolution Protocol (ARP), VLAN tagging (IEEE 802.1Q), Spanning Tree Protocol (STP), and PPP.
- Hardware Devices: Layer 2 Ethernet switches, wireless access points (WAPs), network bridges, and Network Interface Cards (NICs).
Layer 3: The Network Layer (Packets)
The Network Layer enables host-to-host routing and forwarding across multiple interconnected independent networks (the Internet). It abstracts physical hardware addresses into logical hierarchical network addresses.
- Core Responsibilities: Logical addressing (IPv4 32-bit and IPv6 128-bit addresses), subnetting, packet fragmentation, and dynamic path determination across routers.
- Protocols: IPv4 (RFC 791), IPv6 (RFC 8200), Internet Control Message Protocol (ICMP for ping/traceroute), IPsec (tunneling/encryption), and IGMP (multicast).
- Routing Protocols: BGP-4, OSPF, EIGRP, IS-IS.
- Hardware Devices: Enterprise routers, core datacenter switches, and Layer 3 multilayer switches.
Layer 4: The Transport Layer (Segments & Datagrams)
The Transport Layer provides transparent, end-to-end data transfer between specific software processes running on distinct hosts. It introduces the concept of Port Numbers (0 to 65,535) to multiplex simultaneous network conversations on a single machine.
- Core Responsibilities: Port-based multiplexing, segment segmentation/reassembly, connection management, flow control (sliding window), and error recovery.
- Key Protocols:
- TCP (Transmission Control Protocol): Connection-oriented, guaranteed reliable delivery, sequenced packets, flow-controlled, uses 3-way handshakes (SYN, SYN-ACK, ACK).
- UDP (User Datagram Protocol): Connectionless, lightweight, low-overhead, no acknowledgments. Ideal for live streaming, DNS queries, and voice (VoIP).
- QUIC (RFC 9000): Modern UDP-based encrypted multiplexed transport protocol powering HTTP/3.
- Hardware Devices: Layer 4 load balancers and stateful packet-filtering firewalls.
Layer 5: The Session Layer (Data)
The Session Layer manages dialogues and connections (sessions) between local and remote applications. It sets up, maintains, synchronizes, and terminates active communication streams.
- Core Responsibilities: Session establishment, checkpointing (recovery points during file transfers so downloads can resume without starting from zero), and session synchronization in simplex, half-duplex, or full-duplex modes.
- Protocols & Examples: Remote Procedure Call (RPC), NetBIOS, SOCKS5 proxy protocol, Session Initiation Protocol (SIP - VoIP signaling), and Named Pipes.
Layer 6: The Presentation Layer (Data)
The Presentation Layer (often referred to as the syntax layer) formats and translates data between the application layer format and the network format. It ensures that data sent from one system's application layer is completely readable by another system.
- Core Responsibilities:
- Data Translation & Serialization: Converting between disparate character encodings (ASCII, UTF-8, EBCDIC), and serializing structured payloads (JSON, XML, Protocol Buffers).
- Encryption & Decryption: Managing cryptographic security like TLS/SSL sessions for HTTPS.
- Data Compression: Reducing byte size before transmission (e.g., gzip, Brotli, zstd).
Layer 7: The Application Layer (Data)
The Application Layer directly interfaces with human users and software applications. It provides communication services, protocols, and standard APIs that web browsers, email clients, and cloud servers interact with.
- Core Responsibilities: End-user application protocols, resource identification, user authentication, and application service requests.
- Protocols: HTTP/HTTPS (web), DNS (domain resolution), SSH (secure shells), SMTP/IMAP (email), FTP/SFTP (file transfer), NTP (clock synchronization), and DHCP (automatic IP assignment).
- Hardware Devices: Web Application Firewalls (WAF), Layer 7 Application Load Balancers (ALBs), API Gateways, and Reverse Proxies (Nginx, Envoy, Cloudflare).
4. Encapsulation & De-Encapsulation in Action
When you load a webpage, data travels down through the layers on your computer (Encapsulation), crosses physical cables, and travels up through the layers on the server (De-encapsulation):
Sending Device (Encapsulation):
[L7 Application] HTTP GET /index.html
▼
[L6 Presentation] TLS Encryption + Brotli Compression
▼
[L5 Session] Session Token & Socket ID
▼
[L4 Transport] TCP Header (Source Port: 52410, Dest Port: 443) ──► Segment
▼
[L3 Network] IP Header (Source IP: 192.168.1.5, Dest IP: 104.21.52.12) ──► Packet
▼
[L2 Data Link] Ethernet Header (Source MAC, Dest MAC) + FCS CRC ──► Frame
▼
[L1 Physical] Laser light pulses / electrical voltages ──► Bits
~~~~~~~~~~~~~~~~~~~~ Physical Undersea Fiber / Cables ~~~~~~~~~~~~~~~~~~~~
Receiving Server (De-Encapsulation):
Bits (L1) ──► Frame (L2) ──► Packet (L3) ──► Segment (L4) ──► Data (L5-L7)
5. The Practical Rule: How Engineers Use OSI for Troubleshooting
The greatest daily utility of the OSI model for network engineers and sysadmins is systematic, bottom-up fault isolation:
- Layer 1 Check: Is the ethernet cable plugged in? Is the fiber optic link light green? Is the wireless interface enabled?
- Layer 2 Check: Is the switch port up? Do we see the local router's MAC address in
arp -a? Is the VLAN configured properly? - Layer 3 Check: Do we have an IP address and valid subnet mask? Can we ping the local default gateway? Can we ping an external IP (
ping 8.8.8.8)? - Layer 4 Check: Is the TCP port open and listening? Test with
curl -v,nc -zv <ip> 443, ortelnet. Is a firewall blocking SYN packets? - Layer 6 Check: Is the TLS/SSL certificate valid? Did the cryptographic handshake fail with a cipher mismatch?
- Layer 7 Check: Does the web server return an HTTP 200, 404, or 502 Bad Gateway? Is the application process running?
By diagnosing issues from Layer 1 upward, network engineers avoid wasting hours troubleshooting application code when an unplugged patch cable or misconfigured subnet mask was the culprit all along.