☼
⌃
☰

Open Systems Interconnection Model

Table of Contents

Conceptual framework dividing network communication into seven layers. Each layer provides services to the layer above and uses services from the layer below. Used for troubleshooting, understanding protocols, and designing network systems. The OSI model is theoretical; TCP/IP is what networks actually implement.

Related: ICMP Ethernet Switch Router

The Seven Layers

# Layer Unit Key protocols / technologies
7 Application Data HTTP, FTP, SMTP, DNS, SNMP
6 Presentation Data TLS/SSL, JPEG, MPEG, ASCII
5 Session Data NetBIOS, RPC, NFS
4 Transport Segment TCP, UDP, SCTP
3 Network Packet IP, IPv6, ICMP, OSPF
2 Data Link Frame Ethernet, PPP, ARP
1 Physical Bit Ethernet (physical), Wi-Fi, Bluetooth, DSL

Mnemonic (top down): Please Do Not Throw Sausage Pizza Away

Layer Detail

Layer 7 — Application

Closest to the user. Provides network services directly to applications — not the application itself, but the protocols it uses.

Key functions: resource sharing, network services (email, file transfer, web access), data manipulation.

Protocols: HTTP/S, FTP, SMTP, IMAP, POP3, DNS, SNMP, SSH

Layer 6 — Presentation

Translates data between the application and network format. Handles encoding, encryption, and compression.

Key functions: data translation (EBCDIC ↔ ASCII), encryption (TLS terminates here conceptually), compression (JPEG, MPEG).

In practice: the Session–Presentation–Application distinction is largely theoretical — TCP/IP collapses these into one layer.

Layer 5 — Session

Manages sessions (dialogues) between applications. Establishes, maintains, and terminates connections.

Key functions: session establishment, synchronisation (checkpoints for recovery), dialog control (half/full duplex).

Protocols: NetBIOS, RPC, NFS

Layer 4 — Transport

Provides reliable (or fast) end-to-end data transfer between hosts. The first layer that addresses host-to-host communication rather than network-to-network.

Key functions: segmentation and reassembly, connection management (TCP three-way handshake), error detection, flow control, port addressing.

Protocols: TCP (reliable, connection-oriented), UDP (fast, connectionless), SCTP

Layer 3 — Network

Routes packets between networks. Adds logical addressing (IP).

Key functions: routing (choosing the path), logical addressing (IP addresses), packet forwarding, fragmentation.

Protocols: IP, IPv6, ICMP, OSPF, BGP

Devices: routers, layer 3 switches

Layer 2 — Data Link

Reliable transfer across a single physical link. Divided into:

  • LLC (Logical Link Control) — flow control, error detection
  • MAC (Media Access Control) — medium access, physical addressing

Key functions: framing, error detection (CRC), media access control (CSMA/CD), MAC addressing.

Protocols: Ethernet, PPP, HDLC, ARP

Devices: switches, bridges, NICs

Layer 1 — Physical

Raw bit transmission over a physical medium. Defines electrical, mechanical, and procedural standards.

Key functions: bit transmission, signal modulation, synchronisation, physical topology, line coding.

Technologies: Ethernet cable, fibre optic, Wi-Fi radio, Bluetooth, USB, DSL

Devices: cables, hubs, repeaters, NICs (physical component)

OSI vs TCP/IP

OSI TCP/IP
Application (7) Application
Presentation (6) Application
Session (5) Application
Transport (4) Transport
Network (3) Internet
Data Link (2) Network Access
Physical (1) Network Access

TCP/IP is the working model; OSI is the reference model. Protocol analysis and troubleshooting tools (Wireshark) use OSI layer terminology even when the implementation is TCP/IP.

Security Relevance

Attacks are often categorised by the layer they target:

Layer Attack example
7 (Application) SQLi, XSS, CSRF, web application attacks
6 (Presentation) TLS downgrade, SSL stripping
5 (Session) Session hijacking, cookie theft
4 (Transport) Port scanning, TCP SYN flood
3 (Network) IP spoofing, ICMP flood, routing attacks
2 (Data Link) ARP poisoning, MAC flooding, VLAN hopping
1 (Physical) Cable tapping, physical access

Tips

  • In practice, troubleshoot bottom-up: confirm physical link first, then layer 2, then IP, then transport, then application
  • Wireshark operates at layers 2–7 — packet captures include Ethernet frames (L2), IP headers (L3), TCP segments (L4), and application payload (L7)
  • Firewalls traditionally operate at L3/L4; next-generation firewalls and WAFs operate at L7
  • The OSI layers 5 and 6 are rarely discussed in practice — most real-world discussion refers to L2 (switching), L3 (routing), L4 (transport), and L7 (application)