What are the seven layers of the OSI model, and what does each do?
EasyConceptOSI & TCP/IP Models
Answer
The OSI (Open Systems Interconnection) model is a seven-layer reference model for describing network communication. From top to bottom, a common mnemonic is "All People Seem To Need Data Processing".
| Layer | Main job | Examples |
|---|---|---|
| 7 Application | services used directly by programs | HTTP, DNS, SMTP |
| 6 Presentation | data format, encoding, compression, encryption | JSON, JPEG, TLS encryption |
| 5 Session | opening, managing and closing sessions | RPC, NetBIOS |
| 4 Transport | process-to-process delivery, ports, reliability | TCP, UDP |
| 3 Network | logical (IP) addressing and routing | IP, ICMP, routers |
| 2 Data Link | framing, MAC addressing, error detection | Ethernet, Wi-Fi, switches |
| 1 Physical | bits as electrical, light or radio signals | cables, hubs |
- Layers 1 to 3 work hop by hop on every device along the path; layers 4 to 7 work end to end between the two hosts.
- In real systems, layers 5 to 7 are usually implemented together inside the application.
Example: Sending an email: the client speaks SMTP (7), encodes and encrypts the text (6) and keeps a session open with the server (5); TCP splits it into segments (4), IP routes them (3), Ethernet frames them for the next hop (2) and the bits travel as signals (1).