LinuxXIX · Networking FoundationsModels
OSI and TCP/IP models - what each layer is for
What you'll learn
- Name the seven OSI layers and what each one does
- Map the OSI layers to the four TCP/IP layers
- Place common protocols (HTTP, TLS, DNS, ARP, ICMP) on the correct layer
- Use the model to structure a network diagnosis
Prerequisites
Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09
The OSI and TCP/IP models are conceptual frameworks for thinking about network communication. They are not implemented as such by Linux - the kernel’s networking stack is a single integrated piece - but the layered view is essential for diagnosing problems.
The seven OSI layers
| # | Layer | What it does | Examples |
|---|---|---|---|
| 7 | Application | User-facing protocols | HTTP, DNS, SSH, SMTP |
| 6 | Presentation | Encoding, encryption, compression | TLS, ASCII, JPEG |
| 5 | Session | Dialog control, checkpoints | NetBIOS, RPC |
| 4 | Transport | End-to-end delivery, ports, ordering | TCP, UDP |
| 3 | Network | Logical addressing and routing | IPv4, IPv6, ICMP |
| 2 | Data Link | Framing, MAC addressing | Ethernet, Wi-Fi, ARP |
| 1 | Physical | Bits on a wire | Cables, optical, radio |
Layer 5 (Session) is rarely invoked in modern sysadmin work; its concerns are usually handled inside the application protocol. Layers 6 and 7 are often discussed together.
The four TCP/IP layers
The TCP/IP model (the model the internet actually uses) collapses OSI to four layers:
| TCP/IP layer | OSI layers | What it does |
|---|---|---|
| Application | 5, 6, 7 | Protocols an application talks to (HTTP, DNS, TLS) |
| Transport | 4 | TCP, UDP |
| Internet | 3 | IP, ICMP |
| Link | 1, 2 | Ethernet, ARP, Wi-Fi |
When a Linux sysadmin says “transport layer”, they mean TCP/UDP. When they say “layer 3”, they mean IP. “Layer 2” means Ethernet and ARP.
How Linux maps to the model
The kernel has one integrated stack. The pieces that correspond to each layer:
- Application: socket file descriptors in userspace, protocol
libraries (OpenSSL, glibc
getaddrinfo). - Transport: TCP and UDP implementations in the kernel;
ssand/proc/net/tcpexpose them. - Internet: IPv4 and IPv6 stacks;
ip route,ip addr,/proc/net/route. - Link: NIC drivers, ARP and neighbour subsystem;
ip link,ip neigh,arp.
Layer-by-layer diagnosis
When a service is unreachable, walk down the layers in order:
Application: is the service listening? (ss -ltn)
Transport: can I reach the port? (nc -vz, telnet)
Internet: can I route to the host? (ip route get, ping)
Link: is the interface up? (ip link, ethtool)
Physical: is the link light on? (ip link, switch port LED)
Each layer has its own set of tools and its own failure modes. A DNS failure is layer 7. A wrong subnet mask is layer 3. A cable unplugged is layer 1.
Knowledge check
Knowledge check · 3 questions
Q1. At which layer does TCP operate in the OSI model?
Q2. In the TCP/IP model, what layers does the "Internet" layer combine?
Q3. A DNS lookup failure is an Application-layer problem.
Passing score: 75%. Answers are checked in this browser.