OSI vs TCP/IP Model: How They Compare
OSI vs TCP/IP compared: 7 vs 4 layers, layer mapping table, why they differ, protocols that do not fit, encapsulation and bottom-up Linux troubleshooting.
The OSI model has seven layers and is a reference framework for describing network functions. The TCP/IP model has four layers (link, internet, transport, application, as defined in RFC 1122) and describes the protocols the internet actually runs. Engineers use OSI vocabulary to talk about problems and TCP/IP to build and debug real traffic.
This article puts the two models side by side and shows where they line up, where they disagree, and how to use both when troubleshooting. For a full walk through the seven OSI layers on their own, start with our pillar guide, What Is the OSI Model and Why It Still Matters. For a protocol-by-layer reference, see protocols at each OSI layer, and for worked TCP/IP scenarios, the TCP/IP model with real-world examples.
Key takeaways
- OSI (ISO/IEC 7498-1) is a seven-layer reference model. TCP/IP is a four-layer model described in RFC 1122 and built around real protocols.
- TCP/IP's application layer covers OSI layers 5, 6 and 7. Its link layer covers OSI layers 1 and 2. Transport and internet map closely to OSI layers 4 and 3.
- Many textbooks and vendors use a five-layer hybrid that splits the TCP/IP link layer into physical and data link.
- Real protocols do not always fit one layer. TLS, QUIC and ARP are the usual examples.
- For troubleshooting, work bottom-up with layer-specific tools: link state, IP reachability, ports, then application responses.
The two models at a glance
| Aspect | OSI model | TCP/IP model |
|---|---|---|
| Layers | 7: physical, data link, network, transport, session, presentation, application | 4: link, internet, transport, application |
| Defined by | ISO/IEC 7498-1 | IETF, mainly RFC 1122 and RFC 1123 |
| Origin | Designed as a general standard before most protocols were chosen | Written to describe protocols already in use on the ARPANET and early internet |
| Main use today | Teaching, vendor documentation, shared vocabulary ("a Layer 7 load balancer") | Implementation: operating system network stacks, routers, firewalls |
| Session and presentation | Separate layers | Part of the application layer |
| Physical and data link | Separate layers | One link layer |
| Protocols tied to it | The original OSI protocol suite is rarely used now | IP, TCP, UDP, ICMP, DNS, HTTP and the rest of the internet suite |
RFC 1122 lists its layers as Application, Transport, Internet and Link. Some books call the link layer "network access" or "network interface". The names differ; the scope is the same.
Layer-by-layer mapping
The mapping is close for the middle layers and loose at the top and bottom.
| OSI layer | TCP/IP layer | Data unit | Example protocols and technologies |
|---|---|---|---|
| 7 Application | Application | Data / message | HTTP, DNS, SMTP, SSH |
| 6 Presentation | Application | Data / message | Encoding and encryption, often handled by TLS or the application itself |
| 5 Session | Application | Data / message | Session handling inside protocols such as HTTP/2 streams or RPC frameworks |
| 4 Transport | Transport | Segment (TCP) / datagram (UDP) | TCP, UDP |
| 3 Network | Internet | Packet | IPv4, IPv6, ICMP |
| 2 Data link | Link | Frame | Ethernet, Wi-Fi (IEEE 802.11), VLAN tagging (802.1Q) |
| 1 Physical | Link | Bits | Copper, fibre, radio |
The TCP/IP model merges session and presentation into the application because internet protocols handle those jobs themselves. HTTP manages its own connections and encodings; there is no separate session protocol under it. At the bottom, RFC 1122 deliberately leaves the physical details to the link technology, so Ethernet's standards cover both OSI layer 1 and layer 2.
Addresses and headers at each layer
Another way to compare the models is to look at what each layer adds to a packet and which address it uses. This is also the information you read in a packet capture.
| TCP/IP layer (OSI) | Address or identifier | Header fields worth knowing | Changes hop by hop? |
|---|---|---|---|
| Application (5 to 7) | Hostnames, URLs | HTTP method, Host header, status code | No |
| Transport (4) | Port numbers, for example 443 for HTTPS and 53 for DNS | TCP flags (SYN, ACK, FIN, RST), sequence numbers, window size | No, unless NAT rewrites ports |
| Internet (3) | IPv4 or IPv6 address | TTL or hop limit, protocol number, DSCP | TTL decreases at each router; NAT may rewrite addresses |
| Link (1 and 2) | MAC address | EtherType, VLAN tag | Yes, rebuilt for every link |
The last column explains a common confusion. The destination MAC address in a frame leaving your laptop belongs to your default gateway, not to the web server, while the destination IP address belongs to the server for the whole journey. Port numbers are assigned by IANA in its service name and port number registry.
Why the models differ
The differences come from how each model was made.
OSI was designed top-down
The OSI reference model was written as a general standard, meant to describe any network. Its layers separate functions cleanly, including session control and data representation, whether or not a given protocol needs them. That makes it a good teaching tool and a precise vocabulary.
TCP/IP was described bottom-up
TCP/IP protocols were already running when RFC 1122 described the host requirements in 1989. The model follows the protocols, so its layers match what operating systems implement: a link driver, an IP layer, TCP and UDP, and applications. That is why the Linux kernel network stack looks like TCP/IP, not like OSI.
The five-layer hybrid
Many textbooks and courses use five layers: physical, data link, network, transport, application. It keeps TCP/IP's single application layer but splits the link layer, because physical and data link problems are diagnosed differently. When someone says "Layer 2" or "Layer 3", they are using numbers that are the same in OSI and in this hybrid.
Protocols that do not fit neatly
Both models are simplifications. Some common protocols sit across boundaries:
- TLS runs on top of TCP and below HTTP. It provides encryption, which sounds like OSI presentation, but it also sets up a secure session. In TCP/IP terms it is simply part of the application layer.
- QUIC (RFC 9000) runs over UDP and provides reliable, encrypted, multiplexed streams. It does transport-layer work but is implemented in user space above UDP. HTTP/3 runs on QUIC.
- ARP resolves IPv4 addresses to MAC addresses. It serves the internet layer but is carried directly in link-layer frames, so it is often called a "Layer 2.5" protocol.
- ICMP is carried inside IP packets but is part of the internet layer itself, used for errors and diagnostics such as ping.
- Tunnels such as VXLAN carry Ethernet frames inside UDP packets, so a Layer 2 network runs over a Layer 4 transport. Kubernetes overlay networks use this.
These cases are why experienced engineers treat the models as maps, not laws. Our posts on TCP versus UDP in real-time applications and physical addressing on a LAN cover two of these layers in detail.
Encapsulation: one request through both models
Following a single HTTPS request makes the mapping concrete:
- The browser builds an HTTP request (OSI 7, TCP/IP application).
- TLS encrypts it (OSI 6 and 5 in spirit, TCP/IP application).
- TCP splits it into segments with source and destination ports, for example a random high port to 443 (OSI 4, TCP/IP transport).
- IP adds source and destination addresses and the packet is routed hop by hop (OSI 3, TCP/IP internet).
- Ethernet or Wi-Fi wraps each packet in a frame with MAC addresses for the next hop only (OSI 2, TCP/IP link).
- The network card sends the bits over copper, fibre or radio (OSI 1, TCP/IP link).
At each router, the frame is removed and rebuilt for the next link, while the IP packet stays the same (apart from fields such as TTL). At the server, the layers are unwrapped in reverse.
Using both models for troubleshooting
The most practical use of either model is to decide what to test next. Work from the bottom up and stop at the first layer that fails. The commands below are standard on modern Linux systems.
| OSI layer | TCP/IP layer | Question | Linux tools |
|---|---|---|---|
| 1 and 2 | Link | Is the interface up, with a link and a MAC address? | ip link show, ethtool eth0, ip neigh |
| 3 | Internet | Does the host have an address and a route, and can it reach the target? | ip addr, ip route, ping, traceroute |
| 4 | Transport | Is the port open and listening? Is a firewall dropping it? | ss -tlnp, nc -zv host 443 |
| 5 to 7 | Application | Does name resolution work? Does TLS complete? What does the app return? | dig, openssl s_client -connect host:443, curl -v |
| All | All | What is actually on the wire? | tcpdump -i eth0 port 443 |
A quick sequence for "the site is down":
# Link and address
ip -br link
ip -br addr
# Routing and reachability
ip route get 203.0.113.10
ping -c 3 203.0.113.10
# Name resolution
dig +short app.example.com
# Transport
nc -zv app.example.com 443
# TLS and application
openssl s_client -connect app.example.com:443 -servername app.example.com </dev/null
curl -sv https://app.example.com/health -o /dev/null
Our guide to ping, traceroute and netstat explains reading the output, and securing TCP and UDP services covers the transport layer from the hardening side.
Where the layer numbers show up in DevOps work
- Load balancers: "L4" balancers route on IP and port (for example AWS Network Load Balancer). "L7" balancers read HTTP headers and paths (for example AWS Application Load Balancer or an ingress controller).
- Firewalls and security groups: cloud security groups filter on Layer 3 and 4 fields. Web application firewalls inspect Layer 7.
- Kubernetes: a Service with kube-proxy works at Layer 4. Ingress and Gateway API HTTPRoute resources work at Layer 7. NetworkPolicy works at Layers 3 and 4.
- Service mesh: sidecar proxies add Layer 7 features such as retries and header routing on top of Layer 4 connections.
- Interviews: "Which layer does X work at?" is a standard question. Our CCNA interview FAQs collect the common ones.
Which model should you learn first?
Learn both, in this order: the OSI layer names and numbers first, because colleagues, vendors and job descriptions use them; then the TCP/IP model, because it is how packets are actually built and how Linux and cloud networks behave. When the two disagree, trust TCP/IP for implementation and use OSI for communication.
For hands-on networking on Linux servers, the Linux administration training in Pune covers interfaces, routing, firewalls and troubleshooting, in our Kharadi classroom and live online. The DevOps training builds on it with cloud and Kubernetes networking.
Frequently asked questions
What is the main difference between the OSI and TCP/IP models?
OSI is a seven-layer reference model for describing network functions. TCP/IP is a four-layer model, defined in RFC 1122, that describes the protocols the internet runs. OSI is mostly used for vocabulary and teaching; TCP/IP for implementation.
How do the OSI layers map to TCP/IP layers?
OSI layers 5, 6 and 7 map to the TCP/IP application layer, layer 4 to transport, layer 3 to internet, and layers 1 and 2 to the link layer.
Why does TCP/IP have fewer layers?
It was written to describe protocols already in use. Internet applications handle session and presentation themselves, and link technologies such as Ethernet cover both physical and data link functions, so separate layers were not needed.
Is the OSI model still used?
Yes, as a shared vocabulary. Terms like Layer 2 switch, Layer 4 load balancer and Layer 7 firewall come from OSI numbering, even though the traffic itself uses TCP/IP protocols.
Which layer does TLS belong to?
In TCP/IP terms TLS is part of the application layer, sitting above TCP. In OSI terms it is often placed at the presentation or session layer, which shows the models do not map perfectly.
What is the five-layer model?
A teaching hybrid with physical, data link, network, transport and application layers. It keeps TCP/IP's single application layer and splits the link layer, so its layer numbers match OSI for layers 1 to 4.
How do I use these models to troubleshoot?
Test bottom-up: link state, IP address and route, port reachability, then DNS, TLS and the application response. Stop at the first layer that fails and fix it there.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0