Networking Fundamentals

OSI model explained: The 7 OSI Layers (Layer-by-Layer) With Real-World Examples

A clear OSI model explained guide covering all 7 layers with responsibilities, PDU names, encapsulation, device mapping (switches/routers), a cheat sheet table, and practical troubleshooting examples.

Drake Nguyen

Founder · System Architect

3 min read
OSI model explained: The 7 OSI Layers (Layer-by-Layer) With Real-World Examples
OSI model explained: The 7 OSI Layers (Layer-by-Layer) With Real-World Examples

Introduction — what you’ll learn

If you’ve ever wondered how data moves from an app on your laptop to an app on a server, this OSI model explained guide breaks the process down into clear, practical networking fundamentals. You’ll learn the role of each of the OSI layers, how encapsulation works, the common PDU names, and the layer mapping to protocols you’ll see in real networks.

By the end, you’ll also know where switches operate vs where routers operate, how to use the 7-layer model for troubleshooting, and how the OSI reference model compares to the TCP/IP model. For teams evaluating OSI model explained, this section provides the core context.

What is the OSI Model? (brief purpose

The OSI model (Open Systems Interconnection) is a conceptual framework that divides network communication into seven network layers. It’s used to separate concerns—like physical signaling vs routing vs application services—so engineers can design, discuss, and troubleshoot networking systems consistently. Even though the internet primarily uses TCP/IP, the OSI reference model remains one of the most useful ways to reason about protocols and encapsulation.

OSI model explained (Layer-by-Layer) — overview of the 7 layers

So, what are the 7 layers of the OSI model? From lowest to highest, each layer provides services to the one above it. As data moves down the stack, each layer adds headers (encapsulation). As it moves up on the receiving host, headers are removed (decapsulation). The PDU names typically change by layer:

  • Layer 1: Physical — PDU: bits
  • Layer 2: Data Link — PDU: frames
  • Layer 3: Network — PDU: packets
  • Layer 4: Transport — PDU: segments (TCP) / datagrams (UDP)
  • Layer 5: Session — PDU: data
  • Layer 6: Presentation — PDU: data
  • Layer 7: Application — PDU: data

Layer 1 — Physical layer

Physical layer responsibilities, PDU, examples, troubleshooting

Responsibilities: Transmits raw signals across media (electrical, optical, radio). Defines connectors, cabling, frequency/encoding at the signal level, and link timing.

PDU name: bits.

Real-world examples of OSI layers: Ethernet cabling (Cat5e/Cat6), fiber optics, Wi‑Fi radio, transceivers, patch panels, and the physical NIC/port.

Quick checks: Link lights, cable integrity, speed/duplex negotiation, damaged ports, and RF interference (Wi‑Fi). Confirm Layer 1 before assuming higher-layer issues.

Layer 2 — Data link layer

Data link layer responsibilities, VLANs, MAC, examples, troubleshooting

Responsibilities: Packages bits into frames, uses MAC addressing, handles local delivery on the same LAN, and performs error detection (e.g., FCS). This is typically where switches operate (Layer 2 forwarding).

PDU name: frames.

Examples: Ethernet framing, VLAN tagging (802.1Q), STP, and ARP (often taught at the L2/L3 boundary).

Troubleshooting: Check VLAN membership, trunk/access mode, STP state, port security, and MAC learning. Useful commands include show mac address-table (switches) and arp -a (hosts).

Layer 3 — Network layer

Network layer responsibilities, routing basics, examples, troubleshooting

Responsibilities: Provides logical addressing and routing between networks using IP. This is where routers operate, forwarding traffic between subnets based on Layer 3 headers.

PDU name: packets.

Examples: IPv4/IPv6 packets, ICMP, and (conceptually) routing protocols like OSPF and BGP. This is the core of routing vs switching.

Troubleshooting: Validate IP addressing and gateways (see IP addressing and subnetting basics), inspect route tables, and test paths with ping and traceroute. If IP works but names fail, check DNS (Layer 7).

Layer 4 — Transport layer

Transport layer responsibilities, TCP vs UDP, ports, examples

Responsibilities: End-to-end transport between hosts: segmentation/reassembly, reliability, ordering, and flow control (TCP) or lightweight best-effort delivery (UDP). Uses ports to identify application endpoints.

PDU names: TCP segments / UDP datagrams.

TCP vs UDP ports and protocols: TCP supports handshakes and retransmission (common for HTTP, SSH). UDP is connectionless and often used for DNS queries, VoIP, and DHCP.

Troubleshooting: Confirm port reachability (nc, telnet), watch for TCP resets/timeouts, and consider NAT/firewall rules (often L3/L4 filtering with statefulness).

Layer 5 — Session layer

Session layer responsibilities, examples, troubleshooting

Responsibilities: Establishes, manages, and terminates sessions between applications, including checkpoints and recovery concepts. In modern stacks, many session features live in applications or libraries, but the OSI layer is still helpful for analysis.

Examples: Application login sessions, SMB session setup, RPC-style exchanges, and keepalive/timeout behavior.

Troubleshooting: Investigate session timeouts, token/cookie expiration, idle disconnects, and keepalive settings.

Layer 6 — Presentation layer

Presentation layer responsibilities, encoding/TLS examples, troubleshooting

Responsibilities: Data representation: encoding/decoding, compression, and encryption. This layer is often described as the “translation” layer between application data structures and transmitted formats.

Examples: TLS encryption, JSON/XML serialization, gzip compression, and character encoding (UTF‑8 vs others).

Troubleshooting: Certificate validation, cipher mismatches, and encoding problems. TLS handshake errors often align with Layer 6 responsibilities (even if implemented in Layer 7 libraries).

Layer 7 — Application layer

Application layer responsibilities, common protocols, examples

Responsibilities: Provides network services directly to user applications. This is where most “it works/it fails” symptoms appear to end users.

Examples: HTTP/HTTPS, DNS and DHCP, SMTP, SSH, and FTP/SFTP. Many troubleshooting workflows begin here: logs, error codes, and request/response inspection.

Troubleshooting: Test HTTP with curl, verify DNS with dig/nslookup, and review server/app logs for request handling and authentication errors.

Encapsulation & PDU names — how data moves through layers

Encapsulation is the process of wrapping data with layer-specific headers (and sometimes trailers) as it moves down the stack. The same user action—like opening a webpage—becomes different PDUs at different layers: application data → transport segment/datagram → network packet → data link frame → physical bits.

Understanding encapsulation makes troubleshooting faster: identify the lowest layer where things break, then move up.

Where network devices operate — switches vs routers vs firewalls

This is a practical OSI layer explanation many beginners look for:

  • Switches: primarily Layer 2 (MAC-based forwarding); some switches also do Layer 3 routing (multilayer switches).
  • Routers: Layer 3 (IP routing between subnets).
  • Firewalls: commonly Layer 3/4 (stateful filtering) and sometimes Layer 7 (application-aware inspection).
  • Access points: bridge wireless clients to the wired network (often treated as Layer 2 bridging plus Layer 1 radio).

OSI model vs TCP/IP model — practical comparison and mapping

The OSI model is a teaching framework; TCP/IP is the internet’s operational model. A common mapping is:

  • OSI Layers 1–2 → TCP/IP Link layer
  • OSI Layer 3 → TCP/IP Internet layer (IP)
  • OSI Layer 4 → TCP/IP Transport layer (TCP/UDP)
  • OSI Layers 5–7 → TCP/IP Application layer (HTTP, DNS, TLS, etc.)

This layer mapping to protocols helps connect “OSI theory” to tools you use daily.

Cheat sheet & quick reference

Use this as an OSI layers cheat sheet for beginners when studying or troubleshooting:

OSI layer Main responsibility Common examples PDU name
7 — Application User-facing network services HTTP, DNS, DHCP, SMTP Data
6 — Presentation Encoding, encryption, compression TLS, JSON, UTF‑8, gzip Data
5 — Session Session control, checkpoints Keepalives, session tokens Data
4 — Transport Ports, reliability, delivery TCP, UDP Segments/Datagrams
3 — Network Routing between networks IP, ICMP Packets
2 — Data Link Frames, MAC addressing, VLANs Ethernet, 802.1Q Frames
1 — Physical Signals and media Copper, fiber, RF Bits

Real-world scenarios & troubleshooting examples

  • Website won’t load: Check Layer 1 link, Layer 2 VLAN, Layer 3 gateway/routes, Layer 4 port 443 reachability, then Layer 7 HTTP/TLS errors.
  • VLAN issue example: A device gets an IP but can’t reach servers—verify switchport VLAN, trunk tagging, and STP state (Layer 2).
  • DNS failure: IP connectivity works, but names don’t—verify resolvers, DNS responses, and firewall rules for UDP/TCP 53 (Layer 7 + Layer 4).

How to remember the 7 layers (mnemonics and study tips

Common mnemonics include “Please Do Not Throw Sausage Pizza Away” (1→7) and “All People Seem To Need Data Processing” (7→1). Pair the mnemonic with the cheat sheet and practice mapping common tools (ping, traceroute, dig, curl) to layers.

Conclusion — recap and next steps

This OSI model explained breakdown gives you a practical way to understand the seven layers, PDUs, encapsulation, and where network devices fit. Next, reinforce the model by comparing it to TCP/IP and practicing troubleshooting with real scenarios like VLAN misconfigs, DNS issues, and port connectivity problems.

Stay updated with Netalith

Get coding resources, product updates, and special offers directly in your inbox.