Bird
Raised Fist0
Interview Prepcomputer-networkseasyAmazonGoogleMicrosoftTCSInfosysWipro

OSI Model - Seven Layers, Functions & PDUs

Choose your preparation mode3 modes available
▶
Steps
send

Layer 7 - Application: HTTP GET request created

Browser generates an HTTP GET request. This is raw application data - the payload that the user actually wants to send. PDU = Data. Protocol: HTTP.

💡 The Application layer is where user-facing protocols live: HTTP, FTP, DNS, SMTP. It creates the message but has no idea how it will travel across the network.
Line:# No code - conceptual layer # HTTP GET /index.html HTTP/1.1 # Host: www.example.com
💡 The Application layer only cares about 'what' to send, not 'how'. It hands the data down to Presentation.
📊
OSI Model - Watch an HTTP Request Flow Through All 7 Layers
The key insight: data goes DOWN the layers on the sender (each layer adds a header), crosses the network as bits, then goes UP the layers on the receiver (each layer removes its header). This is called encapsulation and decapsulation.
Step 1/11
·Active fill★Answer cell
Application layer creates HTTP GET request. PDU = Data. Handed to Presentation layer.
Hop: 1
Layer 7: Application (Sender)
Layer 6: Presentation (Sender)
Layer 5: Session (Sender)
Layer 4: Transport (Sender)
Layer 3: Network (Sender)
Layer 2: Data Link (Sender)
Layer 1: Physical (Sender)
Layer 1: Physical (Receiver)
Layer 2: Data Link (Receiver)
Layer 3: Network (Receiver)
Layer 4: Transport (Receiver)
Layer 5: Session (Receiver)
Layer 6: Presentation (Receiver)
Layer 7: Application (Receiver)
📦Packet
↗ fromApp_Tx
↘ toPres_Tx
📄 payloadData (HTTP GET)
🔌 protocolHTTP
Layer 7 (App) → Data created: HTTP GET /index.html
Presentation layer formats and optionally encrypts data. PDU = Data.
Hop: 2
Layer 7: Application (Sender)
Layer 6: Presentation (Sender)
Layer 5: Session (Sender)
📦Packet
↗ fromPres_Tx
↘ toSession_Tx
📄 payloadData (formatted/encrypted)
🔌 protocolSSL/TLS
Layer 7 (App) → Data: HTTP GET /index.html
Layer 6 (Pres) → Data: Encoded/encrypted
Session layer manages connection dialog. PDU = Data.
Hop: 3
Layer 6: Presentation (Sender)
Layer 5: Session (Sender)
Layer 4: Transport (Sender)
📦Packet
↗ fromSession_Tx
↘ toTransport_Tx
📄 payloadData (session-managed)
🔌 protocolNetBIOS/RPC
Layer 7 (App) → Data: HTTP GET
Layer 6 (Pres) → Data: Encoded
Layer 5 (Session) → Data: Session established
Transport layer adds TCP header with port numbers and sequence number. PDU = Segment.
Hop: 4
Layer 5: Session (Sender)
Layer 4: Transport (Sender)
Layer 3: Network (Sender)
📦Packet
↗ fromTransport_Tx
↘ toNetwork_Tx
📄 payloadSegment (TCP header + Data)
🔌 protocolTCP
Layer 6 (Pres) → Data: Encoded
Layer 5 (Session) → Data: Session OK
Layer 4 (Transport) → Segment: src=54321 dst=80 seq=1
Network layer adds IP header with src/dst IP addresses. PDU = Packet.
Hop: 5
Layer 4: Transport (Sender)
Layer 3: Network (Sender)
Layer 2: Data Link (Sender)
📦Packet
↗ fromNetwork_Tx
↘ toDataLink_Tx
📄 payloadPacket (IP header + Segment)
🔌 protocolIP
Layer 5 (Session) → Data: Session
Layer 4 (Transport) → Segment: TCP ports+seq
Layer 3 (Network) → Packet: src=192.168.1.10 dst=93.184.216.34
Data Link adds Ethernet header (MAC addresses) and CRC trailer. PDU = Frame.
Hop: 6
Layer 3: Network (Sender)
Layer 2: Data Link (Sender)
Layer 1: Physical (Sender)
📦Packet
↗ fromDataLink_Tx
↘ toPhysical_Tx
📄 payloadFrame (MAC header + Packet + CRC)
🔌 protocolEthernet
Layer 7→Data | Layer 6→Data:enc | Layer 5→Data:session
Layer 4→Segment:TCP | Layer 3→Packet:IP
Layer 2 (DataLink) → Frame: src_mac+dst_mac+CRC
Physical layer converts Frame to bits and transmits over physical medium. Receiver's Physical layer detects signal.
Hop: 7
Layer 2: Data Link (Sender)
Layer 1: Physical (Sender)
Layer 1: Physical (Receiver)
📦Packet
↗ fromPhysical_Tx
↘ toPhysical_Rx
📄 payloadBits (010110001...)
🔌 protocolEthernet PHY
L4→Segment | L3→Packet | L2→Frame
Layer 1 (Physical) → Bits: transmitted over medium
RECEIVER SIDE: (decapsulation begins)
Data Link layer validates CRC and strips Ethernet header. PDU = Packet passed up.
Hop: 8
Layer 1: Physical (Receiver)
Layer 2: Data Link (Receiver)
Layer 3: Network (Receiver)
📦Packet
↗ fromDataLink_Rx
↘ toNetwork_Rx
📄 payloadPacket (Ethernet stripped)
🔌 protocolEthernet → IP
Receiver L1 → Bits received
Receiver L2 (DataLink) → Frame: CRC OK, MAC header stripped → Packet
Network layer verifies IP and strips header. PDU = Segment passed up.
Hop: 9
Layer 2: Data Link (Receiver)
Layer 3: Network (Receiver)
Layer 4: Transport (Receiver)
📦Packet
↗ fromNetwork_Rx
↘ toTransport_Rx
📄 payloadSegment (IP stripped)
🔌 protocolIP → TCP
Receiver L2 → Frame→Packet
Receiver L3 (Network) → Packet: dst_ip matched, IP header stripped → Segment
Transport layer reassembles segments, sends ACK, strips TCP header. PDU = Data.
Hop: 10
Layer 3: Network (Receiver)
Layer 4: Transport (Receiver)
Layer 5: Session (Receiver)
📦Packet
↗ fromTransport_Rx
↘ toSession_Rx
📄 payloadData (TCP stripped)
🔌 protocolTCP → Session
Receiver L3 → Segment
Receiver L4 (Transport) → Segment: port=80 matched, seq reordered, ACK sent → Data
All 7 receiver layers processed. HTTP GET delivered to application. Full encapsulation/decapsulation cycle complete.
Hop: 11
Layer 4: Transport (Receiver)
Layer 5: Session (Receiver)
Layer 6: Presentation (Receiver)
Layer 7: Application (Receiver)
📦Packet
↗ fromPres_Rx
↘ toApp_Rx
📄 payloadData (HTTP GET request)
🔌 protocolHTTP
SENDER: L7→Data | L6→Data | L5→Data | L4→Segment | L3→Packet | L2→Frame | L1→Bits
RECEIVER: L1→Bits | L2→Frame→Packet | L3→Packet→Segment | L4→Segment→Data
L5→Data (session) | L6→Data (decrypt) | L7 (App) → HTTP GET received by web server

