Sub topic 9
Putting the two models side by side
This chapter assumes you know what the TCP/IP model's four layers and the OSI model's seven layers are. It also assumes you know that each layer wraps the data from the layer above in a header. Here you will line the two models up, learn which numbers and names people use in practice, and see the mistakes that the mapping causes.
The mapping
The TCP/IP model is the one that describes real protocol stacks. The OSI model is a reference model that gives engineers a shared vocabulary. Because both split the same job into layers, you can map one onto the other.
| OSI layer | OSI name | TCP/IP layer | Example protocols |
|---|---|---|---|
| 7 | Application | Application | HTTP, DNS, SMTP |
| 6 | Presentation | Application | TLS (partly), character encodings, MIME |
| 5 | Session | Application | Session handling inside RPC or TLS |
| 4 | Transport | Transport | TCP, UDP |
| 3 | Network | Internet | IP, ICMP |
| 2 | Data link | Link | Ethernet, Wi-Fi, ARP |
| 1 | Physical | Link | Copper, fiber, radio signaling |
Three OSI layers (5, 6, 7) collapse into one TCP/IP layer. Two OSI layers (1, 2) collapse into another. Only the transport layer and the internet/network layer line up one to one.
Why the models differ
The two models were designed for different purposes.
- OSI was designed first as a specification. It separates concerns finely, so presentation (data format) and session (dialog control) each get their own layer.
- TCP/IP grew out of working protocols. Its designers left formatting and session control to the applications, so those functions live inside the application layer.
In practice, protocols built on TCP/IP rarely have a clean "presentation" or "session" component. A web server handles encoding, cookies, and connection reuse inside its own code.
How engineers use the numbers
People use the OSI numbers even when they work with TCP/IP stacks. You will hear these terms constantly.
- A layer 2 switch forwards frames using MAC addresses.
- A layer 3 device or router forwards packets using IP addresses.
- A layer 4 load balancer decides based on IP addresses and TCP or UDP ports.
- A layer 7 load balancer or proxy reads application data, such as HTTP paths and headers.
The TCP/IP names rarely appear in this vocabulary. Nobody says "internet layer switch". The OSI numbers act as a shorthand, even when the underlying stack is TCP/IP.
Common errors
- Treating the layers as a strict hierarchy of devices. A single machine runs all layers. A router still has a link layer, because it must build a frame to send each packet.
- Assuming that a layer 7 protocol means "OSI layers 5 through 7 are all separate". In TCP/IP, they merge, so you cannot point to a distinct session header in an HTTP request.
- Forcing every protocol into one slot. Some protocols span layers. The next chapters cover where this happens.
- Mixing up names. "Network layer" is OSI layer 3. "Internet layer" is the TCP/IP equivalent. They mean the same job, and the names are not interchangeable between models in exam answers or documentation.
- Calling the TCP/IP link layer "layer 1". It covers OSI layers 1 and 2 together. Ethernet framing and MAC addresses belong to layer 2.
Exercise
Exercise
A team says they need a "layer 4 load balancer" to spread TCP connections across servers. Which TCP/IP layer does that map to, and what information can the device use to make its decision?
Show answer
Layer 4 is the OSI transport layer, which maps to the TCP/IP transport layer. The device can use the source and destination IP addresses and the TCP or UDP port numbers. It does not need to read the application data, such as HTTP headers.
Exercise
Which OSI layers does the TCP/IP link layer cover, and why is there no separate TCP/IP layer for OSI layer 6?
Show answer
The link layer covers OSI layers 1 (physical) and 2 (data link). TCP/IP has no presentation layer because data formatting and encoding are handled by the application protocol or the application itself, so layer 6 is merged into the TCP/IP application layer.