Networking

OSI Model Explained: The 7 Layers With Real Examples

The OSI model is a reference model that splits network communication into 7 layers: Physical (1), Data Link (2), Network (3), Transport (4), Session (5), Presentation (6) and Application (7). Each layer provides a service to the one above it, so a problem or a protocol can be placed at one layer: Wi-Fi and Ethernet at layers 1 and 2, IP at layer 3, TCP and UDP at layer 4, and HTTP at layer 7.

The model is defined in ITU-T Recommendation X.200, whose text is also published as ISO/IEC 7498-1. It lists the layers top-down, from the Application Layer (layer 7) to the Physical Layer (layer 1).

The 7 layers at a glance

#LayerWhat it doesCommon examplesData unitDevices
7ApplicationNetwork services an application uses directlyHTTP, DNS, SMTP, SSHMessageProxies, web application firewalls
6PresentationA common representation of data: encoding, formats, encryptionCharacter encoding, data formats; TLS is often placed hereMessageNone
5SessionOpening, organising and closing a dialogue between two applicationsSession setup and checkpointing; rarely a separate protocol todayMessageNone
4TransportEnd-to-end delivery between programs, identified by port numbersTCP, UDP, QUICSegment (TCP) / datagram (UDP)Firewalls, load balancers
3NetworkAddressing and routing across networksIPv4, IPv6, ICMPPacketRouters
2Data LinkDelivery between devices on the same link, identified by MAC addressEthernet, Wi-Fi (802.11), ARPFrameSwitches, access points
1PhysicalBits as signals on a mediumCopper cable, fibre, radio, connectorsBitCables, hubs, repeaters

Placing real protocols into OSI layers is a convention, not part of X.200, and some protocols straddle layers. TLS, for example, is described as layer 6 in some texts and layer 4 or 7 in others. Don't lose sleep over these edge cases; the model is a vocabulary, not a law.

What each layer does, from the bottom up

Layer 1: Physical

X.200 defines it as providing "the mechanical, electrical, functional and procedural means" to activate and maintain physical connections for bit transmission. In practice: the cable, the connector, the voltage or light pulses, the radio frequency. A bad cable, a dead port or a Wi-Fi signal too weak to hold a link are layer-1 problems.

Layer 2: Data Link

Moves frames between devices on the same local network and detects transmission errors. Ethernet and Wi-Fi each define both their physical signalling (layer 1) and their framing (layer 2). Devices on the link are identified by MAC addresses, and a switch forwards frames by looking those up.

Layer 3: Network

X.200 says this layer gives the transport layer "independence of routing and relay considerations". IP addresses live here, and routers work here: each one reads the destination address and forwards the packet one hop closer. ICMP, the protocol behind ping, is also layer 3.

Layer 4: Transport

Delivers data between programs on two hosts, identified by port numbers. X.200 notes that transport protocols have "end-to-end significance": routers in between don't take part. TCP, in the words of RFC 9293, "provides a reliable, in-order, byte-stream service to applications". UDP sends independent datagrams with no delivery guarantee. The difference is covered in TCP vs UDP.

Layer 5: Session

In X.200 its purpose is to let two presentation entities "organize and to synchronize their dialogue and to manage their data exchange". On the modern internet there's rarely a separate session protocol; applications handle sessions themselves (a login cookie, a reconnecting video call).

Layer 6: Presentation

X.200 describes it as providing "common representation of the data transferred between application-entities", so applications don't have to agree on byte layouts themselves. Character encodings and serialisation formats fit the description. Again, the internet usually folds this into the application.

Layer 7: Application

The protocols applications speak: HTTP for the web, DNS for name lookup, SMTP and IMAP for email, SSH for remote shells. "Application layer" means the protocol, not the program: Chrome isn't layer 7, but the HTTP it sends is.

OSI model vs TCP/IP model

