Cyber Security Basics 📂 Slides · 10 of 11 69 min read

The OSI Model — 7 Layers, PDUs, Protocols & Data Encapsulation

A 23-slide interactive walkthrough of the OSI model — every one of the 7 layers explained across 2 slides with its purpose, PDU, devices that operate on it, and the protocols that live there. Covers Physical, Data Link, Network, Transport, Session, Presentation and Application layers, plus full TCP vs UDP comparison, OSI vs TCP/IP mapping, a devices-per-layer chart, and a big animated Data Encapsulation diagram showing the packet growing header-by-header as it descends the sender's stack.

🧱

The OSI Model — 7 Layers, PDUs & Data Encapsulation

Every layer, its purpose, the devices that operate on it, the PDU it uses, the protocols that live there, and the animated journey of data flowing down and back up the stack.
7 Layers PDUs Protocols Encapsulation

Press Next → or use ← → arrow keys

Section 01

The OSI Model at a Glance

L7 Application user-facing services · HTTP · DNS · SMTP DATA L6 Presentation encoding · encryption (TLS/SSL) · compression DATA L5 Session start · manage · terminate sessions DATA L4 Transport end-to-end delivery · TCP (reliable) · UDP (fast) SEGMENT L3 Network logical addressing & routing · IP · ICMP PACKET L2 Data Link MAC addressing · framing · error detection FRAME L1 Physical cables · signals · bits on the wire BITS LAYER PDU
🎓
Mnemonic — Top to Bottom

All People Seem To Need Data Processing
Application · Presentation · Session · Transport · Network · Data Link · Physical

Section 01 · Purpose

Why the OSI Model Exists

A universal reference for how networks talk
The Open Systems Interconnection (OSI) model was published by the ISO in 1984 as a 7-layer reference for how networked systems communicate. Each layer has a single, well-defined job. A change in one layer never ripples into the others.

You will hardly ever run "pure OSI" — the internet uses TCP/IP. But every network engineer thinks in OSI layers because it maps neatly onto everything that exists.
7Layers
1984Published by ISO
1 jobPer layer
LayeredIndependent + swappable
Section 01 · Reference

All 7 Layers — Quick Reference

#LayerPDUKey jobDevicesSample protocols
7ApplicationDataUser servicesHostHTTP · HTTPS · DNS · SMTP · FTP
6PresentationDataEncode / encrypt / compressHostTLS · SSL · JPEG · ASCII
5SessionDataStart / manage / end sessionsHostNetBIOS · RPC · PPTP
4TransportSegment / DatagramEnd-to-end deliveryFirewall (L4)TCP · UDP · SCTP
3NetworkPacketLogical addressing & routingRouter · L3 switchIP · ICMP · OSPF · BGP
2Data LinkFrameMAC addressing, framingSwitch · Bridge · NICEthernet · PPP · ARP · Wi-Fi (802.11)
1PhysicalBitsSignals on the wireHub · Repeater · CableEthernet PHY · DSL · fibre optics
Section 02 · Layer 1

Layer 1 — Physical Layer · What & Why

1

Physical Layer

Bits on the wire — voltages, light pulses and radio waves
Job — Move Raw Bits Between Two Nodes

The physical layer converts 1s and 0s into electrical signals (copper), light pulses (fibre) or radio waves (Wi-Fi/5G), and vice versa. It knows nothing about addresses, routing or reliability — only signals and timing.

🔌
Signaling
encoding
Turn bit sequences into voltage levels, light on/off, or modulated radio signals.
⏱️
Timing & Clocks
synchronisation
Sender and receiver must agree on bit-rate and clock boundaries — otherwise noise.
📏
Media Standards
connectors
RJ-45 / RJ-11 / SFP / SC-LC connectors, cable categories (Cat 5e/6/6a), impedance.
Section 02 · Layer 1

Layer 1 — Devices, PDU & Protocols

DevicesPDUProtocols / standards
Hub · Repeater · Cable (copper / fibre) · Modem · Antenna BITS Ethernet PHY (100BASE-T · 1000BASE-T)
DSL · DOCSIS (cable)
Fibre (SONET / SDH / DWDM)
Bluetooth PHY · Wi-Fi PHY · 4G / 5G radio
🔎
Hub vs Repeater — Both Are Pure L1

A hub forwards every incoming signal to every other port with zero intelligence. A repeater amplifies a signal so it can travel further. Neither understands MAC or IP addresses — that's what makes them L1 devices.

💡
Modern Reality

