ReviseAlgo Logo

Networking & Web Fundamentals

OSI Model

The seven-layer conceptual model that standardizes network communication.

In short

The seven-layer conceptual model that standardizes network communication.

Last Updated: June 26, 2026 25 min read

1. Learning Objectives

By the end of this lesson, you will be able to:

  • Identify and define the role of all seven layers in the OSI conceptual model.
  • Explain the precise difference between encapsulation and decapsulation as data moves through the network.
  • Distinguish between Layer 4 (Transport) and Layer 7 (Application) routing and load balancing, choosing the appropriate type for specific production architectures.
  • Map common network diagnostic tools (e.g., ping, netcat, curl, ethtool) to their corresponding OSI layer to speed up system troubleshooting.
  • Understand and design for layer-specific constraints such as Maximum Transmission Unit (MTU) limitations and TLS handshakes.

2. Prerequisites

To get the most out of this lesson, you should be familiar with:

  • Basic Client-Server Model: Understanding how web requests and API endpoints work conceptually.
  • Introductory Web Protocols: Basic exposure to names like HTTP, TCP, and IP.
  • Command-Line Interface (CLI): Comfort running simple commands in a Linux or macOS terminal.

3. Why This Topic Matters

In modern cloud architectures, networking is the glue that holds microservices, databases, and caches together. When a service goes down, engineers cannot afford to guess. By using the OSI (Open Systems Interconnection) model, you establish a structured mental model that allows you to diagnose failures layer by layer.

Furthermore, critical infrastructure decisions — such as selecting a Layer 4 Network Load Balancer (NLB) versus a Layer 7 Application Load Balancer (ALB), configuring firewalls vs. Web Application Firewalls (WAFs), or troubleshooting MTU black holes — rely entirely on understanding where these technologies sit within the OSI stack. Operating without this model makes debugging distributed systems highly inefficient.

4. Real-world Analogy

Think of the OSI model as sending a multi-volume manuscript through an international courier service:

  • Layer 7 (Application): You write the manuscript. This is the raw content you want to share (e.g., your browser composing an HTTP request).
  • Layer 6 (Presentation): You translate the manuscript into a globally accepted format (e.g., PDF) and encrypt it in a locked box to protect sensitive details.
  • Layer 5 (Session): You call the recipient to establish a formal agreement to exchange books and coordinate the shipment timing.
  • Layer 4 (Transport): The manuscript is too heavy for a single parcel, so you break it down into numbered packages (Package 1 of 5, Package 2 of 5). If package 3 is lost, the courier knows exactly which one to request again (TCP flow and sequence controls).
  • Layer 3 (Network): You label each box with the global destination address (equivalent to an IP address) so that international routing hubs can guide it across states and countries.
  • Layer 2 (Data Link): The boxes are loaded onto local postal trucks. Each truck driver has a route sheet indicating the immediate next stop or distribution depot (comparable to physical MAC addresses).
  • Layer 1 (Physical): The actual roads, airline routes, and railway tracks that transport the physical trucks (copper wires, fiber optic cables, and radio waves).

5. Core Concepts

OSI Model vs. TCP/IP Model

The OSI Model is a theoretical 7-layer framework published by the ISO in 1984. It is widely used to reason about networking concepts. However, the internet was built on the TCP/IP Model (often called the Internet Protocol Suite), which consolidated Session, Presentation, and Application layers into a single "Application" layer, and Physical and Data Link into a single "Network Access" layer. Think of OSI as the conceptual blueprint and TCP/IP as the practical real-world implementation.

Protocol Data Units (PDUs)

As data moves down the stack, it changes names. Each layer wraps the layer above it with metadata, creating a specific Protocol Data Unit (PDU):

  • Data: The unit at Layers 7, 6, and 5.
  • Segment: The unit at Layer 4 (TCP/UDP headers added).
  • Packet: The unit at Layer 3 (IP headers added).
  • Frame: The unit at Layer 2 (MAC headers and trailers added).
  • Bits: The unit at Layer 1 (raw 1s and 0s on the wire).

Encapsulation and Decapsulation

