Bird
Raised Fist0
Interview Prepcomputer-networkseasyAmazonGoogleMicrosoftTCSInfosysWipro

OSI Model - Seven Layers, Functions & PDUs

Choose your preparation mode3 modes available
🎯
OSI Model - Seven Layers, Functions & PDUs
easyNETWORKSAmazonGoogleMicrosoft

Imagine sending a letter through a complex postal system where each department adds its own envelope and label to ensure it reaches the right destination safely and efficiently. The OSI model works similarly for data communication.

💡 Beginners often confuse the OSI model layers as just a list to memorize rather than understanding how each layer interacts and transforms data, leading to shallow or incorrect explanations.
📋
Interview Question

Explain the OSI model and its seven layers. What is the Protocol Data Unit (PDU) at each layer, and what are the primary functions of each layer?

The seven layers of the OSI model and their responsibilitiesThe concept of Protocol Data Units (PDU) and how data encapsulation worksHow layers interact and the flow of data from sender to receiver
💡
Scenario & Trace
ScenarioA user opens a web browser and requests a webpage from a remote server.
Application layer creates HTTP request (Data) → Presentation layer formats data (Data) → Session layer establishes connection (Data) → Transport layer segments data into TCP segments (Segment) → Network layer encapsulates segments into IP packets (Packet) → Data Link layer frames packets into Ethernet frames (Frame) → Physical layer converts frames into electrical signals (Bits) → Signals travel over the physical medium to the server.
ScenarioTwo computers on a LAN communicate using Ethernet.
Application layer generates data → Data Link layer adds MAC addresses and forms frames → Physical layer transmits bits over the cable → Receiving computer's Physical layer receives bits → Data Link layer checks frame integrity and extracts packets → Network layer processes IP packets → Transport layer reassembles segments → Application layer receives data.
  • What happens if a layer fails to add or remove its header correctly?
  • How does the OSI model handle data when protocols at different layers are incompatible?
  • What if a device only supports a subset of OSI layers, such as a switch operating only at Layer 2?
⚠️
Common Mistakes
Confusing the order of OSI layers

Interviewer doubts your fundamental understanding of the model

✅ Memorize the correct order and use mnemonics like 'Please Do Not Throw Sausage Pizza Away'

Mixing up PDUs at different layers

Shows superficial knowledge and inability to explain encapsulation

✅ Remember specific PDU names: bits, frames, packets, segments, data

Treating OSI layers as independent rather than interacting

Fails to convey how data flows and is processed end-to-end

✅ Explain encapsulation and decapsulation as a continuous process

Assuming all network devices implement all OSI layers

Interviewer may think you lack practical networking knowledge

✅ Clarify that devices like switches operate mainly at Layer 2, routers at Layer 3

🧠
Basic Definition - What It Is
💡 This level covers the essential knowledge you must have to answer basic interview questions confidently.

Intuition

The OSI model is a conceptual framework that divides network communication into seven distinct layers, each with specific roles.

Explanation

The OSI (Open Systems Interconnection) model is a seven-layer framework designed to standardize and simplify network communication. Each layer has a defined function, such as transmitting raw bits, routing packets, or managing sessions. The model helps different network devices and protocols interoperate by providing a common language and structure. The Protocol Data Unit (PDU) changes names at each layer, reflecting how data is packaged: bits at the Physical layer, frames at the Data Link layer, packets at the Network layer, segments at the Transport layer, and data at the upper layers.

Memory Hook

💡 Think of mailing a letter: writing the letter (Application), putting it in an envelope (Data Link frame), addressing it (Network packet), and sending it through postal routes (Physical signals).

Interview Questions

❓ Can you name the seven OSI layers in order?
  • Physical, Data Link, Network, Transport, Session, Presentation, Application
❓ What is the PDU at the Network layer?
  • Packet
⏱
Depth Level
Interview Time30 seconds
Depthbasic

Covers naming layers, basic functions, and PDU terminology; sufficient for screening rounds.

Interview Target: Minimum floor - never go below this

Knowing only this will help you pass initial screening but won't impress in detailed technical interviews.

🧠
Mechanism Depth - How It Works
💡 This level is expected in product company interviews and demonstrates a deeper understanding of data flow and encapsulation.

Intuition

Data communication is a layered process where each OSI layer adds or removes headers/trailers to manage specific tasks, enabling modular and interoperable networking.

Explanation

Each OSI layer performs specific functions and communicates with its peer layer on the receiving side. When sending data, the Application layer generates the message, which passes down through Presentation and Session layers for formatting and session management. The Transport layer segments the data and adds port information for multiplexing. The Network layer adds logical addressing (IP) and routing information. The Data Link layer frames the packet with physical addressing (MAC) and error detection codes. Finally, the Physical layer converts frames into electrical or optical signals for transmission. On the receiving end, each layer strips off its corresponding header/trailer and processes the data accordingly. This encapsulation and decapsulation process ensures reliable and organized communication across diverse networks.

