← Back to Networking

OSI 7-Layer Model

Understanding network communication through the Open Systems Interconnection model

OSI 7-Layer Model Diagram

OSI Model Overview

The OSI (Open Systems Interconnection) model is a conceptual framework that standardizes the functions of a telecommunication or computing system into seven abstraction layers. Each layer serves the layer above it and is served by the layer below it.

This model helps in understanding how data flows through a network, from the application layer where users interact, down to the physical layer where electrical signals are transmitted, and back up through the layers on the receiving end.

7

Application Layer

Provides network services directly to user applications. This is where users interact with network services.

Protocols: HTTP, HTTPS, FTP, SMTP, DNS
6

Presentation Layer

Handles data translation, encryption, and compression. Ensures data is in a format the application can understand.

Protocols: SSL/TLS, JPEG, MPEG, ASCII
5

Session Layer

Manages sessions between applications. Establishes, maintains, and terminates connections.

Protocols: NetBIOS, RPC, SQL
4

Transport Layer

Provides reliable data transfer between hosts. Handles error detection, flow control, and segmentation.

Protocols: TCP, UDP
3

Network Layer

Routes data packets between different networks. Handles logical addressing and routing decisions.

Protocols: IP, ICMP, ARP, OSPF
2

Data Link Layer

Provides error-free transfer of data frames between nodes on the same network segment.

Protocols: Ethernet, Wi-Fi, PPP
1

Physical Layer

Transmits raw bits over a physical medium. Defines electrical, mechanical, and procedural specifications.

Protocols: Ethernet cables, Wi-Fi radio waves

Data Flow Process

1
Data starts at the Application Layer (Layer 7) when a user sends a request
2
Each layer adds its own header (encapsulation) as data moves down
3
Data reaches the Physical Layer (Layer 1) and is transmitted as electrical signals
4
On the receiving end, data moves up through the layers (decapsulation)
5
Each layer removes its header and processes the data accordingly
6
Data reaches the Application Layer on the receiving end

Interview Questions

Fundamental Concepts

  • Explain the difference between TCP and UDP
  • What's the purpose of port numbers?
  • How does ARP work?
  • What's the difference between a switch and a router?

Layer-Specific Questions

  • What happens at the Transport Layer?
  • How does the Network Layer handle routing?
  • What's the role of the Data Link Layer?
  • Explain the difference between HTTP and HTTPS

Troubleshooting Scenarios

  • A user can't connect to the server, which layers would you check?
  • How do you debug network connectivity issues?
  • What happens when a packet is lost at the Network Layer?
  • How would you troubleshoot slow network performance?