Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 17

Understanding the OSI Model Layers

Recommended resources

Hello! Welcome to the first lesson in our new module, "Networking Fundamentals for DevOps."

In the previous module, you built a strong foundation in Linux system administration, learning how to manage users, services, tasks, and logs. But systems rarely exist in isolation. As a DevOps engineer, you'll be managing complex applications distributed across multiple servers, containers, and cloud services. To make them work together, you need a solid understanding of how they communicate. That's where networking comes in.

This lesson kicks off our journey into networking by tackling a foundational concept. Our learning outcome is to explain the OSI model layers and their functions in network communication.

The OSI model is a conceptual framework—a "map" that helps us understand and talk about how data moves across a network. While it's theoretical, it provides a powerful mental model for diagnosing real-world problems. When something goes wrong, you can ask, "Is this a physical problem (Layer 1), an IP addressing problem (Layer 3), or an application problem (Layer 7)?" This structured approach is invaluable for efficient troubleshooting.

Let's dive in and build that map.

What is the OSI Model?

The OSI (Open Systems Interconnection) model was developed by the International Organization for Standardization (ISO) to standardize network communication. It breaks down the complex process of sending data from one device to another into seven distinct, manageable layers.

Think of it like manufacturing and shipping a product:

  1. You design the product (Application).
  2. You put it in its consumer packaging (Presentation).
  3. You get the shipping logistics ready (Session).
  4. You box it up for transport, maybe in multiple boxes (Transport).
  5. You label the boxes with a street address (Network).
  6. You put it on a local delivery truck to take it to the shipping hub (Data Link).
  7. The truck drives on the physical roads to get there (Physical).

To get a formal introduction, let's watch the first part of this excellent video from Professor Messer, a well-known resource for IT certification training.

Understanding the OSI Model - N10-008 CompTIA Network+ : 1.1

This video explains what the OSI model is, why it's used as a reference even though we primarily use the TCP/IP protocol suite today, and introduces the seven layers.

Please watch from the beginning up to 02:09. Focus on understanding the purpose of the OSI model as a common language for IT professionals.

As the video mentioned, a helpful mnemonic to remember the layers from top (Layer 7) to bottom (Layer 1) is: All People Seem To Need Data Processing.


The Seven Layers of the OSI Model

Now, let's explore what each layer does. We'll work our way down from Layer 7, the one closest to the user, to Layer 1, the physical hardware. As data moves down these layers on the sending device, it gets "wrapped" with information at each stage—a process called encapsulation.

OSI Model Layers and Functions
This diagram shows the seven layers of the OSI model. Notice the name of the data unit at each layer (Segments, Packets, Frames, Bits), which reflects the encapsulation process.

We will now watch the main segment of the Professor Messer video, which explains the function of each layer in detail.

Understanding the OSI Model - N10-008 CompTIA Network+ : 1.1

This segment provides a clear, layer-by-layer explanation of the OSI model, from the Physical layer up to the Application layer.

Please watch from 02:09 to 07:01. This covers all seven layers and their core responsibilities. Pay attention to the keywords associated with each layer (e.g., 'cabling' for Physical, 'MAC address' for Data Link, 'IP address' for Network).

Let's consolidate that information and, more importantly, connect it to the Linux environment you're already familiar with. The following article is a great guide because it links each layer to specific Linux commands.

Understanding the OSI Model - A complete guide for Linux & Networking beginners

This article provides a concise explanation of each layer and connects them to practical Linux commands you can use for diagnostics. This helps bridge the theory of the OSI model with the hands-on skills of a DevOps engineer.

Read the section titled 'OSI Model Layers Explained'. For each layer, note its purpose and the associated Linux command examples. We will refer back to these commands in future lessons.

Here is a summary of the layers, combining what you've learned from the video and the article:

Layer 7: The Application Layer

  • Function: Provides the interface for the end-user's application to access network services. This is the layer you interact with directly.
  • PDU (Protocol Data Unit): Data
  • Protocols/Examples: HTTP/HTTPS (web browsing), FTP (file transfer), DNS (domain name resolution), SSH (secure shell).
  • DevOps Context: When you use curl https://api.example.com or ssh user@server, you are operating at the Application Layer.

Layer 6: The Presentation Layer

  • Function: Translates, formats, and encrypts/decrypts data. It ensures that data sent from one system's application layer can be understood by the application layer of another system.
  • PDU: Data
  • Protocols/Examples: SSL/TLS (encryption for HTTPS), JPEG, MP4 (data compression), ASCII/UTF-8 (character encoding).
  • DevOps Context: This layer is responsible for the 'S' in HTTPS. When you use openssl to inspect a certificate, you're interacting with concepts from this layer.