The internet doesn't use OSI's protocols. It uses the TCP/IP suite, which RFC 1122 describes in four layers. RFC 1122 says its application layer "essentially combines the functions of the top two layers", presentation and application, of the OSI model.

OSI layersTCP/IP layer (RFC 1122)Examples
7 Application, 6 Presentation, 5 SessionApplicationHTTP, DNS, SMTP, SSH, TLS
4 TransportTransportTCP, UDP
3 NetworkInternetIP, ICMP
2 Data Link, 1 PhysicalLinkEthernet, Wi-Fi

So when people say "a layer 7 load balancer" or "a layer 2 switch", they're using OSI numbers to describe TCP/IP equipment. That vocabulary is the main reason the OSI model is still taught.

A real request, layer by layer

Loading https://example.com touches every layer. You can watch part of it with curl -v. Example output (curl 8.8.0 on Windows, October 2026; addresses will differ):

* Host example.com:443 was resolved.
* IPv4: 104.20.23.154, 172.66.147.243
*   Trying 104.20.23.154:443...
* Connected to example.com (104.20.23.154) port 443
> GET / HTTP/1.1
< HTTP/1.1 200 OK
  1. Application (DNS): "was resolved" is a DNS lookup that turned the name into IP addresses before anything else happened.
  2. Transport and Network: "Connected to ... port 443" is a TCP connection (layer 4, port 443) to an IP address (layer 3). Routers along the way only looked at the IP header.
  3. Data Link and Physical: invisible to curl. Your network card wrapped each packet in an Ethernet or Wi-Fi frame addressed to your router's MAC address and sent it as electrical or radio signals.
  4. Presentation/encryption: curl set up TLS before sending anything, so the HTTP that followed was encrypted (how the TLS handshake works).
  5. Application (HTTP): GET / HTTP/1.1 is the request; HTTP/1.1 200 OK is the reply.

On the way down, each layer adds its own header to the data from the layer above (encapsulation): HTTP inside TCP inside IP inside an Ethernet frame. The receiving side strips them in reverse order.

Using the OSI model to troubleshoot

The practical use of the layers is to test from the bottom up, so you stop at the first one that fails instead of guessing:

LayerQuestionQuick check
1-2Is there a link?Cable lights, Wi-Fi connected, adapter shows "Up"
3Do I have an address, and can I reach the router and beyond?ipconfig / ip addr, then ping the gateway, then ping 1.1.1.1
7 (DNS)Do names resolve?nslookup example.com
4Is the port open?Test-NetConnection example.com -Port 443 or nc -vz example.com 443
7Does the service answer correctly?curl -v https://example.com

If pinging an IP address works but pinging a name fails, the network is fine and DNS is the problem. If DNS works but the port check fails, look at firewalls or whether the service is running. The ping command guide explains how to read its output.

Frequently asked questions

Is the internet built on the OSI model?
No. The internet runs on the TCP/IP protocol suite, which RFC 1122 describes with four layers: link, internet, transport and application. The OSI model is a separate reference model published by ITU-T and ISO. Its protocols never displaced TCP/IP, but its seven-layer vocabulary is still the standard way to describe where a protocol or a problem sits.
What layer is a firewall?
It depends on what it inspects. A basic packet filter that allows or blocks by IP address and port works at layers 3 and 4. A web application firewall that reads HTTP requests works at layer 7. Many modern firewalls do both, which is why vendors describe them by the highest layer they understand.
What layer is DNS?
DNS is an application-layer protocol (layer 7 in OSI terms, the application layer in TCP/IP). It runs on top of UDP and TCP port 53, and its job is a service other applications use: turning names into IP addresses before the real connection starts.
Is there a trick to remember the OSI layers?
A common mnemonic from layer 1 up is 'Please Do Not Throw Sausage Pizza Away': Physical, Data Link, Network, Transport, Session, Presentation, Application. From layer 7 down, 'All People Seem To Need Data Processing' works the same way.

Sources