The Stack
The Definitive Reference to OSI vs TCP/IP Models

Fig 1.1: Functional mapping of the ISO OSI Reference Model to the IETF TCP/IP Architecture.
1. The Great Dichotomy: Theory vs. Reality
In the early 1980s, the networking world was a fractured landscape of proprietary standards. IBM had SNA, Digital Equipment Corp had DECnet, and Novell had IPX/SPX. Two major efforts emerged to unify this chaos: the OSI (Open Systems Interconnection) model, backed by governments and the ISO, and the TCP/IP (Transmission Control Protocol/Internet Protocol) model, backed by DARPA and the researchers of the early ARPANET.
The result was the "Protocol Wars." was an academically perfect model designed by committee. was a "running code" model designed by engineers who needed to solve immediate problems. While won the war of adoption, the model won the war of vocabulary. To this day, we troubleshoot "" issues and "" attacks, despite the fact that our and kernels are running the stack. Understanding how these models relate to the physics of latency is now an essential skill for systems architects.
2. The 7 Layers of OSI: The Academic Ideal
The OSI model (ISO/IEC 7498-1) visualizes a network as a vertical stack where each layer provides services to the layer above and consumes services from the layer below.
L7: ApplicationPDU: Data / Message
The interface between the user and the network. This is where network-aware software (Chrome, Outlook, SSH) initiates requests.
L6: PresentationPDU: Data
The 'Translator' layer. Handles data formatting, encryption (TLS), and compression to ensure the receiver can understand the data.
L5: SessionPDU: Data
Handles the 'Dialog.' Manages session establishment, maintenance, and teardown (Checkpoints and synchronization).
L4: TransportPDU: Segment (TCP) / Datagram (UDP)
End-to-end communication. Handles segmenting data, flow control, and error recovery (ACKs).
L3: NetworkPDU: Packet
Logical addressing and path determination. This is where routers determine the best path across the internet.
L2: Data LinkPDU: Frame
Physical addressing (MAC). Handles error detection on the local segment (FCS) and media access control.
L1: PhysicalPDU: Bits
The physical transmission of bits (voltage, radio waves, light pulses) over the medium.
3. The TCP/IP Paradigm: The Realist's Model
While the OSI model has 7 layers, the TCP/IP model simplifies this into 4: Network Access, Internet, Transport, and Application. Most modern networking is built on the TCP/IP model. This reflects how operating systems actually handle networking: the application developer writes to a socket (Application), the kernel handles the protocols (Transport/Internet), and the hardware handles the signal (Network Access).
| TCP/IP Layer | OSI Mapping | Kernel/User Space | Core Responsibility |
|---|---|---|---|
| 1. Application | Application, Presentation, Session | User Space | Formatting data, user auth, encryption, and protocol-specific logic. |
| 2. Transport (Host-to-Host) | Transport | Kernel Space | End-to-end reliability (TCP) or low-latency streaming (UDP). Port addressing. |
| 3. Internet | Network | Routing Packets via IP addresses across multiple distinct networks. | |
| 4. Network Access | Data Link, Physical | Hardware/Driver | MAC addresses, framing, and bit-level transmission across a physical link. |
4. The AI Infrastructure Stack: RDMA and RoCE v2
The explosion of Generative has forced a radical re-evaluation of the classical networking stack. For distributed training of Large Language Models (), the millisecond-level latency of the standard stack is a catastrophic bottleneck. Modern fabrics utilize (Remote Direct Memory Access) to bypass the kernel entirely. For a comprehensive comparison of transport technologies, refer to our vs. InfiniBand Deep Dive.
Kernel Bypass
Standard TCP requires the CPU to copy data from the NIC to the kernel space, then to user space. RDMA allows the NIC to write directly into the GPU's memory. In OSI terms, this effectively collapses Layers 4 through 7 into a single, hardware-accelerated transaction.
RoCE v2 Mapping
( over Converged Ethernet) achieves this by wrapping InfiniBand transport headers inside standard packets. While it looks like traditional traffic to routers, the internal logic bypasses the standard congestion control mechanisms in favor of hardware-level (Priority Flow Control).
Efficiency Model: RoCE v2 Framing Tax
On a standard 1500-byte MTU, RoCE v2 imposes a ~4% tax. In specialized HPC networks using 4096-byte MTUs, this efficiency loss is diluted to under 1.5%, which is why AI clusters mandate Jumbo Frames. For a deeper dive into these metrics, see our analysis on RoCE v2 Header Overhead.
5. QUIC & The Death of Layering
While data centers are breaking the stack from the bottom up, modern web protocols like () are breaking it from the top down. replaces the traditional combination of () and () with a single encrypted transport mechanism built on top of .
The QUIC Layering Paradox
In a classical OSI analysis, QUIC represents a "Layering Paradox":
- Transport Layer (): It provides reliable delivery, congestion control, and multiplexing.
- Presentation Layer (): It integrates encryption natively into the transport handshake, meaning data is never "unencrypted" as it moves through the stack.
- Session Layer (): Its use of "Connection IDs" allows a session to survive an address change (e.g., switching from to ), a feat impossible with traditional -based layering.
6. PDUs and the Encapsulation Lifecycle
Encapsulation is the process where each layer adds its own control information (Headers and Footers) to the data coming from the layer above. This allows the receiver to "unwrap" the data at each corresponding layer.
The Efficiency Tax: Encapsulation Overhead
Every layer added involves a performance trade-off. In a standard Ethernet environment, a packet carries of header () and of header (). The Ethernet frame () adds another - plus a check.
7. The Troubleshooting Framework: Engineering in Tiers
The greatest value of the OSI model is not in building software, but in troubleshooting it. When an application fails, engineers use one of three systematic approaches:
A. Bottom-Up Approach (Hardware First)
Starts at Layer 1 (Physical) and moves upward. Question: Is the link light on? Can I see the ARP entry? (L2). Can I ping the gateway? (L3). Can I Telnet to the port? (L4).Best for: Sudden network outages or new hardware installations.
B. Top-Down Approach (Software First)
Starts at Layer 7 (Application) and moves downward. Question: Is the browser throwing an error? Are the HTTP headers correct?Best for: Software developer troubleshooting where the underlying network is known to be stable.
C. Divide and Conquer
Starts at a middle layer (usually Layer 3 or 4). Example: Try a ping. If it works, you know Layers 1, 2, and 3 are healthy—focus on 4-7. If it fails, focus on 1-3.
8. The "In-Between" Protocols: ARP and ICMP
Real-world networking often breaks the clean boundaries of models. Two critical protocols serve as "connective tissue" between layers, often misunderstood in their placement:
- (Address Resolution Protocol): Often called "." While it resolves () to (), it is technically a protocol because its (the Request/Reply) is encapsulated directly into an Ethernet frame without an header. It operates in the "no-man's land" between the logical and physical addressing spaces.
- (Internet Control Message Protocol): Technically a protocol. Although it sits "above" (it is identified by Protocol Number in the header), it is an integral part of the Network layer. It does not provide end-to-end delivery like ; instead, it provides diagnostic feedback about the Network layer itself.
9. Why OSI Lost the Protocol War
Historical Analysis
In 1989, many believed OSI would replace TCP/IP by the mid-90s. Governments and large telecom corporations mandated OSI compliance. So why did it fail?
- Timing: was finished and running on the early internet while was still in "design by committee." By the time was ready, the internet had reached critical mass.
- Bad Implementation: was massive. A typical stack was three times heavier than a stack. On the hardware of the 80s, every byte mattered.
- Complexity: The Session and Presentation layers often proved redundant. Most application developers found it easier to handle encryption and session state inside their own code rather than relying on a complex network stack.
10. The Engineering Troubleshooting Matrix
| OSI Layer | Key Tools | Common Issues | Symptoms |
|---|---|---|---|
| Physical (L1) | OTDR, Cable Tester, Fluke | Broken Fiber, EMI Interference | No Link Light, Interface Flapping |
| Data Link (L2) | Wireshark, `show mac address` | STP Loops, VLAN Mismatch | Broadcast Storm, Mac Flapping |
| Network (L3) | Ping, Traceroute, MTR | Routing Loop, MTU Mismatch | Destination Unreachable, Packet Loss |
| Transport (L4) | Telnet, Netcat, Nmap | Port Closed, Firewall Drop | Connection Refused, Connection Timeout |
| Application (L7) | Curl, Postman, Browser DevTools | HTTP 500, Auth Failure | Broken API, Error Page |