Layer 5: The Session Layer

  • Function: Establishes, manages, and terminates communication sessions between two devices. It's like a conversation manager.
  • PDU: Data
  • Protocols/Examples: APIs that manage logins, NetBIOS. When you log into a service and it "keeps you logged in," the session layer is at work.
  • DevOps Context: The ss -t command can show you established TCP sessions, which relates to this layer's function.

Layer 4: The Transport Layer

  • Function: Responsible for end-to-end communication and reliability. It breaks data into smaller chunks called segments and uses port numbers to direct them to the correct service on the destination machine.
  • PDU: Segment
  • Protocols/Examples:
    • TCP (Transmission Control Protocol): Reliable, connection-oriented (guarantees delivery). Used for web, email.
    • UDP (User Datagram Protocol): Fast, connectionless (best effort). Used for video streaming, DNS.
  • DevOps Context: This is a critical layer for DevOps. Firewall rules often operate here (e.g., "allow port 443"). Commands like netstat -tuln or ss -tuln show you which ports are open for TCP/UDP connections.

Layer 3: The Network Layer

  • Function: Handles logical addressing and routing. It determines the best path to move data from the source to the destination across different networks.
  • PDU: Packet
  • Protocols/Examples: IP (Internet Protocol - IPv4/IPv6), ICMP (Internet Control Message Protocol). Routers operate at this layer.
  • DevOps Context: The IP address is the key concept here. Commands like ping and traceroute are classic Layer 3 diagnostic tools. ip addr show reveals a system's IP addresses.

Layer 2: The Data Link Layer

  • Function: Manages communication between devices on the same local network. It uses physical addresses (MAC addresses) to send data.
  • PDU: Frame
  • Protocols/Examples: Ethernet, Wi-Fi. Network switches operate at this layer.
  • DevOps Context: The ip link show command shows your network interfaces, and arp -a shows the mapping of IP addresses (L3) to MAC addresses (L2) on your local network.

Layer 1: The Physical Layer

  • Function: Transmits raw bits (1s and 0s) over the physical medium. This is all about the hardware.
  • PDU: Bits
  • Protocols/Examples: Ethernet cables (RJ45), fiber optics, Wi-Fi signals. Hubs and network interface cards (NICs) are Layer 1 devices.
  • DevOps Context: If a server is offline, the first check is often at Layer 1: "Is the network cable plugged in? Is the link light green?" The ethtool eth0 command can give you physical link status.
Test your understanding!

An application developer tells you, "I can't connect to the database server from my application server." You SSH into the application server and successfully ping the database server's IP address.

Based on this, which OSI layers are most likely working correctly, and at which layer would you focus your troubleshooting next?

Show answer
  • What's working: A successful ping (which uses ICMP) confirms that Layers 1, 2, and 3 are working. You have a physical connection (L1), local network connectivity (L2), and a valid route between the servers (L3).
  • Where to look next: The problem is likely at a higher layer. The most probable culprit is Layer 4 (Transport). The database might be running on a specific port (e.g., 3306 for MySQL) that is being blocked by a firewall on the application server, the database server, or somewhere in between. Your next step would be to test the port connection using a tool like nc or telnet.

How It All Works Together: Data Flow and Encapsulation

Now let's see how a simple action, like browsing a website, involves every single layer. The data you request is encapsulated as it goes down the stack on the server and de-encapsulated as it comes up the stack on your machine.

This final clip from the Professor Messer video gives a fantastic, practical walkthrough using Google Mail as an example.

Understanding the OSI Model - N10-008 CompTIA Network+ : 1.1

This clip ties everything together by walking through a real-world example of how all seven layers are involved when you access a web application.

Watch from 10:12 to 11:55. Observe how a single action flows down and up the seven layers, with each layer playing its specific part.


Conclusion

Congratulations on completing your first lesson in networking! You've built a mental framework that will serve as your guide for the rest of this module and throughout your career. While you won't be citing OSI layer numbers daily, this model provides the vocabulary and structure to think logically about network problems.

Key Takeaways:

  • The OSI model is a 7-layer conceptual framework for understanding network communication.
  • It provides a common language for troubleshooting, allowing you to isolate problems layer by layer.
  • Data moving down the stack is encapsulated:
    • Layers 7, 6, 5: Data
    • Layer 4 (Transport): Segments (with Port numbers)
    • Layer 3 (Network): Packets (with IP addresses)
    • Layer 2 (Data Link): Frames (with MAC addresses)
    • Layer 1 (Physical): Bits
  • As a DevOps engineer, you can map common Linux commands (ping, ss, curl) to different OSI layers to aid in diagnostics.

In our next lesson, we will zoom in on the core of Layer 3. We'll explore IPv4 addresses, learn the difference between public and private IP ranges, and understand why this addressing scheme is fundamental to how the internet works.