The OSI Reference Model โ Revision Notes
The OSI model is the single most-asked networking interview question โ "name the 7 layers" and "which layer does X belong to?" are guaranteed. It's the conceptual map for all networking, so memorise the layers, their order, and their functions.
The seven layers (top to bottom)
| # | Layer | Function | PDU |
|---|---|---|---|
| 7 | Application | user-facing protocols (HTTP, FTP, DNS) | data |
| 6 | Presentation | translation, encryption, compression | data |
| 5 | Session | session setup/management, dialog control | data |
| 4 | Transport | end-to-end, segmentation, flow control, ports | segment |
| 3 | Network | routing, logical (IP) addressing | packet |
| 2 | Data Link | framing, MAC addressing, error detection | frame |
| 1 | Physical | raw bits over the medium | bits |
Mnemonics
Bottom-up: "Please Do Not Throw Sausage Pizza Away" (PhysicalโApplication). The PDU (protocol data unit) changes per layer: bits โ frames โ packets โ segments โ data.
Exam Tricks & Tips
- ๐ฏ Memorise the mnemonic "Please Do Not Throw Sausage Pizza Away" โ Physical, Data Link, Network, Transport, Session, Presentation, Application.
- ๐ฏ Match PDUs to layers: Physical=bits, Data Link=frames, Network=packets, Transport=segments โ a very common MCQ.
- ๐ฏ Routers = Network (L3), Switches = Data Link (L2), Hubs = Physical (L1) โ device-to-layer mapping is heavily tested.
- ๐ฏ IP addressing is Layer 3 (Network); MAC addressing is Layer 2 (Data Link) โ don't swap them.
- ๐ฏ Encryption/compression = Presentation (L6); ports and end-to-end delivery = Transport (L4).
- ๐ฏ The Data Link layer has two sublayers: LLC and MAC.
- โ Common mistake: placing encryption at the Application layer โ in OSI it belongs to the Presentation layer.
Expected pattern
"Name the 7 OSI layers in order", "which layer does a router/switch/encryption operate at?", "what is the PDU at layer X?", "MAC vs IP layer", and "function of the transport layer".
Quick recap
7 layers top-down: Application, Presentation, Session, Transport, Network, Data Link, Physical ("Please Do Not Throw Sausage Pizza Away" bottom-up). PDUs: bits/frames/packets/segments/data. Devices: hub=L1, switch=L2, router=L3. IP=L3, MAC=L2, encryption=L6, ports=L4.
The OSI Reference Model โ Flashcards
Cover the answer, recall, then check. 12 cards on the OSI model.
Q1. Name the 7 OSI layers from top to bottom.
A1. Application, Presentation, Session, Transport, Network, Data Link, Physical.
Q2. What is a common bottom-up mnemonic?
A2. "Please Do Not Throw Sausage Pizza Away" โ Physical, Data Link, Network, Transport, Session, Presentation, Application.
Q3. What layer does a router operate at?
A3. The Network layer (Layer 3) โ it routes packets using IP addresses.
Q4. What layer does a switch operate at?
A4. The Data Link layer (Layer 2) โ it forwards frames using MAC addresses.
Q5. What is the PDU at the Transport layer?
A5. A segment (TCP) or datagram (UDP).
Q6. Which layer handles logical (IP) addressing?
A6. The Network layer (Layer 3).
Q7. Which layer handles physical (MAC) addressing?
A7. The Data Link layer (Layer 2).
Q8. Which layer handles encryption and compression?
A8. The Presentation layer (Layer 6).
Q9. What are the PDUs from Physical up to Network?
A9. Bits (Physical), frames (Data Link), packets (Network).
Q10. Which layer provides end-to-end delivery, flow control, and ports?
A10. The Transport layer (Layer 4).
Q11. What are the two sublayers of the Data Link layer?
A11. LLC (Logical Link Control) and MAC (Media Access Control).
Q12. At which layer do HTTP, FTP, and DNS operate?
A12. The Application layer (Layer 7).
The OSI Reference Model
The OSI model is networking's master map: seven layers that break "send data across a network" into manageable, independent problems. Even though real networks run TCP/IP, OSI remains the vocabulary engineers use โ and a certain exam question.
Core idea: the OSI (Open Systems Interconnection) model is a 7-layer conceptual framework where each layer handles one aspect of communication and provides services to the layer above, hiding the details below. Layering lets each layer change independently as long as its interface stays fixed.
How it works
Beginner โ the seven layers (top to bottom)
- Application โ user-facing protocols (HTTP, FTP, SMTP, DNS).
- Presentation โ translation, encryption, compression (data format, TLS, JPEG).
- Session โ establishing/managing/terminating sessions (dialogue control).
- Transport โ end-to-end delivery, reliability, ports (TCP, UDP).
- Network โ logical addressing and routing between networks (IP, routers).
- Data Link โ node-to-node delivery on a link, MAC addressing, framing (Ethernet, switches).
- Physical โ raw bits over the medium (cables, voltages, radio).
Intermediate โ encapsulation
As data descends the sending stack, each layer wraps it with its own header (and the data-link layer adds a trailer): the PDU (Protocol Data Unit) is named per layer:
Application data -> Segment (L4, +TCP header) -> Packet (L3, +IP header)
-> Frame (L2, +MAC header/trailer) -> Bits (L1)
The receiver reverses this (de-encapsulation), each layer stripping its header. Each layer talks logically to its peer layer on the other host.
Advanced โ layer responsibilities and devices
Layers map to real devices: hubs (L1), switches/bridges (L2, MAC-based), routers (L3, IP-based), and gateways/firewalls operate up to L4โL7. Key responsibilities to keep straight:
- Data Link = MAC addresses, error detection within a link, framing.
- Network = IP addresses, routing/path selection across networks, fragmentation.
- Transport = ports, end-to-end reliability (TCP), flow/congestion control.
Worked example โ tracing a web request through the layers
You type a URL and hit Enter:
- Application (L7): browser forms an HTTP GET request.
- Presentation (L6): TLS encrypts it (HTTPS).
- Session (L5): a session is maintained for the exchange.
- Transport (L4): TCP splits it into segments, adds source/dest ports and sequence numbers.
- Network (L3): IP wraps each segment in a packet with source/dest IP addresses and routes it.
- Data Link (L2): each packet becomes a frame with source/dest MAC addresses for the next hop.
- Physical (L1): bits go out as electrical/optical/radio signals.
The server's stack de-encapsulates in reverse, delivering the HTTP request to its web server. This top-to-bottom-then-bottom-to-top journey is the model's whole point.
Interview & exam relevance
Guaranteed: "name the 7 OSI layers in order", "which layer does X (router/switch/IP/TCP/HTTP) operate at", "what is encapsulation", and "OSI vs TCP/IP model". Matching a protocol or PDU to its layer is the most common question format.
Tricks & gotchas
- Switch = L2 (MAC); Router = L3 (IP) โ the most-tested device-to-layer mapping.
- PDUs by layer: L4 = segment, L3 = packet, L2 = frame, L1 = bits.
- OSI is a reference model (conceptual); the internet actually runs the TCP/IP model โ don't claim OSI is "used" as-is.
- Mnemonic (L7โL1): "All People Seem To Need Data Processing."
Mixing up the Data Link and Network layers โ especially assigning IP addresses to L2 or MAC addresses to L3. MAC addresses and switches are Layer 2 (node-to-node on a link); IP addresses, routing and routers are Layer 3 (host-to-host across networks). This layer/address mapping is the single most common OSI exam error.
- โ- OSI has 7 layers: Application, Presentation, Session, Transport, Network, Data Link, Physical.
- โ- Each layer serves the one above and hides lower details (layering enables independent change).
- โ- Encapsulation adds a header per layer descending; the receiver de-encapsulates in reverse.
- โ- Devices: hub (L1), switch (L2/MAC), router (L3/IP); PDUs: segment/packet/frame/bits.
- โ- OSI is conceptual; TCP/IP is the model actually deployed.
- โThe OSI model layers networking into 7 independent responsibilities from Physical bits to Application protocols, with data encapsulated by a header at each descending layer. Master the layer order, the protocol/device mapping (switch=L2, router=L3), and encapsulation.
The OSI Reference Model โ Worked Example
Worked Example
Problem: When you click a link and a browser sends an HTTP request over Wi-Fi, trace which OSI layer performs each of these actions and name one protocol/PDU for each: (1) formatting the GET request, (2) splitting into segments with port numbers, (3) adding source/destination IP addresses, (4) adding MAC addresses for the next hop, (5) turning bits into radio signals.
Solution:
The OSI model has 7 layers, top to bottom: Application, Presentation, Session, Transport, Network, Data Link, Physical (mnemonic top-down: "All People Seem To Need Data Processing"). Each layer adds its own header (encapsulation) as data descends the stack.
(1) Formatting the GET request โ Layer 7 Application. The browser (HTTP) creates the request message; the PDU here is "data/message". (Presentation/Session, layers 6/5, handle encoding/encryption and dialog control โ e.g. TLS is often placed around 6.)
(2) Splitting into segments with port numbers โ Layer 4 Transport. TCP breaks the byte stream into segments and stamps source/destination ports (e.g. dest port 80/443) for end-to-end delivery and reliability. PDU = segment.
(3) Adding source/destination IP addresses โ Layer 3 Network. IP wraps each segment in a packet with logical (IP) addresses and handles routing across networks. PDU = packet.
(4) Adding MAC addresses for the next hop โ Layer 2 Data Link. Ethernet/Wi-Fi frames the packet with physical (MAC) addresses of THIS hop (your NIC โ the router), and does error detection (CRC). PDU = frame. ARP resolves the next-hop IP to its MAC here.
(5) Turning bits into radio signals โ Layer 1 Physical. The Wi-Fi radio encodes the frame's bits as electromagnetic signals on the medium. PDU = bits.
At the receiver each layer strips its own header (decapsulation) in reverse, handing the payload up until the server's HTTP layer sees the original GET.
Answer: (1) Application/HTTP (message), (2) Transport/TCP with ports (segment), (3) Network/IP (packet), (4) Data Link/Ethernet-Wi-Fi with MAC + ARP (frame), (5) Physical (bits/signals). Data is encapsulated with a header per layer on the way down and decapsulated on the way up.
- โ- OSI has 7 layers; each adds a header (encapsulation) descending and removes it (decapsulation) ascending.
- โ- Transport uses ports (segments), Network uses IP addresses (packets), Data Link uses MAC addresses (frames).
- โ- Logical addressing (IP) is Layer 3; physical addressing (MAC) is Layer 2; the Physical layer moves raw bits.