Hello! Welcome to your first lesson in the Cybersecurity course. I'm excited to start this journey with you. Given your goal to become a penetration tester, we're going to start with the absolute bedrock of all hacking: understanding how networks talk.
Today, we'll focus on explaining the OSI and TCP/IP models and the function of protocols at each layer. Think of this as learning the map of the digital world before you learn how to navigate it or find its hidden passages. Every tool you've used, like Nmap or Wireshark, and every attack you'll learn, operates according to the rules of these models. Mastering them is non-negotiable for a skilled ethical hacker.
We'll start with the OSI model, a conceptual blueprint, then move to the TCP/IP model, which is what the real internet runs on. Finally, we'll see how this knowledge directly applies to penetration testing.
1. The Blueprint: The OSI Model
First, we need to understand the Open Systems Interconnection (OSI) model. While not used in practice today, it's the standard teaching tool because it breaks down the complex process of network communication into seven distinct, manageable layers. Understanding this theoretical framework makes it much easier to diagnose problems and understand where specific attacks and defenses operate.
To get a quick and clear overview of these seven layers, please watch the following video from the ByteByteGo channel.
What is OSI Model | Real World Examples
This video provides a great animated introduction to the OSI model, covering the first four layers in detail and summarizing the top three.
Watch the video from the beginning until the timestamp 02:10. Focus on the name and primary responsibility of each of the first four layers: Physical, Data Link, Network, and Transport.
Now that you have a visual idea, let's solidify that knowledge with a more detailed reading that connects these concepts directly to cybersecurity.
Networking for Cybersecurity (Part 1): OSI, TCP/IP, Ports & ...
This article, 'Networking for Cybersecurity (Part 1),' is written from a practical perspective. It explains why these models are crucial for anyone in the security field.
Please read Section 2, 'The OSI Model: The 7 Layers Explained Clearly.' As you read, pay attention to the examples given for each layer and the brief notes on how they relate to security attacks.
To summarize, the seven layers of the OSI model are:
- Layer 7: Application: Where user-facing applications like your web browser operate (HTTP, FTP, SMTP).
- Layer 6: Presentation: Handles data formatting, translation, and encryption (e.g., TLS/SSL).
- Layer 5: Session: Manages the dialogue (session) between two computers.
- Layer 4: Transport: Provides reliable or unreliable data delivery between hosts (TCP, UDP).
- Layer 3: Network: Handles logical addressing and routing between different networks (IP).
- Layer 2: Data Link: Deals with physical addressing on the local network (MAC addresses, Ethernet).
- Layer 1: Physical: The actual hardware that transmits signals (cables, Wi-Fi).
A common mnemonic to remember the layers is: Please Do Not Throw Sausage Pizza Away.
2. The Real World: The TCP/IP Model
The OSI model is the theory, but the TCP/IP model is the reality. The internet is built on the TCP/IP protocol suite. It's a more practical model that condenses the seven OSI layers into four (or sometimes five) layers.
This image provides a perfect side-by-side comparison.

