What is an OSI Model?
Demystify network communication with this practical guide to the OSI model. Understand all 7 layers with real-world examples and analogies.


15 Kubernetes Metrics Every DevOps Team Should Track
Enhance Your Kubernetes Strategy with These Essential Metrics
Download our comprehensive eBook on optimizing Kubernetes performance. This guide delves into crucial cluster state, resource, and control plane metrics, highlighting 15 of the most essential metrics your DevOps team should be tracking. Learn how to gain complete visibility into your containerized environments and optimize Kubernetes performance with Datadog.
What Does OSI Stand For?
OSI stands for Open Systems Interconnection. The name itself reveals its purpose: to create an open standard for different computer systems to connect and communicate with one another, regardless of their underlying architecture. It was developed by the International Organization for Standardization (ISO) to guide the creation of universal networking protocols.
The 7 Layers of the OSI Model at a Glance
Layer Number | Layer Name | Primary Function | Simple Analogy (Sending a Letter) |
|---|---|---|---|
7 | Application | Provides network services to end-user applications. | Writing the actual content of your letter. |
6 | Presentation | Translates, encrypts, and compresses data. | Placing the letter in a standard envelope. |
5 | Session | Manages communication sessions between devices. | Addressing the letter to a specific person. |
4 | Transport | Ensures reliable data delivery and handles flow control. | Choosing a mail service (e.g., certified, express). |
3 | Network | Routes data packets across different networks. | The postal service routing the letter across cities. |
2 | Data Link | Manages data transfer between nodes on the same network. | The local mail carrier delivering to the correct street. |
1 | Physical | Transmits raw data bits over a physical medium. | The physical truck or plane carrying the mail. |

Diving Into the Upper Layers: Where Applications Talk
Our trip through the OSI model kicks off at the very top of the stack, with the layers closest to you, the end-user. These three Application, Presentation, and Session are often lumped together as the "upper layers." They're almost always handled by software and are all about getting data from your applications ready for its big journey across the network. Their job is to make sure the data is understandable, secure, and part of a smooth, organized conversation.
Layer 7: The Application Layer
The Application Layer is the interface you interact with, but it often gets confused with the application itself, like Chrome or Outlook. Instead, it's the set of protocols these applications use to communicate with the network. When you input a URL or send an email, you're using a Layer 7 protocol, allowing software to access network services directly.
Examples of Application Layer Protocols:
HTTP/S: Used by browsers to request and display web pages.
SMTP: Used by email clients to send messages to mail servers.
FTP: Designed for transferring files between a client and server.
DNS: Translates domain names into IP addresses when you enter a URL.
Key Point: The Application Layer provides the protocols that enable applications to send and receive information, connecting users with the network.
Layer 6: The Presentation Layer
Once the Application Layer prepares its message, it passes it to the Presentation Layer, which acts as a universal translator. This layer ensures data from one system's application layer is readable by another's. Its main tasks are:
Data Translation and Formatting: Converts data into a standard format, like changing EBCDIC to ASCII, ensuring consistency across systems.
Data Compression: Reduces data size for efficient transmission, with decompression on the receiving end.
Encryption and Decryption: Secures data by encrypting it at the sender's end and decrypting it at the receiver's, using protocols like SSL and TLS.
Example: When accessing your bank's website (https://), TLS encryption at Layer 6 secures your login credentials.
Layer 5: The Session Layer
The Session Layer acts as the conversation manager, organizing communication "sessions" between devices. Unlike lower layers that handle raw data transfer, Layer 5 sets up, manages, and dismantles these sessions. For instance, when accessing an online bank account, it maintains your session as you navigate between different sections, preventing repeated logins.
Additionally, the Session Layer can implement checkpoints during data transfers. If a download, like a 2GB file, is interrupted at 1.5GB, it can resume from the last checkpoint rather than restarting. This mechanism is part of reliable data transfer, further explained in our guide on what is TCP.
Understanding the Core Transport and Network Layers
As our data makes its way down from the application-focused upper layers, it hits the very heart of the OSI model: the Transport and Network layers. These two layers are the engine room of network communication. They work hand-in-hand to make sure your data doesn't just get to the right place, but that it also arrives reliably and in one piece.
Think of them as the logisticians and traffic directors of the internet.
Layer 4: The Transport Layer
The Transport Layer, or Layer 4, ensures effective end-to-end communication and data integrity. It divides data from higher layers into smaller units called segments (for TCP) or datagrams (for UDP) and reassembles them in order on the receiving side.
Think of Layer 4 as a shipping manager deciding on the delivery method: whether a package needs confirmation upon receipt or can be quickly dropped off. This decision is crucial, leading to the two key protocols of the Transport Layer:
Transport Layer Protocols:
TCP (Transmission Control Protocol): Acts like "certified mail" slow but reliable. It establishes a connection via a three-way handshake, numbers each segment, ensures delivery, and requests resends for lost segments. Ideal for tasks needing precision, such as web pages, emails, and file downloads.
UDP (User Datagram Protocol): Functions as a speedy, connectionless "fire-and-forget" method. It sends segments without establishing a connection or verifying arrival, reducing overhead. This is perfect for applications where speed is crucial, like video streaming, online gaming, or DNS lookups.
Key Insight: The choice between TCP and UDP at Layer 4 is a fundamental trade-off between reliability and speed. TCP guarantees delivery but comes with higher overhead, while UDP prioritizes low latency at the risk of some data loss. You can explore a detailed comparison in our article covering what is UDP.
Layer 3: The Network Layer
Below the Transport Layer is Layer 3, the Network Layer, which handles routing data packets from a source to a destination network. Using logical addressing, each network device receives a unique IP address. The Network Layer adds a header with source and destination IPs to segments, forming packets.
For instance, when accessing a website, your computer (e.g., IP 192.168.1.10) sends a request to the server (e.g., IP 104.18.30.123). Routers forward packets using the destination IP until they reach the server, a process known as routing. If a route gets congested or fails, routers dynamically find alternate paths to ensure data transmission continues smoothly. For more on network addresses and routing, explore topics like IPv4, IPv6, and NAT.
Navigating the Lower Layers of Hardware and Links
As data travels down from the core layers, it finally hits the world of hardware and local connections. Here, abstract ideas like routing and transport get very real. We're now talking about how to get data between machines that are physically on the same network. This is the realm of MAC addresses, network switches, and the raw electrical signals that form the bedrock of the entire OSI model.