Key Takeaways

✓ Encapsulation (sender): each layer adds its header going DOWN - Data→Segment→Packet→Frame→Bits.

Mnemonic bottom-up: Please Do Not Throw Sausage Pizza Away (Physical, Data Link, Network, Transport, Session, Presentation, Application).

✓ Decapsulation (receiver): each layer removes its header going UP - Bits→Frame→Packet→Segment→Data.

The receiver is a mirror of the sender. Every header added on one side is removed on the other.

✓ PDUs by layer: Bits (L1), Frame (L2), Packet (L3), Segment (L4), Data (L5-L7).

In interviews, if asked 'what PDU at Layer X', recall: 1=Bits, 2=Frame, 3=Packet, 4=Segment, 5-7=Data.

Practice

(1/5)
1. You need to design a RESTful API endpoint that retrieves user profile information without modifying any server data. Which HTTP method should you use to ensure the operation is safe and does not change server state?
easy
A. GET
B. POST
C. PUT
D. DELETE

Solution

  1. Step 1: Understand the safety property of HTTP methods

    GET is defined as a safe method, meaning it does not modify server state and is used to retrieve data.
  2. Step 2: Analyze other methods

    POST, PUT, and DELETE modify server state and are not safe methods.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    GET is the only safe method here, suitable for data retrieval without side effects.
