The OSI Model: The 7 Layers Explained With an Example
2 min read
Published · Updated
Short answer
The OSI model has seven layers from physical to application. It maps onto TCP/IP, and it helps with troubleshooting: hubs are layer 1, switches layer 2, routers layer 3.

In this article (5 sections)
The OSI model splits network communication into seven layers, from the cable up to the application you use. Each layer does one job and talks only to the layers directly above and below it. It is a reference model for learning and troubleshooting. The real internet runs on the simpler four-layer TCP/IP model, which maps onto it.
The seven layers
| # | Layer | Job | Data unit | Examples |
|---|---|---|---|---|
| 7 | Application | Services that programs use | Data | HTTP, DNS, SMTP |
| 6 | Presentation | Format, encryption, compression | Data | TLS, JPEG |
| 5 | Session | Starting, keeping and ending conversations | Data | Session setup, RPC |
| 4 | Transport | End-to-end delivery, ports, reliability | Segments or datagrams | TCP, UDP |
| 3 | Network | Addressing and routing between networks | Packets | IP, routers |
| 2 | Data link | Delivery on one local network, using MAC addresses | Frames | Ethernet, Wi-Fi, switches |
| 1 | Physical | Moving raw bits over a medium | Bits | Cables, radio, hubs |
A common memory aid, from layer 7 down, is "All People Seem To Need Data Processing".
An example: loading a web page
- Application: your browser asks for a page over HTTP, after DNS finds the address.
- Presentation: TLS encrypts the request.
- Transport: TCP splits the data and tracks delivery.
- Network: IP gives each packet the source and destination address.
- Data link: the packet is wrapped in a frame for your Wi-Fi or Ethernet hop.
- Physical: the frame is sent as radio waves or electrical or light signals.
The data then passes up the layers on the other side. Sending adds a header at each layer, and receiving removes it.
OSI and TCP/IP
| TCP/IP layer | OSI layers |
|---|---|
| Application | 5, 6, 7 |
| Transport | 4 |
| Internet | 3 |
| Link | 1, 2 |
Why it is useful
- Troubleshooting: work from the bottom up. Is the cable or Wi-Fi connected (1)? Can you reach the router (2 and 3)? Is a port or firewall blocking it (4)? Does DNS or the app fail (7)?
- Naming devices: a hub works at layer 1, a switch at layer 2 and a router at layer 3. That is why switches and routers split collision domains and broadcast domains differently.
- Security: a basic firewall filters at layers 3 and 4, and application firewalls work at layer 7.
When a slow connection puzzles you, ping tests layer 3 and a speed test covers the stack above it:



