Skip to main content

OSI Model

The OSI model is a conceptual framework that standardizes how data is transmitted across networks, broken into 7 layers. Each layer serves a specific role and communicates only with the layers directly above and below it.

The 7 OSI Layers (Bottom → Top)

LayerNamePurposeExamples
7ApplicationClosest to the user. Provides network services to applications.HTTP, FTP, SMTP, DNS, Telnet
6PresentationTranslates, encrypts, compresses data into a format apps can understand.SSL/TLS, JPEG, MP3, GIF
5SessionEstablishes, manages, and terminates sessions (conversations) between applications.NetBIOS, RPC, PPTP
4TransportProvides end-to-end data transfer, reliability, and error handling.TCP, UDP
3NetworkRoutes data between devices across networks (logical addressing).IP, ICMP, IPX, OSPF
2Data LinkProvides node-to-node delivery, error detection/correction, framing.Ethernet, PPP, Switches, MAC addresses
1PhysicalTransmits raw bits over physical media. Defines cables, voltage, signals.Cables, Wi-Fi, Hubs, Modems

Easy-to-Remember Mnemonics

  • Bottom → Top (1 to 7): "Please Do Not Throw Sausage Pizza Away" (Physical, Data Link, Network, Transport, Session, Presentation, Application)
  • Top → Bottom (7 to 1): "All People Seem To Need Data Processing" (Application, Presentation, Session, Transport, Network, Data Link, Physical)

Data Flow (Encapsulation)

Sending data:

  1. Application: "I want a web page" (HTTP).
  2. Presentation: encrypt/compress data (TLS).
  3. Session: manage the connection state.
  4. Transport: TCP splits data into segments, ensures reliability.
  5. Network: IP addresses, decides where to send data.
  6. Data Link: Ethernet frame with MAC addresses.
  7. Physical: converts to bits/signals, sends over wire/wifi.

When receiving data, the process is reversed (decapsulation).

OSI vs TCP/IP

  • OSI = theoretical 7-layer model (used for teaching and design),
  • TCP/IP = practical 4-layer model (used in real-world networking),
  • TCP/IP collapses Session + Presentation + Application into one "Application Layer" and Physical + Data Link into "Link Layer".