Card 05/ 09

ComparisonDifficulty: Beginner2 min

The OSI Model vs the TCP/IP Model

Seven layers to reason with, and the four layers the internet is actually built on.

The OSI model and the TCP/IP model both describe network communication as a stack of layers, each built on the one below. The OSI model has seven layers and is a reference model, designed to describe any network. The TCP/IP model has four layers and describes the protocols the internet actually runs on, which were designed before the OSI model was finished.

The two differ on three things worth comparing: how many layers there are, what they are used for, and where the session and presentation jobs go.

Two ways to divide the same stack

OSI modela reference model, for describing and reasoning

Seven layers: Physical, Data Link, Network, Transport, Session, Presentation, Application. Each has a separate job, including keeping a conversation together (session) and agreeing a data format (presentation). Engineers use its numbers as a shared vocabulary: layer 2, layer 4, layer 7.

TCP/IP modelthe protocol suite the internet runs on

Four layers: Link, Internet, Transport, Application. Session and format are the application's own business, so HTTP, TLS and JSON all live in the one top layer. Its layers are named after the protocols in them: IP is the internet layer, TCP and UDP the transport.

How the seven OSI layers map onto the four TCP/IP layers, with a protocol at each
OSI layersTCP/IP layerExample protocols
7 Application, 6 Presentation, 5 SessionApplicationHTTP, DNS, TLS, SSH
4 TransportTransportTCP, UDP
3 NetworkInternetIP, ICMP
2 Data Link, 1 PhysicalLinkEthernet, Wi-Fi

The session and presentation layers are where the models part. In practice no widely used internet protocol sits at layer 5 or 6 alone: an HTTP client opens and closes its own connections, and character encoding is a header inside the HTTP message. That is why the TCP/IP model folds them into the application.

The rule for choosing. Use the OSI numbers when you are saying where a fault or a device sits, because "layer 4" and "layer 7" are what every vendor and colleague uses. Use the TCP/IP layers when you are reading how a real protocol is built, because they match the specifications. Most engineers use both in the same conversation, and the mapping above is all it takes to move between them.