OSI Model – Complete Reference Cheat Sheet
The OSI (Open Systems Interconnection) Model is a conceptual model that explains how data moves from one device to another across a network.
It divides network communication into seven distinct layers, each responsible for a specific function.
This model is widely used for learning, designing, documenting, and troubleshooting networks.
OSI Layers Overview
graph TD
L7[Layer 7 - Application]
L6[Layer 6 - Presentation]
L5[Layer 5 - Session]
L4[Layer 4 - Transport]
L3[Layer 3 - Network]
L2[Layer 2 - Data Link]
L1[Layer 1 - Physical]
L7 --> L6 --> L5 --> L4 --> L3 --> L2 --> L1
Layer 7 – Application Layer
The Application layer provides network services directly to end-user applications.
It defines how applications request and receive data over the network, but it does not include the application software itself.
Common examples include web browsing, email communication, and file transfers.
Protocols at this layer define request and response formats, commands, and status handling.
Typical protocols include HTTP and HTTPS for web communication, SMTP and IMAP for email services, DNS for name resolution, and FTP for file transfers.
At this layer, data is still referred to simply as data, as it has not yet been encapsulated into lower-layer structures.
Layer 6 – Presentation Layer
The Presentation layer is responsible for data representation.
It ensures that data sent by the Application layer can be correctly understood by the receiving system.
This layer handles character encoding (such as UTF-8 and ASCII), data compression, and encryption.
For example, when HTTPS is used, encryption and decryption processes occur at this layer.
It also ensures compatibility between different systems by translating data formats when needed, such as converting between text encodings or image formats like JPEG and PNG.
At this stage, the data unit is still referred to as data.
Layer 5 – Session Layer
The Session layer manages communication sessions between two systems.
It is responsible for establishing, maintaining, synchronizing, and terminating sessions.
This layer ensures that long-running communications remain organized and recoverable.
For example, if a connection temporarily drops, the session layer can help resume communication instead of restarting it entirely.
Technologies such as NetBIOS session services and remote procedure calls (RPC) are associated with this layer.
Data is still treated as data, but now within an active session context.
Layer 4 – Transport Layer
The Transport layer provides end-to-end communication between hosts.
It determines how data is divided, transmitted, acknowledged, and reassembled.
TCP is used when reliable delivery is required, ensuring ordered and complete data transfer.
UDP is used when speed is prioritized over reliability, such as in streaming or real-time applications.
At this layer, data is divided into segments (TCP) or datagrams (UDP).
Port numbers are introduced here, allowing multiple services to operate on the same host.
Layer 3 – Network Layer
The Network layer is responsible for logical addressing and routing.
It determines how packets are forwarded between different networks.
IP addressing (IPv4 and IPv6) operates at this layer, allowing devices to be uniquely identified across networks.
Routers use network-layer information to decide the best path for data delivery.
At this layer, data units are called packets.
Each packet contains source and destination IP addresses, enabling routing across multiple networks.
Layer 2 – Data Link Layer
The Data Link layer manages communication within the same local network.
It is responsible for framing, MAC addressing, and error detection.
Ethernet and Wi-Fi operate at this layer, defining how devices share the same medium.
Switches and network interface cards (NICs) work primarily at this layer.
Here, packets are encapsulated into frames.
Frames include source and destination MAC addresses and error-checking information.
Layer 1 – Physical Layer
The Physical layer defines how raw bits are physically transmitted.
It includes electrical signals, voltage levels, timing, connectors, and physical media.
Examples of physical media include copper cables (such as Ethernet), fiber optic cables, and wireless radio frequencies.
This layer also defines data rates, pin layouts, and modulation techniques.
At this layer, data is transmitted as bits—a stream of 0s and 1s.
Data Encapsulation Summary
graph LR
D[Data]
S[Segment]
P[Packet]
F[Frame]
B[Bits]
D --> S --> P --> F --> B
OSI vs TCP/IP Model
graph LR
OSI7[Application]
OSI6[Presentation]
OSI5[Session]
OSI4[Transport]
OSI3[Network]
OSI2[Data Link]
OSI1[Physical]
TCP4[TCP/IP Application]
TCP3[TCP/IP Transport]
TCP2[TCP/IP Internet]
TCP1[TCP/IP Network Access]
OSI7 --> TCP4
OSI6 --> TCP4
OSI5 --> TCP4
OSI4 --> TCP3
OSI3 --> TCP2
OSI2 --> TCP1
OSI1 --> TCP1