When sending data, the process of traversing down the stack and adding headers/trailers is called encapsulation. When the receiver processes this data, it traverses up the stack, stripping away headers to extract the raw data payload. This reverse process is called decapsulation.

6. Visualization

The diagram below illustrates how data is encapsulated as it travels down the OSI stack from sender to receiver, and how each layer adds its own header (and sometimes trailer):

7. How It Works

Let's trace how communication occurs step-by-step between client and server:

  1. Application Layer (L7) Creation: A user tries to load a page. The browser generates a request (e.g., GET /index.html HTTP/1.1).
  2. Presentation Layer (L6) Translation: The data is serialized (like JSON or HTML structure), compressed, and encrypted using TLS/SSL protocols.
  3. Session Layer (L5) Synchronization: A logical communication session is initiated. The layer manages the state and keeps track of active connections, ensuring multiple applications on the system don't mix up network traffic streams.
  4. Transport Layer (L4) Segmentation: The data stream is chunked into manageable Segments. It adds a source port (e.g., 51234) and destination port (e.g., 443). It configures sequence numbers for reordering and checksums to ensure integrity (TCP).
  5. Network Layer (L3) Packetization: The Transport Segment is wrapped into an IP Packet. Source IP (e.g., 192.168.1.50) and Destination IP (e.g., 93.184.216.34) are added to the packet header, allowing the packet to be routed globally.
  6. Data Link Layer (L2) Framing: The IP Packet is wrapped inside a Frame. It adds the local Source MAC address (e.g., 00:1A:2B:3C:4D:5E) and the next-hop router's MAC address (retrieved via ARP). An Ethernet trailer (FCS) is appended for hardware-level error detection.
  7. Physical Layer (L1) Transmission: The frame is converted into raw electrical voltages, fiber-optic light pulses, or radio frequencies and is pushed onto the physical medium.

At the receiving node, this entire sequence is executed in reverse: L1 converts signals back to bits, L2 verifies the MAC address and strips the frame header, L3 checks the IP and strips the packet header, L4 uses ports to route segments to the listening application process, L6 decrypts/deserializes, and L7 delivers the original HTTP request to the web server process.

8. Internal Architecture

Understanding components, protocols, and vulnerabilities at each layer is essential to building reliable architectures. The table below profiles the details of the OSI layers:

Layer Name PDU Key Protocols / Components Common Failures / Faults
L7 Application Data HTTP, HTTPS, FTP, SMTP, DNS, WebSockets, gRPC CORS errors, DNS query timeout, API bugs, invalid routes
L6 Presentation Data TLS/SSL, JSON, XML, JPEG, UTF-8, ASCII serialization TLS cipher mismatch, expired certificate, deserialization error
L5 Session Data NetBIOS, RPC, SOCKS, gRPC streams, TLS session resumption Session timeout, socket leaks, RPC connection drops
L4 Transport Segment TCP, UDP, SCTP, ports (e.g., 80, 443) TCP port exhaustion, socket backlog full, network congestion
L3 Network Packet IPv4/IPv6, ICMP, BGP, OSPF, routers Route loop, IP conflicts, MTU mismatch, firewalls blocking traffic
L2 Data Link Frame Ethernet, Wi-Fi (802.11), MAC addresses, ARP, switches MAC address duplication, broadcast storms, ARP cache poisoning
L1 Physical Bit Ethernet cables, fiber optics, hubs, NICs, Wi-Fi antennas Damaged cable, hardware failure, RF signal attenuation

9. Request Lifecycle

To see the OSI model in action, let's follow the complete end-to-end traversal of a client request making an HTTPS call to https://api.example.com/health:

Phase A: Local Domain Name Resolution

  • The application needs to resolve api.example.com. It generates a DNS request (L7).
  • This request goes through L4 (UDP) and L3 (IP) to reach the DNS resolver.
  • Once the IP address (e.g., 93.184.216.34) is returned, the actual HTTP lifecycle can begin.

Phase B: The Transport Layer Handshake

  • The browser initiates a TCP 3-way handshake (L4) on destination port 443.
  • The packets are routed across routers (L3) and switches (L2) using MAC and IP routing tables.
  • Once the connection is established, the socket goes into the ESTABLISHED state.