We'll kick things off with Layer 2, which serves as the crucial bridge between the logical addressing of the Network Layer and the raw physical transmission happening just below it.
Layer 2: The Data Link Layer
The Data Link Layer facilitates direct data transfer between devices on the same local network. It encapsulates packets from Layer 3 into a frame. This layer assigns a physical address, with the MAC (Media Access Control) address acting like an apartment number within a building, distinct from the building's IP address.
Key responsibilities include:
Framing: Encapsulates packets with a header containing source and destination MAC addresses.
Physical Addressing: Uses MAC addresses to identify devices on a local network.
Error Control: Conducts error checking to ensure frame integrity during transmission.
Layer 1: The Physical Layer
The Physical Layer, the base of the OSI model, focuses solely on transmitting raw bits (1s and 0s) across a physical medium, ignoring packets, frames, or addresses. It sets the physical and electrical standards for signal transmission.
Key Takeaway: The Physical Layer concerns the hardware that transmits data, such as cables, connectors, and antennas.
Key components include cables, network interface cards, and physical ports. For businesses, resources like leased lines provide reliable Layer 1 infrastructure.
Layer 1 Technology Examples:
Cabling: Involves Ethernet, fiber optic, and coaxial cables, detailing pin layouts and max lengths.
Radio Frequencies: Defines radio waves for wireless data transmission.
Electrical Signals: Specifies voltage for data on copper wires and light pulses for fiber optics.
Hubs vs. Switches: A Layer 1 vs. Layer 2 Story
To understand the difference between the bottom two layers, compare a hub (Layer 1) with a switch (Layer 2).
A hub is basic and repeats signals to all ports without understanding addresses, operating at the Physical Layer.
A switch is more advanced, reading MAC addresses to send data to the correct port, enhancing network efficiency and security.
This distinction is crucial for network design and troubleshooting. For more on how low-level addresses map to human-readable names, see our guide on DNS.
Tracing Data Flow Through the OSI Model
To understand how the OSI model layers function together, let's look at the journey of a single piece of data an email from the moment you hit "send" until it appears in your friend's inbox.
The Journey: Encapsulation
Your data begins at the top of the OSI stack, moving downward. Each layer adds a new header to prepare it for the network.
Layers 7, 6, and 5 (Application, Presentation, Session): Your email client uses SMTP to send "See you at 8!" The Presentation Layer standardizes and possibly encrypts the text, while the Session Layer establishes the connection with the email server.
Layer 4 (Transport): The Transport Layer uses TCP to segment the message into smaller parts, adding port numbers to direct the data to the email application.
Layer 3 (Network): The Network Layer wraps each segment in a packet, attaching IP addresses for routing.
Layer 2 (Data Link): The packet is enclosed within an Ethernet frame, which includes MAC addresses and error-checking data.
Layer 1 (Physical): The frame is converted into bits and transmitted as electrical signals or radio waves.
Your email is now a series of signals rapidly departing your device.
Across the Internet and Back Up: De-encapsulation
Once signals reach your local router, it reverses the process: it removes the Layer 2 frame to read the Layer 3 IP packet, determines the best path, and forwards it. This hop-by-hop journey continues until the packets reach your friend's network.
Upon arrival at the recipient's computer, de-encapsulation occurs, reversing the initial process:
Layer 1: Physical signals become a bitstream.
Layer 2: Bits form frames, errors are checked, and Ethernet headers/trailers are removed.
Layer 3: IP packets are unwrapped, the destination IP is confirmed, and the IP header is discarded.
Layer 4: TCP segments are reordered and original data is recreated, removing the TCP header.
Layers 5, 6, and 7: The connection is managed, data is decrypted/formatted, and the message is delivered to the email client.
The Big Picture: This process, from encapsulation to de-encapsulation, occurs in milliseconds, showcasing the OSI model's layered abstraction. Each layer performs its role without knowing about others.
The OSI vs. The TCP/IP Model
Think of it like this: TCP/IP is the trusty, street-legal car that millions of people drive every single day. The OSI model is the incredibly detailed engineering schematic that a master mechanic uses to understand how every component from the engine timing to the wiring works together. You don't need the schematic to drive the car, but if you want to diagnose a tricky problem or build a new car from scratch, that schematic is priceless.
The OSI model’s true value became undeniable during the internet's explosive growth. Its layered approach provided a clear guide for creating new, interoperable technologies. You can dive deeper into how this conceptual framework became foundational to networking on Wikipedia.
Comparing OSI Model Layers to TCP/IP Model Layers
The best way to see the relationship between the two is to map them side-by-side. The OSI model’s seven layers offer a fine-grained view, while the TCP/IP model’s four layers group several functions together.
This table shows exactly how they line up.
OSI Model Layer | TCP/IP Model Layer | Key Protocols |
|---|---|---|
7. Application | 4. Application | HTTP, FTP, SMTP, DNS |
6. Presentation | SSL/TLS, JPEG, ASCII | |
5. Session | NetBIOS, RPC | |
4. Transport | 3. Transport | TCP, UDP |
3. Network | 2. Internet | IP, ICMP |
2. Data Link | 1. Network Access | Ethernet, PPP, Switches |
1. Physical | Hubs, Cables, Wi-Fi |
As you can see, TCP/IP bundles the OSI model's top three layers (Application, Presentation, and Session) into a single Application layer. It does the same at the bottom, combining the Physical and Data Link layers into its Network Access layer.
Key Takeaway: You really need to know both. TCP/IP is the model for how things actually work in the real world. But the OSI model is a far better tool for learning, teaching, and systematically troubleshooting network problems because it breaks everything down so logically.
Rohit Lakhotia
Rohit Lakhotia is a software engineer and writer covering engineering, career growth, and the tech industry.