Contents (11)
Why You Should Know the OSI 7 Layers
The OSI (Open Systems Interconnection) 7-layer model is the most fundamental framework for understanding network communication. It's not just theory: the routers, switches, and servers we use every day, along with cloud services like AWS and GCP, all run on top of this model.
If you understand the OSI model
When a network failure happens, you can figure out which layer the problem is in
When designing a cloud architecture, you can clearly understand the role of each component
When setting up security policies, you can tell which layer you need to defend at
In this post, we'll go through the OSI 7 layers step by step and also look at examples of which processing devices or cloud services are used at each layer.
OSI 7-Layer Overview
The OSI model is a standard model that divides the network communication process into seven logical layers. Each layer has a specific role, and the upper layers use the services of the lower layers. Of course, these days the 5-layer or 4-layer TCP/IP model is considered a better fit.
Layer | Name | Main Role | Related Keywords |
|---|---|---|---|
7 | Application Layer | Interacts directly with the user | HTTP, FTP, DNS |
6 | Presentation Layer | Data format conversion and encryption | SSL/TLS, JPEG, encoding |
5 | Session Layer | Connection session management | Session maintenance, synchronization |
4 | Transport Layer | Transmission control, guaranteed reliability | TCP, UDP, ports |
3 | Network Layer | Path selection, addressing | IP, routing |
2 | Data Link Layer | Frame transmission, error detection | MAC addresses, switches |
1 | Physical Layer | Electrical signals, physical connections | Cables, hubs, signals |
Detailed Look at Each Layer + Related Devices
Layer 1: Physical Layer
Role: Converts data into electrical signals, optical signals, or radio waves and transmits it over a physical medium.
Related devices:
Cables: Ethernet cables (Cat5, 6, 7), fiber optic cables
Hub: Copies an incoming signal as-is and sends it out to every port
Repeater: Amplifies weakened signals; no longer used now that fiber optic cables have become widespread.
Characteristics:
Deals only with bit streams of 0s and 1s
Has no idea what the data means
Only does the job of passing signals along
Layer 2: Data Link Layer
Role: Handles reliable data transfer between two directly connected nodes. It bundles data into frames and uses MAC addresses to identify the destination.
Related devices:
L2 Switch: Learns MAC addresses and sends data only to the matching port (smarter than a hub)
Bridge: Connects network segments (in old hub-based networks, its purpose was to narrow the broadcasting range)
NIC (Network Interface Card): Gives each device a unique MAC address
Key concepts:
MAC address: A 48-bit hardware address (e.g., 00:1A:2B:3C:4D:5E)
Frame: The unit that data is packaged into
Error detection: Checks for transmission errors using CRC (Cyclic Redundancy Check)
Example: When the switch in your home connects several devices (PC, TV, printer), it remembers each device's MAC address and sends data only to the intended device.
Layer 3: Network Layer
Role: Decides the path data takes between different networks. It uses IP addresses to identify the destination and picks the best route.
Related devices and concepts:
Router: Looks at a packet's IP address and sends it along the best route
L3 Switch: A switch with added routing capabilities
Firewall: Performs IP-based filtering
Key protocols:
IP (Internet Protocol): The addressing scheme (IPv4, IPv6)
ICMP: Used by the Ping command (connectivity testing)
Routing protocols: OSPF, BGP (exchanging route information)
Example:
Your home router translates private IPs (192.168.x.x) into a public IP (NAT)
Packets heading out to the internet pass through multiple routers before reaching their final destination
Layer 4: Transport Layer
Role: Guarantees reliable end-to-end data transfer. It tells applications apart by port number.
Key protocols:
TCP (Transmission Control Protocol):
Connection-oriented (3-way handshake)
Guaranteed reliability (retransmission, guaranteed ordering)
Flow control and congestion control
Use cases: web browsing (HTTP), email (SMTP), file transfer (FTP)
UDP (User Datagram Protocol):
Connectionless
Fast but unreliable
Use cases: real-time streaming, DNS, online games
Related concepts:
L4 switch (a load balancer that distributes traffic based on IP and port; more limited than an L7 switch)
# Nginx config, L4 switch (using the stream module)stream { upstream backend { server 192.168.0.101:1935; server 192.168.0.102:1935; } server { listen 1935; proxy_pass backend; }}# Nginx config, L7 switchhttp { upstream backend { server 192.168.0.101; server 192.168.0.102; } server { listen 80; server_name example.com; location /video/ { proxy_pass http://backend; } location /image/ { proxy_pass http://backend; } }}Related cloud services:
NLB(Network Load Balancer, AWS)
Example: When you watch Netflix, video files are downloaded reliably over TCP, while Zoom video calls prioritize real-time delivery with UDP.
Layer 5: Session Layer
Role: Establishes, maintains, and terminates connections (sessions) between applications. It handles dialog control and synchronization.
Key functions:
Establishing and releasing sessions
Setting checkpoints (remembering where things left off)
Synchronization (recovery points when an error occurs during data transfer)
Related protocols:
NetBIOS
RPC (Remote Procedure Call)
PPTP (used in VPNs)
Example: Keeping a login session alive in an app, or being able to resume a file download even if the connection drops partway through, is the session layer's job.
Layer 6: Presentation Layer
Role: Converts data formats and performs encryption/decryption and compression/decompression. It ensures data compatibility between different systems.
Key functions:
Encoding/decoding: Converting between ASCII, UTF-8, and EBCDIC
Encryption/decryption: SSL/TLS (this is where the S in HTTPS comes from)
Compression: JPEG, MPEG, GIF
Data representation conversion: JSON, XML, HTML
Example:
Encrypting data with SSL/TLS when you visit a website over HTTPS
Compressing an image as JPEG before sending it
Converting Korean text encoding (EUC-KR) to UTF-8
Layer 7: Application Layer
Role: The layer that interacts directly with the user. The protocols that real applications use belong here.
Key protocols:
HTTP/HTTPS: Web browsing
FTP: File transfer
SMTP/POP3/IMAP: Email
DNS: Translates domain names into IP addresses
SSH: Remote server access
Related devices:
L7 switch (a load balancer that distributes traffic based on IP, port, HTTP headers, cookies, health checks, and more)
Related cloud services:
ALB(Application Load Balancer, AWS)
Related services:
Web browsers (Chrome, Firefox)
Email clients (Outlook, Gmail)
FTP clients (FileZilla)
API gateways
Example:
When you type "google.com" into the browser's address bar, DNS translates it into an IP
The browser talks to Google's servers over the HTTP protocol
The webpage gets rendered on the screen
Wrapping Up
With the OSI 7-layer model, we now know in more detail what role each layer plays. Even when you actually build a network with cloud services, you should keep this 7-layer model in mind and think carefully about what to apply at which layer and what effect it will have. For example, it can be an important basis for deciding which layer is the right place to block an incoming DDoS attack.