Hubs are effectively extinct today (replaced by L2 switches). "Modem" (modulator/demodulator) still lives at L1 — converting digital bits to analog signals over DSL / cable / fibre.

Section 03 · Layer 2

Layer 2 — Data Link · What & Why

2

Data Link Layer

Node-to-node delivery on the same physical network using MAC addresses
🏷️
Job — Deliver Frames Between Directly-Connected Devices

Layer 2 wraps the network packet into a frame with a source MAC and destination MAC — a hardware address burned into every NIC. It handles local delivery on the same LAN; getting between LANs is Layer 3's job.

🔖
MAC Addressing
48-bit hardware ID
Every NIC has a unique MAC like A4:B1:C1:D2:E3:F4. First 3 bytes = vendor, last 3 = serial.
📦
Framing
wrap the packet
Adds a header (src+dst MAC, EtherType) and a trailer (CRC checksum) around the L3 payload.
🚦
Error Detection + MAC control
CRC · CSMA/CD
CRC catches corrupted bits; media-access control decides who gets to talk on shared media.
Section 03 · Layer 2

Layer 2 — Devices, PDU & Protocols

DevicesPDUProtocols
Switch · Bridge
NIC (Network Interface Card)
Wireless Access Point (AP)
FRAME Ethernet (IEEE 802.3)
Wi-Fi (IEEE 802.11)
PPP · HDLC
ARP · VLAN (802.1Q)
STP (Spanning Tree)
🔀
The Switch — the Star of Layer 2

A switch reads the destination MAC and forwards the frame only to the correct port (unlike hubs which flood everywhere). It builds a MAC address table automatically by watching source addresses on incoming frames.

🔍
ARP Lives Here Too

ARP (Address Resolution Protocol) maps a known IP to the MAC on the same LAN — the bridge between L3 addressing and L2 delivery.

Section 04 · Layer 3

Layer 3 — Network · What & Why

3

Network Layer

Logical addressing + routing between different networks worldwide
🌍
Job — Get Packets Across the Internet

Layer 3 gives every device a logical (IP) address that works globally, and picks the best route across many networks to reach the destination. Where Layer 2 handles "next hop on this LAN", Layer 3 handles "how to reach New York from Delhi".

📍
Logical Addressing
IPv4 · IPv6
Assigns 32-bit (v4) or 128-bit (v6) addresses that identify a device on the global network.
🗺️
Routing
path selection
Routers exchange reachability info via OSPF/BGP and pick the best next hop for each packet.
✂️
Fragmentation
MTU handling
Splits packets when the next hop's Maximum Transmission Unit is smaller than the packet.
Section 04 · Layer 3

Layer 3 — Devices, PDU & Protocols

DevicesPDUProtocols
Router · Layer-3 Switch
Multi-layer firewall
Load balancer (L3/L4)
PACKET IP (IPv4 & IPv6) — addressing
ICMPping & error reporting
OSPF · EIGRP — internal routing
BGP — internet routing between ISPs
IPsec — L3 encryption
NAT — private↔public translation
🧭
Router = the Post-Office

A router looks at each packet's destination IP, checks its routing table, and forwards the packet toward the correct "next hop" — repeating until the packet reaches its network.

🛠️
Everyday Tools You've Already Used

ping uses ICMP. traceroute/tracert uses ICMP+TTL. ipconfig/ifconfig show your L3 address. All of these live at Layer 3.

Section 05 · Layer 4

Layer 4 — Transport · What & Why

4

Transport Layer

End-to-end delivery between processes on two hosts, using ports
📮
Job — Deliver Segments to the Right Application

Layer 3 gets a packet to the right machine. Layer 4 gets it to the right application on that machine — using port numbers (HTTP=80, HTTPS=443, DNS=53, SSH=22). It also decides between reliable (TCP) and fast (UDP) delivery.

🔢
Ports
0 – 65,535
Every packet has a source and destination port so the OS knows which app receives the data.
✂️
Segmentation
chop & number
Splits large data into segments, numbers them, and lets the receiver reassemble in order.
🛡️
Reliability
ACK · retransmit
TCP tracks acknowledgements and retransmits lost segments. UDP does not — it's "fire & forget".
Section 05 · Layer 4

Layer 4 — Devices, PDU & TCP vs UDP

DevicesPDUProtocols
L4 firewall (port-based)
L4 load balancer
(mostly end-host software)
SEGMENT (TCP)
DATAGRAM (UDP)
TCP — reliable, ordered, connection-based
UDP — connectionless, low-overhead
SCTP — TCP + UDP hybrid
QUIC — modern encrypted UDP-based transport
FeatureTCPUDP
Connection3-way handshake firstNone — just send
ReliabilityACK + retransmitNone — app must handle
OrderGuaranteedNot guaranteed
Header size20+ bytes8 bytes (tiny)
SpeedSlower (overhead)Very fast
Used byHTTP · HTTPS · SSH · email · file transferDNS · VoIP · gaming · video streaming · DHCP
Section 06 · Layer 5

Layer 5 — Session Layer

5

Session Layer

Open, manage and close conversations between two hosts
🔓
Setup
start dialogue
Establishes a session, negotiates parameters, authenticates if needed.
🔁
Maintain
checkpoints
Adds sync points so a big transfer can resume from the last checkpoint if it drops.
🚪
Teardown
close cleanly
Ends the conversation and releases resources on both sides.
PDUProtocols
DATANetBIOS · RPC · PPTP · SOCKS · SIP (session initiation)
🎯
Real-World Reality

In modern TCP/IP, session-layer functions are usually rolled into the application itself (cookies, JWTs, session IDs). L5 is more of a conceptual placeholder in real networks — but essential vocabulary in the OSI model.

Section 07 · Layer 6

Layer 6 — Presentation Layer

6

Presentation Layer

Translate, encrypt and compress data so both ends can read it
🔤
Translation
encoding
ASCII, UTF-8, EBCDIC, image formats (JPEG, PNG, GIF), video codecs (H.264, VP9).
🔐
Encryption
confidentiality
TLS/SSL encrypts application data before it hits L5–L1. This is where HTTPS lives.
🗜️
Compression
smaller pipes
Shrinks data (gzip, brotli) so it uses less bandwidth on the wire.
PDUStandards / protocols
DATATLS · SSL · ASCII · UTF-8 · JPEG · PNG · MPEG · MIME · gzip · brotli
🔒
HTTPS = HTTP over TLS at Layer 6

When you visit an https:// site, the encryption is negotiated by TLS at Layer 6 before HTTP data (Layer 7) is sent. That's why the padlock icon protects your credentials.

Section 08 · Layer 7

Layer 7 — Application Layer · What & Why

7

Application Layer

Where users and applications interact with the network
🖥️
Job — Provide Network Services to Applications

The application layer is the interface between the network and the app you're using. When you type a URL, click "Send", or open Zoom — L7 protocols like HTTP, SMTP, and RTP take over. It's the only layer users ever see.

🌐
Web
HTTP · HTTPS
Every browser request, every API call. HTTP/1.1, HTTP/2, HTTP/3 (over QUIC).
📧
Email
SMTP · IMAP · POP3
SMTP sends mail; IMAP/POP3 fetch it. All three are pure Layer 7.
📂
File Transfer
FTP · SFTP · SCP
Move files between hosts. SFTP/SCP add encryption over SSH.
Section 08 · Layer 7

Layer 7 — Devices, PDU & Protocols

DevicesPDUProtocols
Application-layer firewall (WAF)
API gateway
Reverse proxy (Nginx, HAProxy)
End hosts (browser, mail client, apps)
DATA HTTP · HTTPS — web
DNS — name resolution
SMTP · IMAP · POP3 — email
FTP · SFTP — files
SSH · Telnet — remote shell
DHCP — auto IP assignment
SNMP — device monitoring
RTP · SIP — voice / video
🎯
Why "Application Layer" ≠ "Your App"

The OSI Application Layer isn't your Word or Chrome program — it's the network-facing services those programs use (HTTP, DNS, SMTP…). Your app talks to L7 protocols; the protocols talk to L6 and below.

Section 09 · Devices

Which Device Lives on Which Layer?

Layer 1 · Physical Hub · Repeater forwards raw signals Cable · Modem copper · fibre · radio Antenna · AP-radio wireless PHY Layer 2 · Data Link Switch · Bridge uses MAC addresses NIC every device's card Wireless AP 802.11 frames Layer 3 · Network Router forwards by IP Layer-3 Switch switch + routing L3 firewall IP-based rules Layer 4 – 7 Stateful firewall (L4) port-based Load balancer L4 or L7 WAF · API gateway (L7) app-aware
🎯
The Rule

The higher the layer a device operates at, the smarter — and slower — it is. Hubs blindly forward bits; L7 firewalls understand entire HTTP requests.

Section 10

Data Encapsulation — the Idea