Phase C: Encryption Negotiation (L6)

  • The TLS handshake begins. The client sends a ClientHello listing supported ciphers (L6).
  • The server replies with a certificate and selects a cipher suite.
  • Cryptographic key exchange occurs, ensuring all subsequent L7 HTTP payloads are fully encrypted.

Phase D: Payload Transmission and Processing

  • The client browser constructs the HTTP payload: GET /health HTTP/1.1\r\nHost: api.example.com... (L7).
  • The payload travels down the stack, gets wrapped in TCP segments (L4), IP packets (L3), and Ethernet frames (L2), then gets transmitted as light over fiber or electrical signals over copper (L1).
  • The network switches (L2) inspect target MACs; the routers (L3) inspect target IPs to hop the data to the destination host.
  • The receiving machine decapsulates the frames, packets, and segments, decodes the TLS payload, and delivers the request to the application process, which replies with a 200 OK response.

10. Deep Dive

L4 vs. L7 Load Balancing

In distributed system design, load balancers fall into categories aligned with the OSI model:

  • Layer 4 Load Balancer (TCP/UDP-based): Operates strictly at the transport layer. It parses the TCP/UDP packet headers to read the source IP, destination IP, and ports. It is completely blind to HTTP content, paths, headers, or parameters. It maintains high performance because it doesn't decrypt TLS or parse strings; it simply forwards packets (e.g., using Network Address Translation or Direct Server Return). Examples include AWS NLB and HAProxy in TCP mode.
  • Layer 7 Load Balancer (Application-based): Terminates the client's TLS connection (L6/L7), parses the HTTP request headers, paths, cookies, and query parameters, and routes the request. This enables features like path-based routing (e.g., forwarding /api/v1/checkout to checkout service, and /static/ to an S3 bucket) and A/B testing. However, it requires significant CPU/memory resources for TLS decryption and header processing. Examples include AWS ALB, NGINX, and Envoy.

Maximum Transmission Unit (MTU) & Path MTU Discovery

The Maximum Transmission Unit (MTU) defines the maximum size of a packet that can be transmitted over a physical medium without fragmentation. In typical Ethernet networks (L2), this is 1500 bytes.