Memory Hook

💡 Imagine nesting dolls where each doll represents a layer adding its own wrapper; the receiver unwraps them in reverse order to get the original message.

Interview Questions

❓ Explain how data encapsulation works in the OSI model.
  • Data is wrapped with headers/trailers at each layer
  • Each layer adds its own control information
  • Encapsulation enables modular communication and error handling
❓ What happens at the Transport layer?
  • Segmentation of data
  • Adding port numbers for multiplexing
  • Ensuring reliable delivery (TCP) or connectionless delivery (UDP)
❓ How do PDUs differ across layers?
  • Bits at Physical layer
  • Frames at Data Link layer
  • Packets at Network layer
  • Segments at Transport layer
  • Data at upper layers
⏱
Depth Level
Interview Time2-3 minutes
Depthintermediate

Demonstrates understanding of encapsulation, layer responsibilities, and data flow; suitable for on-site interviews.

Interview Target: Target level for FAANG on-sites

Mastering this level distinguishes you from most candidates and shows readiness for system design and troubleshooting questions.

📊
Explanation Depth Levels
💡 Choose your explanation depth based on interview stage and company expectations.
LevelInterview TimeSuitable ForRisk
Basic Definition30sScreening call or initial roundsToo shallow for on-site or technical deep-dives
Mechanism Depth2-3 minutesOn-site interviews at product companiesRequires good preparation; missing details can lose points
💼
Interview Strategy
💡 Use this guide to structure your explanation clearly and confidently before every mock or real interview.

How to Present

Start with a brief definition of the OSI model and its purpose.Use a simple analogy or example to illustrate the layered approach.Explain the function of each layer and the PDU associated with it.Discuss how data encapsulation and decapsulation work during transmission.Mention common edge cases or exceptions to show depth.

Time Allocation

Definition: 30s → Example: 1min → Mechanism: 2min → Edge cases: 30s. Total ~4min

What the Interviewer Tests

Your clarity on layer functions, ability to explain encapsulation, and understanding of how data flows through the model.

Common Follow-ups

  • What is the difference between the OSI and TCP/IP models? → OSI is conceptual with 7 layers; TCP/IP has 4 layers and is practical.
  • How does the OSI model help in troubleshooting network issues? → By isolating problems to specific layers.
💡 These follow-ups test your ability to connect concepts and apply knowledge practically.
🔍
Pattern Recognition

When to Use

Interviewers ask about the OSI model when assessing your foundational networking knowledge or troubleshooting skills.

Signature Phrases

'Explain the OSI model''What are the seven layers?''What is the PDU at each layer?''How does data flow through the OSI layers?'

NOT This Pattern When

Similar Problems

Practice

(1/5)
1. In which scenario is Source NAT (SNAT) most appropriately used within a private IPv4 network?
easy
A. When internal hosts initiate outbound connections to the internet, hiding their private IPs behind a public IP
B. When external users need to access a specific internal server via a public IP and port
C. When translating destination IP addresses for incoming packets to reach internal hosts
D. When mapping multiple public IPs to a single internal IP without port translation

Solution

  1. Step 1: Identify SNAT purpose

    SNAT modifies the source IP of outgoing packets, typically to allow multiple internal hosts to share a public IP for internet access.
  2. Step 2: Analyze options

    When internal hosts initiate outbound connections to the internet, hiding their private IPs behind a public IP correctly describes SNAT's role in outbound connections. When external users need to access a specific internal server via a public IP and port describes DNAT or port forwarding. When translating destination IP addresses for incoming packets to reach internal hosts is DNAT's function. When mapping multiple public IPs to a single internal IP without port translation is not typical SNAT behavior.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    SNAT = source IP translation for outbound traffic [OK]
Hint: SNAT changes source IP for outbound traffic
Common Mistakes:
  • Confusing SNAT with DNAT
  • Assuming SNAT handles inbound connections
  • Believing SNAT can map multiple public IPs to one internal IP without ports
2. Which of the following statements about ARP spoofing is INCORRECT?
medium
A. ARP spoofing can allow an attacker to intercept or modify traffic between two hosts on the same subnet.
B. ARP spoofing exploits the lack of authentication in the ARP protocol.
C. ARP spoofing relies on sending fake ARP replies to poison the ARP cache of target devices.
D. Using static ARP entries completely eliminates the risk of ARP spoofing in a network.

