OSI Model
What is the OSI Model?
The OSI (Open Systems Interconnection) model is a conceptual framework developed by ISO in 1984 that standardizes how different network systems communicate. It divides network communication into 7 layers, each with specific responsibilities. The model helps understand how data travels from one computer to another across a network.
Mnemonic to remember layers (top to bottom): "All People Seem To Need Data Processing" (Application, Presentation, Session, Transport, Network, Data Link, Physical)
The 7 Layers of OSI Model
| # | Layer | PDU | Key Functions | Protocols/Examples |
|---|---|---|---|---|
| 7 | Application | Data | User interface, network services to applications, email, file transfer | HTTP, HTTPS, FTP, SMTP, DNS, DHCP, SSH, Telnet |
| 6 | Presentation | Data | Data translation, encryption/decryption, compression, format conversion | SSL/TLS, JPEG, MPEG, ASCII, EBCDIC, GIF |
| 5 | Session | Data | Establishes, manages, and terminates sessions between applications | NetBIOS, RPC, PPTP, SQL sessions |
| 4 | Transport | Segment | End-to-end communication, segmentation, flow control, error recovery, port numbers | TCP, UDP, SCTP |
| 3 | Network | Packet | Logical addressing (IP), routing, path determination, fragmentation | IP (IPv4/IPv6), ICMP, OSPF, BGP, RIP, ARP |
| 2 | Data Link | Frame | Physical addressing (MAC), error detection (CRC), flow control, access control | Ethernet, Wi-Fi (802.11), PPP, HDLC, ARP |
| 1 | Physical | Bit | Transmission of raw bits over physical medium, voltage levels, cable types, connectors | Ethernet cables, fiber optic, Wi-Fi radio, USB, Bluetooth |
Layer Details
Layer 7 - Application Layer: The topmost layer that provides network services directly to end-user applications. It defines protocols for specific applications like web browsing (HTTP), email (SMTP), and file transfer (FTP). This is the layer users interact with.
Layer 6 - Presentation Layer: Responsible for data translation between the application and network formats. It handles encryption/decryption (SSL/TLS), data compression, and character encoding (ASCII to EBCDIC). Ensures data is in a readable format for the application layer.
Layer 5 - Session Layer: Manages sessions (connections) between applications. It establishes, maintains, and terminates communication sessions. Provides checkpointing and recovery for long data transfers.
Layer 4 - Transport Layer: Provides reliable end-to-end data transfer. TCP provides connection-oriented, reliable delivery with flow control and error recovery. UDP provides connectionless, faster but unreliable delivery. Uses port numbers to identify applications.
Layer 3 - Network Layer: Handles logical addressing (IP addresses) and routing. Determines the best path for data to travel from source to destination across multiple networks. Routers operate at this layer.
Layer 2 - Data Link Layer: Provides node-to-node data transfer between directly connected nodes. Uses MAC addresses for physical addressing. Detects and corrects errors from the physical layer. Switches and bridges operate at this layer.
Layer 1 - Physical Layer: Transmits raw bits over a physical medium. Defines electrical, mechanical, and procedural specifications for activating, maintaining, and deactivating physical connections. Hubs and repeaters operate at this layer.
Data Encapsulation
As data travels down the OSI layers from sender to receiver, each layer adds its own header (and sometimes trailer) — this is called encapsulation. At the receiver, each layer removes its header — this is called decapsulation.
- Application data → Transport adds TCP/UDP header → becomes Segment
- Segment → Network adds IP header → becomes Packet
- Packet → Data Link adds MAC header + trailer → becomes Frame
- Frame → Physical converts to Bits for transmission
Ready to Level Up Your Skills?
Explore 500+ free tutorials across 20+ languages and frameworks.