If an L3 IP packet exceeds this limit (e.g., 2000 bytes) and needs to cross a medium restricted to 1500 bytes, the transit router must split the packet into multiple fragments, adding CPU overhead and increasing packet loss risk. If the DF (Don't Fragment) bit is set in the IP header, the router drops the packet and sends an ICMP Destination Unreachable - Fragmentation Needed message back to the sender. This mechanism is called Path MTU Discovery (PMTUD).

TCP Flow Control vs. Congestion Control

At Layer 4, TCP uses two distinct mechanism categories to ensure reliable delivery:

  • Flow Control (Receiver Protection): Implemented via the Sliding Window size header, this prevents a fast sender from overwhelming a slow receiver's buffer space.
  • Congestion Control (Network Protection): Managed dynamically via algorithms like TCP Reno, BBR, or Cubic, this monitors packet drop rates and round-trip times to scale back transmission speed, preventing network switches from dropping packets due to queue buffers overflowing.

11. Production Example

Let's look at how large-scale cloud providers, like Amazon Web Services or Netflix, structure edge routing across the OSI layers to support millions of concurrent users:

1. Edge DNS and Routing (L7)

DNS queries route the user to the nearest Cloudfront CDN POP (Point of Presence) using latency-based routing policies at the application level.

2. DDoS Mitigation (L3/L4)

At the network edge, firewalls and scrubbing systems (like AWS Shield or Cloudflare Magic Transit) filter out malformed L3 packets, SYN flood attacks (L4), and high-volume UDP amplification floods before they touch application servers.

3. High-Throughput Load Balancing (L4)

AWS Network Load Balancers (NLB) receive traffic. NLB is built on Hyperplane, an internal low-latency key-value routing fabric that handles traffic at Layer 4, mapping millions of incoming TCP connections to backend pools without examining HTTP content.

4. Application Gateway & Routing (L7)

Traffic is forwarded to NGINX, Envoy, or AWS ALBs. These Layer 7 proxies terminate the client TLS (L6) session, inspect the path prefix (e.g., routing /video/* to the streaming service cluster and /billing/* to the transactional database service), and inject security tracing headers.

12. Advantages

  • Modular Decoupling: Changes to a protocol at one layer (e.g., swapping Wi-Fi for Ethernet at L2) do not require rewriting application software at L7.
  • Interoperability: Standardizing layers allows devices built by different manufacturers to seamlessly communicate across the global internet.
  • Structured Troubleshooting: Isolating issues to a specific layer prevents wasted effort (e.g., checking code bugs when the physical Ethernet cable is unplugged).
  • Granular Security Controls: Allows engineers to deploy firewalls targeting specific threats, such as L3 IP blocking, L4 port restrictions, and L7 SQL Injection detection.

13. Limitations

  • Theoretical Redundancy: Some functions, such as error-checking and flow control, are duplicated across multiple layers (e.g., Layer 2 FCS, Layer 4 TCP Checksums).
  • Conceptual Mismatch: Real-world implementations (like the TCP/IP suite) do not map perfectly to the 7-layer layout, causing confusion (for example, Session and Presentation features are often implemented directly in application runtimes).
  • Processing Overhead: Every single layer boundary traversed adds processing latency as headers are encapsulated and decapsulated by CPU cycles.

14. Trade-offs

L4 Routing vs. L7 Routing

Choosing between an L4 and L7 load balancer involves balancing routing intelligence against raw performance:

  • L4 Routing: Offers extremely high throughput and low CPU usage because packets are forwarded without payload inspection. However, it cannot perform header inspection, URL path routing, cookie stickiness, or TLS termination.
  • L7 Routing: Offers deep application awareness, making it possible to execute request redirection, authentication verification, and path rewriting. The cost is high CPU overhead and susceptibility to L7 HTTP slow-post attacks.

Plaintext Internal Routing vs. Zero-Trust mTLS

When architecting microservices inside a secure Virtual Private Cloud (VPC):

  • Plaintext Routing: Terminating TLS at the API gateway and routing traffic inside the VPC in plaintext (L7/HTTP) maximizes performance and simplifies packet sniffing/debugging. However, if a single pod is compromised, the attacker can sniff all internal traffic.
  • Zero-Trust mTLS: Forcing mutual TLS (mTLS) at Layer 6/7 on every internal hop ensures encryption-in-transit and strong authentication, but incurs significant handshake latency and CPU usage overhead.

15. Performance Considerations

  • Jumbo Frames (9000 bytes MTU): By default, internet packets are limited to 1500 bytes. Inside closed data centers and cloud VPCs, configuring Layer 2/3 to support Jumbo Frames (9000 bytes) reduces the number of packets processed by the NIC and OS kernel, increasing throughput and lowering CPU overhead for high-performance databases and storage replication networks.
  • TLS Session Resumption (L5/L6 Optimization): Establishing a TLS session requires multiple network round trips. Implementing TLS session resumption (via Session IDs or TLS session tickets) allows clients and servers to reuse previously negotiated cryptographic keys, dropping the connection time from 2 RTTs to 1 or 0 RTTs.
  • Kernel Bypass (DPDK / eBPF): Standard OS kernel networking stacks copy packets from kernel space to user space, incurring system call overhead. Ultra-low latency platforms bypass the kernel completely at Layer 2/3 using tools like DPDK (Data Plane Development Kit) or run sandboxed programs directly in the kernel network interface using eBPF/XDP to filter traffic at maximum speed.

16. Failure Scenarios

Scenario A: TCP Port Exhaustion (Layer 4)

The Problem: A proxy server handling millions of requests to a backend database runs out of local source IP ports (ephemeral ports), preventing the creation of new TCP sockets and causing connection requests to time out.

Mitigation: Implement HTTP Keep-Alive connection pools to reuse existing TCP connections, reduce the OS tcp_fin_timeout configuration to clean up closed sockets faster, or provision secondary local IP addresses on the proxy interface.

Scenario B: PMTUD Black Hole (Layer 3)

The Problem: A client tries to upload a large file. The transit network has a restricted MTU (e.g., 1420 bytes due to a VPN tunnel). The router drops the client's packet because it is too large and has the DF (Don't Fragment) bit set. The router sends an ICMP Type 3 Code 4 message back, but the host's overly restrictive security group blocks all ICMP packets. The client connection hangs indefinitely.

Mitigation: Configure security policies to permit ICMP destination-unreachable messages, or configure the network nodes to perform TCP MSS Clamping, which automatically forces the TCP segment size to stay well below the bottleneck limit during the L4 handshake.

Scenario C: TLS Handshake Cipher Mismatch (Layer 6)

The Problem: An API endpoint is upgraded to only accept secure modern ciphers (e.g., TLS 1.3 only). Legacy IoT devices or old API clients using older runtimes (e.g., Java 8 without updates) fail to connect, returning generic connection errors or TLS handshake failures.

Mitigation: Audit client runtimes before deprecating cipher suites, configure load balancers to support backward-compatible cipher policies if legacy clients must be supported, and implement automated alerting for TLS negotiation failures.

17. Best Practices

  • Defense in Depth: Place network protections at every layer. Restrict IP addresses and ports using L3/L4 Network Access Control Lists (NACLs) and Security Groups, while blocking malicious payloads (like SQL injection) at L7 using a Web Application Firewall (WAF).
  • Avoid Internal Encryption Duplication: Terminate SSL/TLS at the load balancer (edge) or gateway if services run inside a trusted, isolated private network. Encrypting every single internal hop without security justification wastes massive CPU resources.
  • Establish Layered Monitoring: Collect metrics at different layers to simplify diagnostics. Monitor interface drops and FCS errors (L1/L2), ping drop rates and ICMP metrics (L3), TCP retransmission rates (L4), and HTTP response code percentages (L7).
  • Implement Connection Reuse: Maintain persistent connection pools for backend microservices to avoid latency spikes caused by executing TCP and TLS handshakes for every individual request.

18. Common Mistakes

Mistake Why Developers Make It How to Avoid It
Choosing L4 LB when L7 routing is needed L4 is simpler and faster, so it's chosen by default. Use L7 when you need path-based routing, A/B testing, or header inspection.
Confusing TLS termination layer Thinking TLS is a transport concern (L4) rather than presentation (L6). Terminate TLS at the L7 load balancer so backend services communicate in plaintext internally.
Ignoring MTU at L2/L3 boundary Overlooking that Ethernet frames have a 1500-byte MTU limit. Enable Jumbo Frames (9000 bytes) for high-throughput internal traffic, and configure PMTUD for WAN.
Blocking ICMP messages completely Believing that disabling ICMP prevents security discovery attacks completely. Allow ICMP Type 3 Code 4 (Fragmentation Needed) packets through firewalls to prevent PMTUD black hole errors.
Scaling servers instead of debugging L4 TCP parameters Assuming slow client responses mean CPU/memory exhaustion on servers. Inspect L4 performance indicators like TCP Retransmission Rate or connection backlogs before scaling hardware.

19. Implementation (Only If Applicable)

To demonstrate the difference between Layer 4 and Layer 7 routing, below is a complete, working TypeScript implementation using Node.js. The first class, Layer4Proxy, acts as an L4 load balancer by forwarding raw TCP socket streams without inspecting the HTTP payload. The second class, Layer7Router, acts as an L7 router by parsing incoming HTTP headers and paths to make routing decisions.

20. Interview Questions

Question 1 (Easy)

Q: What is the difference between a MAC address and an IP address, and at which OSI layers do they respectively operate?

A: A MAC (Media Access Control) address is a permanent hardware identifier assigned to a network interface card (NIC). It operates at Layer 2 (Data Link) and is used for local delivery of frames within the same local network segment. An IP address is a logical address assigned dynamically by software. It operates at Layer 3 (Network) and is used for end-to-end routing of packets across different networks globally.

Question 2 (Medium)

Q: How does a Layer 4 load balancer implement session affinity (sticky sessions) if it cannot inspect HTTP request payloads or cookies?

A: Since Layer 4 load balancers cannot inspect cookies or URL paths, they rely on network-level attributes to generate session hashes. This is typically achieved using:

  • 2-Tuple Hashing: Hashes the source IP and destination IP.
  • 5-Tuple Hashing: Hashes the source IP, destination IP, source port, destination port, and protocol (TCP/UDP).

This ensures that packets matching the hash are directed to the same backend server. The trade-off is that multiple clients behind a single NAT gateway (sharing one public IP) will be directed to the same backend, potentially causing load imbalances.

Question 3 (Hard)

Q: Describe what a "PMTUD Black Hole" is. What occurs when a client packet size exceeds the MTU of a transit router, and how can it be diagnosed and fixed?

A: When a client sends an IP packet exceeding the MTU of a transit router with the DF (Don't Fragment) bit set:

  1. The router drops the packet.
  2. The router attempts to send an ICMP Type 3 Code 4 (Fragmentation Needed) packet back to the sender containing its local MTU size.
  3. If a firewall blocks ICMP traffic along the return path, the client never receives the message and keeps waiting for an ACK. The connection hangs (a "black hole").

Diagnostics: Diagnose this by running ping -g [size] -D [target_ip] (forcing the DF bit) or observing TCP handshakes completing but data transfers timing out.

Solution: Allow ICMP Type 3 Code 4 packets in network firewalls or configure TCP MSS Clamping at the network border to automatically shrink the maximum segment size negotiated in L4 TCP handshake headers.

21. Practice Exercises

Exercise 1 (Easy)

Draw a block diagram of an Ethernet frame containing an IP packet which contains a TCP segment which contains an HTTP body payload. Label the headers added by Layer 2, Layer 3, and Layer 4.

Exercise 2 (Medium)

Write a local script (using Bash or Python) that automates checking network connectivity. It should check Layer 1/2 status (interface status), Layer 3 (ping gateway), Layer 4 (TCP port check using netcat), and Layer 7 (HTTP request validation using curl). It should output which exact OSI layer is failing.

Exercise 3 (Hard)

Design the network frame encapsulation layout for a multi-tenant cloud environment using VXLAN overlay tunnels. Show how the tenant's original Layer 2 Frame is encapsulated inside a Layer 4 UDP packet to traverse physical routers, detailing each added header.

22. Challenge Problem

Scenario: You are designing the infrastructure for a real-time multiplayer shooting game that expects 500,000 concurrent players. The game consists of two main types of network traffic:

  • Matchmaking & User Inventory: Infrequent, metadata-heavy HTTP/JSON API requests that require strict security.
  • Game State Updates: High-frequency, ultra-low latency updates (player locations, bullets fired) sent 60 times per second.

Your Challenge: Design the end-to-end network architecture. Describe which transport protocols (TCP or UDP) you would select for each type of traffic. For each path, determine at which OSI layers your load balancers, firewalls, and application code will operate. Lastly, explain how you will mitigate Layer 3/4 UDP flood DDoS attacks aimed at knocking players out of active matches.

23. Summary

The OSI Model provides a standardized conceptual framework for network communications. By segmenting networking functions into seven distinct layers, the model allows for modular protocol evolution, cleaner vendor integration, and systematic debugging of complex distributed applications.

While TCP/IP remains the practical operational model of the internet, understanding the theoretical OSI boundaries ensures you can cleanly design high-performance architectures (such as separating L4 NLBs and L7 ALBs), secure data through defense-in-depth, and run structured diagnostic routines to locate infrastructure bottlenecks.

24. Cheat Sheet

Layer Unit Core Purpose Key CLI Diagnostic Commands
L7 — Application Data Application processes, API formats, HTTP routing curl, dig, nslookup
L6 — Presentation Data Data formatting, encryption (TLS), compression openssl s_client
L5 — Session Data Connection establishment, session tracking netstat, ss -a
L4 — Transport Segment End-to-end reliability, port routing, TCP/UDP states nc -zv, ss -tlnp, telnet
L3 — Network Packet Logical addressing, routing across internet networks ping, traceroute, ip route
L2 — Data Link Frame Physical addressing, medium access, MAC forwarding arp -a, ip link show
L1 — Physical Bit Transmission of bits over copper, fiber, or radio ethtool, mii-tool

25. Quiz

Select the best answer for each of the following questions:

  1. Which layer of the OSI model is responsible for cryptographic encryption (SSL/TLS)?
    A) Layer 3 — Network
    B) Layer 4 — Transport
    C) Layer 6 — Presentation
    D) Layer 7 — Application
    Answer: C — TLS/SSL encryption and data formatting are handled at Layer 6 (Presentation).
  2. What is the typical PDU name for data processed at Layer 3 (Network)?
    A) Frame
    B) Segment
    C) Packet
    D) Bit
    Answer: C — Layer 3 operates on Packets, while Layer 4 uses Segments and Layer 2 uses Frames.
  3. Which device operates primarily at Layer 2 (Data Link) of the OSI model?
    A) Router
    B) Hub
    C) Switch
    D) Repeater
    Answer: C — Network switches read local MAC addresses to forward frames at Layer 2.
  4. An AWS Application Load Balancer (ALB) operates at which layer?
    A) Layer 3
    B) Layer 4
    C) Layer 5
    D) Layer 7
    Answer: D — An ALB operates at Layer 7 (Application) because it inspects HTTP paths, headers, and payloads.
  5. What standard size is the Ethernet MTU at Layer 2/3 boundary?
    A) 1200 bytes
    B) 1500 bytes
    C) 9000 bytes
    D) 65535 bytes
    Answer: B — The default standard Ethernet MTU size is 1500 bytes.
  6. Which diagnostic command would you run to verify Layer 4 connectivity to a port?
    A) ping
    B) arp -a
    C) nc -zv
    D) ip link show
    Answer: Cnc -zv (netcat) tests TCP/UDP port connections (L4). Ping uses ICMP (L3).
  7. What occurs during the decapsulation process on the receiving server?
    A) Wrapping payloads with new headers
    B) Stripping headers as the data moves up the stack
    C) Translating local domain names to IP addresses
    D) Splitting files into multiple TCP segments
    Answer: B — Decapsulation is the removal of headers as data moves from Layer 1 up to Layer 7.
  8. What happens when a packet exceeds the MTU of a router and has the DF bit set, but ICMP is blocked?
    A) The router fragments the packet anyway.
    B) The packet is dropped, creating a PMTUD black hole.
    C) The router upgrades its interface to support Jumbo Frames.
    D) The sender automatically switch protocols to UDP.
    Answer: B — If ICMP is blocked, the sender never knows the packet was dropped, resulting in a black hole connection.
  9. Which mechanism prevents a fast sender from overwhelming a slow receiver's local buffer?
    A) Congestion Avoidance
    B) Path MTU Discovery
    C) Flow Control
    D) TLS Handshaking
    Answer: C — TCP Flow Control utilizes receiver window advertisements to prevent receiver buffer overflow.
  10. If ping 10.0.0.1 succeeds but curl http://10.0.0.1 fails, which layer is likely broken?
    A) Layer 1
    B) Layer 2
    C) Layer 3
    D) Layer 4 or Layer 7
    Answer: D — Ping (L3) succeeds, showing physical and network paths are clear. The failure is at Layer 4 (port closed) or Layer 7 (application down).

26. Further Reading

  • RFC 1122: Requirements for Internet Hosts — Communication Layers.
  • High-Performance Browser Networking: By Ilya Grigorik (Specifically chapters on TCP and TLS performance optimizations).
  • Computer Networking: A Top-Down Approach: By Kurose & Ross (Excellent resource for learning layered architecture).

27. Next Lesson Preview

In the next lesson, we will deep-dive into the TCP/IP Stack & Three-Way Handshake. We will unpack the exact states of the TCP lifecycle (SYN, SYN-ACK, ACK, FIN, TIME_WAIT), analyze sliding window calculations, and write custom packet inspection rules using Wireshark to observe raw Transport-layer exchanges.

Key takeaways

  • OSI has 7 layers: Physical, Data Link, Network, Transport, Session, Presentation, Application.
  • L4 LBs route on IP/port; L7 LBs route on HTTP content — use L7 for microservices.
  • Debug top-down: start at L7 and work toward L1 to isolate the failing layer.