Hint: GET = safe read, POST/PUT/DELETE = state change
Common Mistakes:
  • Confusing POST with GET as both can send data
  • Thinking PUT is safe because it replaces data
  • Assuming DELETE can be used to retrieve data
2. Which of the following statements about IPv6 headers is INCORRECT?
medium
A. IPv6 headers have a fixed length of 40 bytes, simplifying processing
B. IPv6 headers include a checksum field to ensure header integrity
C. IPv6 removes the header checksum present in IPv4 to reduce processing overhead
D. IPv6 headers support extension headers to add optional information

Solution

  1. Step 1: Recall IPv6 header structure

    IPv6 headers have fixed length and no checksum field.
  2. Step 2: Analyze options

    IPv6 headers have a fixed length of 40 bytes, simplifying processing is correct; IPv6 headers are fixed at 40 bytes. IPv6 headers include a checksum field to ensure header integrity is incorrect; IPv6 does not have a checksum field. IPv6 removes the header checksum present in IPv4 to reduce processing overhead is correct; checksum was removed to speed up processing. IPv6 headers support extension headers to add optional information is correct; extension headers provide optional info.
  3. Final Answer:

    Option B -> Option B
  4. Quick Check:

    IPv6 relies on upper-layer checksums, not header checksum.
Hint: IPv6 headers have no checksum field [OK]
Common Mistakes:
  • Assuming IPv6 headers have checksums like IPv4
  • Confusing extension headers with fixed header fields
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. If a company wants to improve both security and performance for a public-facing web application, which combined deployment of firewall, proxy, and reverse proxy is most effective?
hard
A. Deploy a proxy server between backend servers and clients without a firewall
B. Use only a reverse proxy to handle all security filtering and caching
C. Rely solely on a firewall to filter traffic and improve performance
D. Deploy a firewall at the network edge, a forward proxy for client requests, and a reverse proxy in front of backend servers

Solution

  1. Step 1: Firewall role

    Firewall at network edge filters unauthorized traffic, providing security.
  2. Step 2: Forward proxy role

    Forward proxy manages client requests, can enforce policies and cache content.
  3. Step 3: Reverse proxy role

    Reverse proxy protects backend servers, performs load balancing, SSL termination, and caching.
  4. Step 4: Evaluate other options

    Only reverse proxy (B) or only firewall (C) miss layered defense and performance optimization; no firewall (A) reduces security.
  5. Final Answer:

    Option D -> Option D
  6. Quick Check:

    Combined deployment leverages strengths of all components [OK]
Hint: Layered defense: firewall + proxies for security and performance.
Common Mistakes:
  • Assuming one component can handle all roles
  • Ignoring the need for firewall in security
5. If a load balancer using IP Hash algorithm encounters clients behind a NAT (Network Address Translation) device, what is a potential challenge and how can it be mitigated?
hard
A. Clients behind NAT have different IPs, causing inconsistent routing; mitigation is to disable IP Hash and use Round Robin
B. Multiple clients share the same public IP, causing all their requests to be routed to the same server; mitigation involves using additional session identifiers beyond IP
C. NAT devices block IP Hash algorithms; mitigation is to switch to Least Connections
D. IP Hash cannot detect unhealthy servers behind NAT; mitigation is to increase health check frequency

Solution

  1. Step 1: Understand NAT impact on IP Hash

    NAT causes multiple clients to share a single public IP address.
  2. Step 2: Effect on IP Hash routing

    Since IP Hash uses client IP, all clients behind the same NAT get routed to the same backend server, potentially causing load imbalance.
  3. Step 3: Mitigation strategies

    Using additional session identifiers (cookies, tokens) can differentiate clients beyond IP, improving distribution.
  4. Step 4: Why other options are incorrect

    Clients behind NAT have different IPs, causing inconsistent routing; mitigation is to disable IP Hash and use Round Robin incorrectly states clients behind NAT have different IPs; they share one. NAT devices block IP Hash algorithms; mitigation is to switch to Least Connections falsely claims NAT blocks IP Hash. IP Hash cannot detect unhealthy servers behind NAT; mitigation is to increase health check frequency confuses health checks with NAT issues.
  5. Final Answer:

    Option B -> Option B
  6. Quick Check:

    NAT causes IP Hash collisions; use extra session info to mitigate.
Hint: NAT causes IP Hash collisions; add session IDs
Common Mistakes:
  • Assuming IP Hash works perfectly behind NAT
  • Thinking NAT changes client IPs individually
  • Confusing NAT issues with health check problems
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