OSI Model Interview Questions: Layers, PDUs, Devices and Encapsulation
Last updated 2026-11-19
The OSI model is the first networking question in most interviews, and it is easy to give a memorised list and still lose the follow-ups. Interviewers ask which layer a given device, protocol or error belongs to, how data changes as it moves down the stack, and why the real internet uses a four- or five-layer model instead. This page answers those with the PDU names, device mapping and one encapsulation overhead calculation.
It is the layered foundation for the rest of networking. Once it is solid, move on to TCP/IP interview questions and computer networks interview questions. For the interview plan see how to crack a computer networks interview.
| Layers (top to bottom) | Application, Presentation, Session, Transport, Network, Data Link, Physical |
|---|---|
| PDUs | Data, segment or datagram, packet, frame, bits |
| Numerical | Frame size and header overhead for a full TCP segment |
Layer cheat sheet with PDUs
- Layer 7 Application (HTTP, SMTP, DNS, FTP): data. Layer 6 Presentation (encoding, compression, encryption): data. Layer 5 Session (session setup, dialog control): data.
- Layer 4 Transport (TCP, UDP, ports): segment for TCP, datagram for UDP. Layer 3 Network (IP, ICMP, routing): packet.
- Layer 2 Data Link (Ethernet, Wi-Fi, ARP, MAC addresses): frame. Layer 1 Physical (cables, signals, hubs): bits.
- Mnemonic from top: All People Seem To Need Data Processing. From the bottom: Please Do Not Throw Sausage Pizza Away.
OSI Model Interview Questions: questions with worked answers
1 What is the OSI model and why was it created?
easyThe Open Systems Interconnection model, published by ISO, divides network communication into seven layers, each with a defined job and a defined interface to the layers above and below. It was created so that products from different vendors could interoperate and so that engineers could reason about, develop and troubleshoot one layer at a time. It is a reference model; the protocols actually used on the internet follow the TCP/IP model.
2 Name the seven layers with one function each.
easyPhysical transmits raw bits over a medium. Data Link provides node-to-node delivery with framing, MAC addressing and error detection. Network does logical addressing and routing between networks. Transport gives end-to-end delivery between processes with ports, reliability and flow control. Session establishes, manages and terminates dialogues. Presentation translates formats, compresses and encrypts. Application provides network services to user programs such as HTTP and SMTP.
3 What is a PDU? Give the PDU at each layer.
easyA protocol data unit is the name for the data at a given layer, including that layer's headers. Application, presentation and session layers deal with data or messages, transport with segments (TCP) or datagrams (UDP), network with packets, data link with frames, and physical with bits. A router works on packets, a switch on frames.
4 Explain encapsulation and decapsulation.
mediumWhen the sender transmits, each layer adds its own header (and the data link layer also a trailer) to the data it receives from the layer above: application data gets a TCP header to become a segment, an IP header to become a packet, and an Ethernet header and trailer to become a frame, which is converted to bits. The receiver reverses the process, each layer stripping its header and handing the payload upward. Each layer talks to its peer layer logically using its own header only.
5 Numerical: A TCP segment carries 1460 bytes of data. With a 20-byte TCP header, 20-byte IP header, 14-byte Ethernet header and 4-byte Ethernet trailer (FCS), find the frame size and header overhead percentage.
mediumSegment = 1460 + 20 = 1480 bytes. Packet = 1480 + 20 = 1500 bytes, which equals the standard Ethernet MTU. Frame = 1500 + 14 + 4 = 1518 bytes, the maximum standard Ethernet frame size. Overhead = 20 + 20 + 14 + 4 = 58 bytes, so 58 / 1518 = 3.8 percent. For a 1-byte payload the minimum frame is padded to 64 bytes, so almost all of it is overhead, which is why small packets are inefficient.
6 Which devices operate at which layer?
mediumRepeaters and hubs operate at layer 1 (they regenerate signals). Bridges and switches operate at layer 2, forwarding on MAC addresses. Routers operate at layer 3 and layer 3 switches also route. Firewalls and load balancers can act at layers 3 to 7 depending on whether they filter on addresses and ports or inspect application content. Gateways and proxies typically work at layer 7.
7 Which layer is each of these: IP, TCP, HTTP, Ethernet, ARP, DNS, ICMP, SSH, TLS, MAC address, router, switch?
mediumIP, ICMP and routers are layer 3 (network). TCP is layer 4 (transport). HTTP, DNS and SSH are layer 7 (application). Ethernet, MAC addresses and switches are layer 2 (data link). ARP is usually placed at layer 2 (some call it 2.5 because it maps layer 3 addresses to layer 2). TLS does not fit cleanly: it runs above TCP and is commonly shown at the presentation or session layer, but in TCP/IP terms it is part of the application layer.
8 Differentiate the OSI model from the TCP/IP model.
mediumOSI has seven layers and was designed before the protocols; TCP/IP has four (application, transport, internet, network access) or five if physical and data link are separated, and the protocols came first. TCP/IP merges OSI's application, presentation and session layers into one application layer. OSI strictly separates the service, interface and protocol concepts; TCP/IP is more practical and is what the internet runs. See TCP/IP interview questions.
9 What is the difference between the data link layer and the network layer?
mediumThe data link layer delivers frames between two directly connected nodes on the same link, using MAC addresses, and detects bit errors with a CRC. The network layer delivers packets across multiple links from source host to destination host using IP addresses and routing. Frames are rebuilt at every hop with new source and destination MAC addresses, while the IP packet keeps the same source and destination addresses end to end.
10 What are the sublayers of the data link layer?
mediumLogical Link Control (LLC, IEEE 802.2) multiplexes network protocols over the link and can provide flow and error control. Media Access Control (MAC, for example 802.3 Ethernet and 802.11 Wi-Fi) controls how stations get access to the shared medium, handles framing and addressing, and uses methods like CSMA/CD or CSMA/CA.
11 Where do ports, IP addresses and MAC addresses each operate and what does each identify?
mediumA MAC address (layer 2) identifies a network interface on a link. An IP address (layer 3) identifies a host interface on a network. A port number (layer 4, 16 bits, 0 to 65535) identifies a process or service on the host. A complete network conversation is identified by the 5-tuple: protocol, source IP, source port, destination IP and destination port.
12 A user cannot open a website, but can ping its IP address. Using the layers, where is the likely fault?
mediumPing success shows layers 1 to 3 work: cabling, link and IP routing. The failure is higher up. The most likely cause is name resolution, a layer 7 DNS problem, so test with nslookup or dig. If DNS works, check layer 4 (a firewall blocking port 80 or 443, tested with curl or telnet to the port) and then layer 7 (the web server returning errors). Troubleshooting bottom-up or by bisecting the stack avoids guessing.
13 What does the transport layer add to the network layer's service?
mediumThe network layer is host-to-host and best-effort. The transport layer adds process-to-process delivery through ports, and with TCP also reliability (acknowledgements and retransmission), ordering, flow control and congestion control. UDP adds only ports and an optional checksum. See TCP vs UDP interview questions.
14 Why do many people say the session and presentation layers do not exist in practice?
hardIn the TCP/IP stack the functions of these two layers are handled by the application itself or by libraries: character encoding by the application, compression and encryption by TLS or application code, session management by cookies, tokens or the application protocol. No separate protocol layers implement them. They remain useful as concepts, for instance when explaining that TLS handles encryption and format translation sits between application and transport.
15 How does a frame travel from host A to host B on another network, and what changes at the router?
hardA sends the packet in a frame addressed to its default gateway's MAC (learned by ARP), with A's IP as source and B's IP as destination. The router removes the frame, reads the destination IP, looks up the next hop in the routing table, decrements the TTL, recalculates the IP header checksum, and builds a new frame with the router's outgoing interface MAC as source and the next hop (or B) as destination MAC. IP addresses stay unchanged unless NAT is involved; MAC addresses change at every hop.
Frequently asked questions
What is the easiest way to memorise the OSI layers?
Use a mnemonic such as All People Seem To Need Data Processing, from Application down to Physical, and attach one protocol or device to each layer: HTTP, TLS or encoding, session, TCP, IP, Ethernet, cable.
Is the OSI model used in practice?
As a vocabulary, yes: engineers say layer 2 switch, layer 3 router and layer 7 load balancer. The implementation on the internet follows TCP/IP.
At which layer does a firewall operate?
A packet filter works at layers 3 and 4 using addresses and ports, stateful firewalls track connections at layer 4, and a web application firewall or next-generation firewall inspects layer 7 content.
What is the maximum transmission unit?
The MTU is the largest packet a link can carry without fragmentation: 1500 bytes for standard Ethernet. A larger packet is fragmented or dropped, depending on the DF flag.
Related guides
- Computer Networks Interview Questions with Worked Answers and Numericals
- TCP/IP Interview Questions: Handshake, Congestion Control and Numericals
- TCP vs UDP Interview Questions with Socket Code and Numericals
- IP Addressing and Subnetting Interview Questions with Worked Solutions
- Network Security Interview Questions: Cryptography, Firewalls and Attacks
- What Happens When You Type a URL in the Browser: The Complete Answer
More in CS Fundamentals Interview Questions
- Paging and Virtual Memory Interview Questions with Numericals
- Process and Thread Interview Questions with fork() Output Problems
- Process Synchronization Interview Questions: Semaphores, Mutex and Classic Problems
- Redis Interview Questions and Answers
- REST API Interview Questions and Answers
- Routing Protocols Interview Questions: RIP, OSPF, BGP and Shortest Path Examples
- SDLC and Agile Interview Questions
- Shell Scripting Interview Questions with Bash Examples
- SOLID Principles Interview Questions with Examples
- System Design Interview Questions for Freshers
- System Design Interview Questions with Worked Designs
- TCP vs UDP Interview Questions with Socket Code and Numericals