Skip to main content
RunBook Academy

LinuxXIX · Networking FoundationsModels

OSI and TCP/IP models - what each layer is for

Foundation⏱ ~10 minbash

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

Not yet marked complete on this device.

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

#LayerWhat it doesExamples
7ApplicationUser-facing protocolsHTTP, DNS, SSH, SMTP
6PresentationEncoding, encryption, compressionTLS, ASCII, JPEG
5SessionDialog control, checkpointsNetBIOS, RPC
4TransportEnd-to-end delivery, ports, orderingTCP, UDP
3NetworkLogical addressing and routingIPv4, IPv6, ICMP
2Data LinkFraming, MAC addressingEthernet, Wi-Fi, ARP
1PhysicalBits on a wireCables, 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 layerOSI layersWhat it does
Application5, 6, 7Protocols an application talks to (HTTP, DNS, TLS)
Transport4TCP, UDP
Internet3IP, ICMP
Link1, 2Ethernet, 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; ss and /proc/net/tcp expose 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

  1. Q1. At which layer does TCP operate in the OSI model?

  2. Q2. In the TCP/IP model, what layers does the "Internet" layer combine?

  3. Q3. A DNS lookup failure is an Application-layer problem.

Passing score: 75%. Answers are checked in this browser.