As you can see, the Application, Presentation, and Session layers of the OSI model are combined into a single Application layer in the TCP/IP model. The lower layers map more directly.
Let's watch a video that focuses specifically on the TCP/IP model.
TCP/IP Model Explained | Cisco CCNA 200-301
The 'TCP/IP Model Explained' video from CertBros clearly outlines the layers of the TCP/IP model and compares them back to the OSI model you just learned.
Watch from 00:54 to 02:39. This covers the layers of the TCP/IP model, its comparison to the OSI model, and the common protocols and devices you'll find at each layer.
The TCP/IP model is often shown with either four or five layers. The five-layer version splits the "Link" or "Network Access" layer into the Data Link and Physical layers, making it align even more closely with the OSI model. For our purposes, the key is to understand the functions, not to get hung up on the number of layers.
3. How Data Moves: Encapsulation and Decapsulation
When you send data—for example, loading a webpage—it doesn't just go out as one big block. It travels down the stack of layers on your computer, and each layer wraps the data in a new "envelope" with its own addressing information. This process is called encapsulation. The receiving computer does the reverse, unwrapping each layer to get to the original data. This is decapsulation.
Each "envelope" has a special name, called a Protocol Data Unit (PDU):
- Segment/Datagram: At the Transport Layer (Layer 4), data is encapsulated into a TCP segment or a UDP datagram.
- Packet: At the Network Layer (Layer 3), the segment is encapsulated into an IP packet.
- Frame: At the Data Link Layer (Layer 2), the packet is encapsulated into a frame.
The video you just watched has an excellent animation of this process. Let's re-watch that specific part.
TCP/IP Model Explained | Cisco CCNA 200-301
This section of the CertBros video visually explains encapsulation and introduces the specific names for data at each step of the process.
Watch from 02:39 to 05:13. Focus on how each layer adds its own header (and sometimes a trailer) and the name changes: Data -> Segment -> Packet -> Frame.
This concept is vital in penetration testing. When you use Wireshark to capture traffic, you are looking at these frames, packets, and segments. Attacks often involve inspecting or manipulating the headers added during encapsulation.
Test your understanding!
You've captured network traffic and are looking at a chunk of data. Its header contains a source IP address and a destination IP address. What is the PDU name for this unit of data, and at which layer of the OSI model does it primarily operate?
Show answer
The PDU is a Packet, and it operates at the Network Layer (Layer 3). The key clue is the presence of IP addresses, which are used for routing between networks at this layer.
4. The Penetration Tester's View of Networking Models
So, why does this matter for you? Because every attack targets a specific layer. Understanding the models allows you to:
- Categorize vulnerabilities: Is this a low-level network attack or a high-level application flaw?
- Select the right tools:
Nmapoperates primarily at Layers 3 and 4.Burp Suiteoperates at Layer 7. - Understand defenses: A traditional firewall operates at Layers 3 and 4, while a Web Application Firewall (WAF) operates at Layer 7.
This final resource ties everything together from an ethical hacker's perspective. It discusses attack use cases and tools for each layer of the OSI model. Since you're already familiar with some of these tools, this should connect the theory directly to your practical experience.
The OSI Model for Ethical Hackers: Practical Applications, Not ...
This article, 'The OSI Model for Ethical Hackers,' is a fantastic resource that translates the theoretical layers into concrete attack vectors and pentesting tools.
Read the section 'Layer-by-Layer: OSI Model in Action for Ethical Hackers.' For each layer, note the 'Hacker Use Case' and the 'Tools' listed. Think about how you might have used tools like Nmap or Wireshark in the past and which layers you were interacting with.
Test your understanding!
An attacker uses a tool like Ettercap to perform an ARP spoofing attack to intercept traffic on a local coffee shop's Wi-Fi network. At which layer of the OSI model is this attack taking place?
Show answer
This is a Layer 2 (Data Link Layer) attack. ARP (Address Resolution Protocol) maps Layer 3 IP addresses to Layer 2 MAC addresses, and the attack works by poisoning the ARP cache on a local network, which is a Layer 2 function.
Conclusion
Great work today. We've covered a lot of foundational ground that will serve you throughout your entire cybersecurity career.
Here are the key takeaways:
- The OSI Model is a 7-layer conceptual framework essential for understanding the theory of networking.
- The TCP/IP Model is a 4 or 5-layer practical model that powers the modern internet.
- Encapsulation is the process of wrapping data in headers as it moves down the network stack. Each layer adds information vital for communication.
- Every cyber attack, defensive tool, and network protocol operates at a specific layer. As a penetration tester, knowing the layers helps you choose the right tool for the job and understand exactly what you're attacking.
In our next lesson, we will put this theory into practice. You'll learn how to analyze network traffic with Wireshark to identify protocols and communication patterns. This will allow you to see the frames, packets, and segments we discussed today in a real-world context.