Solution

  1. Step 1: Understand ARP spoofing basics

    It involves sending forged ARP messages to associate the attacker's MAC with a legitimate IP.
  2. Step 2: Static ARP entries reduce risk but don't completely eliminate it

    Static entries prevent cache poisoning but are hard to manage and can be bypassed in some scenarios.
  3. Step 3: Why Using static ARP entries completely eliminates the risk of ARP spoofing in a network. is incorrect

    Static ARP entries help but do not guarantee complete protection, especially in large or dynamic networks.
  4. Step 4: Other options are correct

    They accurately describe ARP spoofing mechanisms and vulnerabilities.
  5. Final Answer:

    Option D -> Option D
  6. Quick Check:

    Static ARP entries mitigate but do not fully eliminate ARP spoofing risk [OK]
Hint: Static ARP entries help but are not foolproof against spoofing [OK]
Common Mistakes:
  • Assuming static ARP entries are a perfect solution
  • Underestimating ARP spoofing attack methods
3. Which of the following statements about Distance Vector routing is INCORRECT?
medium
A. Routers using Distance Vector routing have complete knowledge of the entire network topology
B. Distance Vector routing can suffer from the count-to-infinity problem causing slow convergence
C. Distance Vector routing updates are sent only to immediate neighbors
D. Split horizon and poison reverse are techniques used to prevent routing loops in Distance Vector

Solution

  1. Step 1: Recall Distance Vector knowledge scope

    Distance Vector routers only know routes advertised by neighbors, not the full network topology.
  2. Step 2: Analyze each statement

    Distance Vector routing can suffer from the count-to-infinity problem causing slow convergence is true; count-to-infinity is a known Distance Vector issue. Distance Vector routing updates are sent only to immediate neighbors is true; updates go only to neighbors. Split horizon and poison reverse are techniques used to prevent routing loops in Distance Vector is true; split horizon and poison reverse help prevent loops.
  3. Step 3: Identify incorrect statement

    Routers using Distance Vector routing have complete knowledge of the entire network topology is false because complete topology knowledge is a characteristic of Link State routing, not Distance Vector.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    Distance Vector routers have partial, neighbor-based knowledge only.
Hint: Full topology knowledge -> Link State, not Distance Vector
Common Mistakes:
  • Assuming Distance Vector routers know entire topology
  • Confusing update scope between routing types
  • Ignoring loop prevention techniques
4. Why might the TCP three-way handshake introduce latency, and when could this be a disadvantage?
medium
A. Because it requires multiple round-trip times before data transfer, causing delay in time-sensitive applications
B. Because it encrypts all packets during handshake, increasing processing time
C. Because it uses UDP packets which are slower than TCP packets
D. Because it requires the server to send data before the client can send any

Solution

  1. Step 1: Identify handshake latency cause

    The handshake requires at least one full round-trip time (RTT) before data can be sent, introducing delay.
  2. Step 2: Analyze options

    Because it requires multiple round-trip times before data transfer, causing delay in time-sensitive applications correctly states the latency due to multiple RTTs, which can be problematic for real-time or low-latency applications. Because it encrypts all packets during handshake, increasing processing time is incorrect; encryption is separate from handshake. Because it uses UDP packets which are slower than TCP packets is false; handshake uses TCP packets, not UDP. Because it requires the server to send data before the client can send any is incorrect; the client sends data after handshake completes.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Handshake latency = multiple RTTs before data flow.
Hint: Handshake latency = waiting for multiple packet exchanges before data
Common Mistakes:
  • Confusing handshake with encryption overhead
  • Thinking handshake uses UDP packets
  • Believing server sends data first
5. If a web application uses a custom API that returns a 4xx status code for rate limiting (too many requests), what is the best practice for the server's response to help clients handle this scenario gracefully?
hard
A. Return a 500 status code to indicate the server is overloaded and cannot process requests.
B. Return a 403 status code without any additional headers to block the client permanently.
C. Return a 429 status code with a Retry-After header indicating when the client can retry.
D. Return a 200 status code with an error message in the response body.

Solution

  1. Step 1: Understand rate limiting status codes

    429 Too Many Requests is the standard status code for rate limiting.
  2. Step 2: Importance of Retry-After header

    Including Retry-After tells the client when to retry, enabling graceful handling.
  3. Step 3: Analyze options

    Return a 429 status code with a Retry-After header indicating when the client can retry. is correct: 429 + Retry-After is best practice.
    Return a 403 status code without any additional headers to block the client permanently. is incorrect: 403 forbids access but does not indicate rate limiting or retry timing.
    Return a 500 status code to indicate the server is overloaded and cannot process requests. is incorrect: 500 indicates server error, not client rate limiting.
    Return a 200 status code with an error message in the response body. is incorrect: 200 means success, which misleads clients about request status.
  4. Final Answer:

    Option C -> Option C
  5. Quick Check:

    Use 429 with Retry-After for rate limiting to communicate clearly with clients.
Hint: 429 + Retry-After = polite rate limiting
Common Mistakes:
  • Using 403 or 500 instead of 429 for rate limiting
  • Omitting Retry-After header causing client confusion
  • Returning 200 with error message, breaking client logic
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard