Networking › Module 1 › Lesson 1
OSI 7 Layers Explained
Master the OSI model layers and why each one matters for security analysts
Opening
Incidents have a location. OSI is how you name it.
A SOC ticket that says "the network is broken" is useless. Is the cable unplugged, a switch CAM table poisoned, a route missing, a port filtered, or a web app serving malware? Those are different rooms in the same building. The OSI model is the floor plan defenders use to stop arguing past each other. You already know how to inventory a Linux box. Packets leaving that box still climb and descend a stack. If you cannot say which layer a symptom lives on, you will apply a firewall rule to a Layer-2 problem, or blame DNS for a cut fiber. This lesson is not a song. It is a location language.
1. Seven layers as a map, not a mnemonic
The Open Systems Interconnection (OSI) model is a shared vocabulary invented so vendors and operators could talk about "who does what" without pretending one product owned the whole path. It is a reference model: seven jobs stacked so that each layer uses the layer below and serves the layer above. Real packets on the internet are built with TCP/IP (next lesson). OSI still wins the meeting because tickets, RFCs, certifications, and Wireshark trees all point at these floors.
Please Do Not Throw Sausage Pizza Away (Physical, Data Link, Network, Transport, Session, Presentation, Application) is a once-and-done memory hook. Recite it if an exam demands order. Then forget it as a teaching method. A mnemonic does not tell you why a switch cannot fix a missing default route, or why TLS sitting "near" Layer 6 still shows up in a Layer-7 HTTP conversation. Mechanism does.
Encapsulation is the mechanism. When your browser sends a request, application data is the innermost payload. As the message walks down the stack, each layer wraps that payload with its own header (and Layer 2 often a trailer). Layer 4 adds ports and sequence numbers. Layer 3 adds source and destination IP. Layer 2 adds MAC addresses for the next hop on this wire. Layer 1 turns the frame into bits on copper, fiber, or radio. Going up the stack at the receiver is de-encapsulation: peel the header, hand the inside to the layer above. That is why a capture looks like nested dolls — Ethernet contains IP contains TCP contains HTTP.
Names of the PDU (protocol data unit) change with the floor, and analysts use those names on purpose. Bits at Layer 1. Frames at Layer 2 (MAC, local segment). Packets at Layer 3 (IP, routed). Segments or datagrams at Layer 4 (TCP/UDP). Calling an Ethernet frame "a packet" in a bridging incident hides the fact that the IP header never changed — only the MAC wrapper did. Precision here is not pedantry; it is how you pick the right device to debug.
2. What each floor actually does — and what SOC uses daily
Layer 1 Physical is energy on a medium: voltage, light pulses, radio. No addresses. If the link light is dead, you do not open Wireshark first. Physical access is a different threat class from remote exploitation: someone in the building can unplug, tap, jam, or plant a device. A remote attacker on the internet does not get Layer 1 on your rack unless they already have a foothold or a compromised path. Badge control and cable hygiene are security controls, not "IT plumbing."
Layer 2 Data Link delivers frames on one local network. Ethernet and Wi-Fi live here. Addresses are MACs. Switches forward by destination MAC. ARP (IPv4) asks "who has this IP?" so a host can fill the next-hop MAC. That is why ARP spoofing, MAC flooding, and rogue access points are Layer-2 incidents: they hijack local delivery before IP routing matters. A packet capture that shows the wrong MAC for the gateway is a Layer-2 finding even if the IP looks fine.
Layer 3 Network moves packets between networks using IP addresses. Routers read the destination IP, decrement TTL, and pick a next hop. IP spoofing, rogue routes, and "can reach the internet but not the other VLAN" tickets live here. Layer 4 Transport is end-to-end between processes: TCP or UDP, plus port numbers that name the service (22, 443, 53). Firewalls often match the 5-tuple (src IP, dst IP, proto, src port, dst port) — that is Layer 3 plus Layer 4 working as one control. SYN floods and "port 445 open to the world" are Layer-4 shaped even when the root cause is a bad rule.
Layers 5 Session and 6 Presentation exist in the model — dialogues, encoding, compression, some encryption concepts — but production tickets almost never say "Layer 5." TLS, JSON, and character encoding show up inside application traffic. Layer 7 Application is HTTP, DNS, SMTP, SMB: the protocols users and malware actually speak. Phishing pages, SQL injection, and C2-over-HTTPS are Layer 7. SOC daily language is L2 / L3 / L4 / L7. Learn all seven for exams and for reading docs. Investigate with the four that appear in dashboards.
3. Wrong vs right: treating OSI as a song
Worked failure mode — first week of networking class. Same seven names, opposite usefulness:
Wrong
You memorize the pizza mnemonic, then tell a teammate "it is Layer 4" because ports were mentioned once, while the actual symptom is a dark link light (Layer 1) or a poisoned ARP cache (Layer 2). Or you nmap the office LAN "to see all layers" without permission. The model becomes trivia; the network becomes a crime scene.
Right
Ask: where does this symptom have to live? No link = start at L1. Wrong MAC for the gateway = L2. Cannot leave the subnet = L3. Service port filtered = L4. Browser error / DNS / HTTP payload = L7. Practice only on your VM, WSL, or home lab. Inventory your own L2 vs L3 with ip link and ip addr — never scan someone else's network to "learn OSI."
4. Practical: locate the layer, then inventory YOUR stack
First, classify on paper. Then prove Layer 2 vs Layer 3 on a machine you own. ip link shows interfaces and MACs (Layer 2). ip addr shows inet/inet6 (Layer 3). Do not add, delete, or flush addresses. Do not scan the LAN.
Command guide
L2 vs L3 inventory on your VM / WSL only
YOUR Linux VM, WSL, or spare box — never someone else's network
Command — copy this
ip link ip addr ip -br addr
Optional command
Read the output:
link/ether aa:bb:cc:... → Layer 2 (MAC) on that iface inet 192.168.x.x/24 → Layer 3 (IPv4) on that iface lo / 127.0.0.1 → this host talking to itself, not the LAN
Optional: confirm you are actually in a Linux userspace
Command — copy this
cat /etc/os-release
NEVER: nmap, arp-scan, or "ping sweep" the office / school / neighbor Wi-Fi NEVER: ip link set down or ip addr flush on a box you cannot recover This is a map of YOUR doors, not a weapon.
Mission: one scenario, one layer, then your own L2 vs L3
1) Write three lines, each naming the OSI layer: (a) laptop has no Ethernet link light, (b) Wireshark shows your gateway MAC suddenly belonging to another host, (c) users hit a fake login page on HTTPS. 2) On your own VM or WSL, run ip link and ip addr. Write the MAC (L2) and inet CIDR (L3) of one non-lo iface. 3) Say once: "OSI names the floor; encapsulation is why headers nest." Do not scan any other network.
Stuck? Ask Cyberlium AI Mentor
If two symptoms feel like they live on the same floor, ask Cyberlium AI Mentor for a hint — not a cheat sheet of all seven. Try: "Hint only: dark link light vs wrong gateway MAC vs phishing page — which OSI floors, and why not all Layer 7?" No spoilers; you should still place the ticket yourself.
You now treat OSI as a location language: encapsulation wraps going down, SOC lives mostly at L2/L3/L4/L7, and physical access is a different door from remote IP. Next up — TCP/IP Model — the four-layer stack that real packets actually wear, mapped onto these seven names so you can read both the textbook and the capture.
Knowledge Check
APPLY: A helpdesk ticket says "Wi-Fi works but we cannot reach the other office subnet." ping to 127.0.0.1 succeeds on the laptop. Link light is on. Which OSI layer should you investigate first?
Multiple choice
Knowledge Check
APPLY: An intern recites the sausage mnemonic, then runs a port scan of the school LAN "to practice Layer 4." What is the correct response?
Multiple choice
Knowledge Check
APPLY: True or False: Because SOC tickets rarely mention Session and Presentation, those layers mean encapsulation does not add headers below Layer 7.
True or False