Wrapping a letter into envelopes
Imagine posting a letter overseas. You seal it in an envelope (the recipient's address goes on). That envelope goes into a courier bag (with the courier's routing label). The courier bag goes onto a plane (with the airline's manifest). Each layer wraps the previous one and adds its own address information — without opening what's inside.

Data encapsulation in networking works exactly the same way. As data flows down the OSI stack, each layer adds its own header (and sometimes a trailer). On the receiving side, the process is reversed — each layer strips its header on the way back up. This is called decapsulation.
📋 THE 5 STEPS ON THE SENDING SIDE
L7–5
Application creates raw DATA.
L4
Transport adds a TCP/UDP header (ports, sequence) → SEGMENT.
L3
Network adds an IP header (src IP, dst IP) → PACKET.
L2
Data Link adds a MAC header + CRC trailerFRAME.
L1
Physical converts the frame into BITS on the wire.
Section 10 · Full Flow

Encapsulation & Decapsulation — Full Journey

SENDER RECEIVER L7 App L6 Pres L5 Sess L4 Trans L3 Net L2 Link L1 Phys L1 Phys L2 Link L3 Net L4 Trans L5 Sess L6 Pres L7 App ENCAPSULATE ▼ ▲ DECAPSULATE DATA L7: raw data TCP DATA L4: SEGMENT IP TCP DATA L3: PACKET ETH IP TCP DATA CRC L2: FRAME (header + trailer) 10110100 10101100 10110010 … L1: BITS PHYSICAL MEDIUM (copper · fibre · Wi-Fi) PDUs added ▼ L7–L5 → DATA L4 → SEGMENT L3 → PACKET L2 → FRAME L1 → BITS Each layer wraps the previous PDU with its own header — reversed on the receiver
🎬
Watch the Packet Grow

Data starts small at L7, then each layer wraps it with its own header (and L2 also adds a CRC trailer). By the time it hits L1 it's a fully-labelled bit stream on the wire. The receiver undoes it one wrapper at a time.

Section 11 · TCP/IP

The TCP/IP Model — the Model the Internet Actually Uses

Born in the labs, before OSI existed
The TCP/IP model (also called the DoD model) was designed by Vint Cerf and Bob Kahn in the 1970s for the US Department of Defense's ARPANETten years before the OSI reference model was published.

It has just 4 layers because it was built for real, working networks, not as a theoretical reference. Today it runs literally every internet-connected device — while OSI stays the vocabulary we use to talk about them.
4Layers (vs OSI's 7)
1970sCerf & Kahn
ARPANETFirst deployment
100%Modern internet
🎯
Practical vs Theoretical

OSI is the textbook. TCP/IP is what actually runs. TCP/IP combines OSI's Session + Presentation + Application into one Application layer, and OSI's Physical + Data Link into one Network Access layer.

Section 11 · Stack

The TCP/IP 4-Layer Stack

L4 Application user-facing services · handles data format, encryption, session HTTP · HTTPS · DNS · SMTP · FTP · SSH · DHCP · SNMP DATA = OSI 5+6+7 L3 Transport end-to-end delivery · ports · reliability TCP · UDP · QUIC · SCTP SEGMENT = OSI 4 L2 Internet logical addressing & routing IP (v4/v6) · ICMP · OSPF · BGP · NAT · IPsec PACKET = OSI 3 L1 Network Access MAC + physical transmission Ethernet · Wi-Fi 802.11 · PPP · ARP · Fibre · DSL · 4G/5G FRAME / BITS = OSI 1+2 LAYER TCP/IP MODEL — 4 LAYERS PDU · OSI MAP
🧩
Same Job, Fewer Boxes

The 4 TCP/IP layers do all the same work as OSI's 7 — the model just groups related functions together (Network Access = Physical + Data Link, Application = Session + Presentation + Application).

Section 11 · Protocols

TCP/IP — Protocols & Devices per Layer

LayerPDUKey protocolsDevices
L4 · Application Data HTTP · HTTPS · DNS · SMTP · IMAP · POP3 · FTP · SFTP · SSH · Telnet · DHCP · SNMP · RTP · SIP · TLS WAF · API gateway · reverse proxy · end hosts
L3 · Transport Segment / Datagram TCP · UDP · SCTP · QUIC (encrypted UDP-based) L4 firewall · L4 load balancer
L2 · Internet Packet IPv4 · IPv6 · ICMP · IGMP · OSPF · BGP · IPsec · NAT · ARP* Router · L3 switch · L3 firewall
L1 · Network Access Frame / Bits Ethernet (802.3) · Wi-Fi (802.11) · PPP · HDLC · MAC · DSL · fibre PHY · 4G/5G radio Switch · Bridge · NIC · AP · Hub · Cable · Modem
📝
*ARP's Weird Spot

ARP maps an IP (Internet layer) to a MAC (Network Access layer). Different books place it differently — some at L1 (Network Access), some at L2 (Internet). Both are defensible.

🎯
The Sample Journey

When you open https://google.com: TLS + HTTP run at L4 (Application) → TCP runs at L3 (Transport) → IPv4/IPv6 runs at L2 (Internet) → Ethernet/Wi-Fi runs at L1 (Network Access). Every packet you send touches all four.

Section 12 · Compare

OSI vs TCP/IP — Side by Side

OSI Model · 7 layers TCP/IP Model · 4 layers 7 · Application 6 · Presentation 5 · Session 4 · Transport 3 · Network 2 · Data Link 1 · Physical grouped same same grouped 4 · ApplicationHTTP · DNS · SMTP · SSH · TLS 3 · Transport (TCP/UDP) 2 · Internet (IP · ICMP) 1 · Network AccessEthernet · Wi-Fi · PPP Reference model · teaching Working model · production internet
🎯
Why Both Still Exist

The internet actually runs on TCP/IP — its 4 layers collapse several OSI layers into one. But engineers still describe networks using OSI's 7 layers because it's more granular and precise for teaching, troubleshooting and certification (CCNA, CompTIA Net+).

Section 12 · Differences

OSI vs TCP/IP — Detailed Differences

PropertyOSI ModelTCP/IP Model
Layers7 layers4 layers
Developed byISO (1984)DoD / Vint Cerf & Bob Kahn (1970s)
PurposeReference / teaching modelPractical / working implementation
ApproachProtocols came after the modelModel came after the protocols (retrofit)
Session & PresentationSeparate layers (5 & 6)Rolled into Application (L4)
Physical & Data LinkSeparate layers (1 & 2)Rolled into Network Access (L1)
ReliabilityGuaranteed at Transport (Layer 4)Guaranteed at Transport by TCP
Real deploymentRarely — reference onlyRuns the entire modern internet
Used forTeaching · troubleshooting vocabulary · exam certsActual network design & operation
💬
Everyday Reality

Network engineers say "that's a Layer 3 issue" (OSI-speak) but the fix lands in a TCP/IP Internet layer config file. Both languages point to the same code — you just need to be fluent in both.

Section 13 · Part 1

OSI & TCP/IP Golden Rules — 1 to 4

🏆 CORE RULES · 1–4
1
7 layers, top to bottom: All People Seem To Need Data Processing. Application → Presentation → Session → Transport → Network → Data Link → Physical.
2
Each layer has one job — and one PDU. L7–L5 = Data · L4 = Segment · L3 = Packet · L2 = Frame · L1 = Bits.
3
Devices reveal their layer. Hub = L1 · Switch = L2 · Router = L3 · Load-balancer/firewall = L4 or L7. Higher = smarter but slower.
4
MAC is L2, IP is L3, Ports are L4. Master this and you can debug 90% of network issues by asking "which layer is broken?"
Section 13 · Part 2

OSI & TCP/IP Golden Rules — 5 to 8

🏆 CORE RULES · 5–8
5
Encapsulation = wrap with a header on the way down. Every layer prepends its own metadata (L2 also appends a trailer). Decapsulation reverses this on the way up.
6
TCP vs UDP is a Layer 4 choice. Reliable + ordered = TCP (web, email, SSH). Fast + connectionless = UDP (DNS, VoIP, gaming).
7
TLS = Layer 6, HTTPS = L7 over L6. Encryption is a presentation-layer service. It's added around L7 protocols like HTTP.
8
Real internet uses TCP/IP's 4 layers — but OSI's 7 layers remain the industry vocabulary for troubleshooting, design and every certification exam.
FINAL

You Now Speak OSI & TCP/IP Fluently

7OSI layers
5PDU names
10+Device types by layer
30+Protocols mapped
WrapEncapsulation
UnwrapDecapsulation
🎯
You Can Now…

Identify any layer's role, name its PDU, list its devices and protocols, and trace data as it's encapsulated down the sender's stack and decapsulated up the receiver's stack. This is the vocabulary the entire industry uses for designing and debugging networks.

📚
Where To Practise

Fire up Wireshark and watch real packets — every layer is right there in the capture. Do the Cisco Packet Tracer OSI labs. Read the classic Tanenbaum "Computer Networks" for the theory.

🧱 End of tutorial · Press to review, or click Restart