Tutorials Logic, IN info@tutorialslogic.com

OSI Model All 7 Layers

What is the OSI Model?

The OSI (Open Systems Interconnection) model separates network communication into seven conceptual layers with distinct responsibilities. Use it to trace encapsulation, compare protocol roles, place network devices, and isolate a failure without treating the layers as literal software modules.

Mnemonic to remember layers (top to bottom): "All People Seem To Need Data Processing" (Application, Presentation, Session, Transport, Network, Data Link, Physical)

The 7 Layers of OSI Model

# Layer PDU Key Functions Protocols/Examples
7 Application Data User interface, network services to applications, email, file transfer HTTP, HTTPS, FTP, SMTP, DNS, DHCP, SSH, Telnet
6 Presentation Data Data translation, encryption/decryption, compression, format conversion SSL/TLS, JPEG, MPEG, ASCII, EBCDIC, GIF
5 Session Data Establishes, manages, and terminates sessions between applications NetBIOS, RPC, PPTP, SQL sessions
4 Transport Segment End-to-end communication, segmentation, flow control, error recovery, port numbers TCP, UDP, SCTP
3 Network Packet Logical addressing (IP), routing, path determination, fragmentation IP (IPv4/IPv6), ICMP, OSPF, BGP, RIP, ARP
2 Data Link Frame Physical addressing (MAC), error detection (CRC), flow control, access control Ethernet, Wi-Fi (802.11), PPP, HDLC, ARP
1 Physical Bit Transmission of raw bits over physical medium, voltage levels, cable types, connectors Ethernet cables, fiber optic, Wi-Fi radio, USB, Bluetooth

Layer Details

Layer 7 - Application Layer: The topmost layer that provides network services directly to end-user applications. It defines protocols for specific applications like web browsing (HTTP), email (SMTP), and file transfer (FTP). This is the layer users interact with.

Layer 6 - Presentation Layer: Responsible for data translation between the application and network formats. It handles encryption/decryption (SSL/TLS), data compression, and character encoding (ASCII to EBCDIC). Ensures data is in a readable format for the application layer.

Layer 5 - Session Layer: Manages sessions (connections) between applications. It establishes, maintains, and terminates communication sessions. Provides checkpointing and recovery for long data transfers.

Layer 4 - Transport Layer: Provides reliable end-to-end data transfer. TCP provides connection-oriented, reliable delivery with flow control and error recovery. UDP provides connectionless, faster but unreliable delivery. Uses port numbers to identify applications.

Layer 3 - Network Layer: Handles logical addressing (IP addresses) and routing. Determines the best path for data to travel from source to destination across multiple networks. Routers operate at this layer.

Layer 2 - Data Link Layer: Provides node-to-node data transfer between directly connected nodes. Uses MAC addresses for physical addressing. Detects and corrects errors from the physical layer. Switches and bridges operate at this layer.

Layer 1 - Physical Layer: Transmits raw bits over a physical medium. Defines electrical, mechanical, and procedural specifications for activating, maintaining, and deactivating physical connections. Hubs and repeaters operate at this layer.

Data Encapsulation Process

As data travels down the OSI layers from sender to receiver, each layer adds its own header (and sometimes trailer) - this is called encapsulation. At the receiver, each layer removes its header - this is called decapsulation.

Layer PDU Name What's Added Example
Application Data HTTP request message GET /index.html HTTP/1.1
Transport Segment TCP header (ports, seq numbers) Source: 8080, Dest: 80
Network Packet IP header (addresses, TTL) Source: 192.168.1.100, Dest: 93.184.216.34
Data Link Frame MAC header + CRC trailer Source: 00:1A:2B:3C:4D:5E
Physical Bits Electrical/optical signals 10110101 voltage levels
  • Application data -> Transport adds TCP/UDP header -> becomes Segment
  • Segment -> Network adds IP header -> becomes Packet
  • Packet -> Data Link adds MAC header + trailer -> becomes Frame
  • Frame -> Physical converts to Bits for transmission

OSI Model vs TCP/IP Model

While the OSI model is a theoretical framework, the TCP/IP model is the practical implementation used in modern networks. Here's how they compare:

OSI Layers TCP/IP Layers Key Differences Real-world Implementation
Application, Presentation, Session Application TCP/IP combines top 3 layers HTTP, FTP, SMTP, DNS
Transport Transport Same functionality TCP, UDP
Network Internet Same functionality IP, ICMP, ARP
Data Link, Physical Network Access TCP/IP combines bottom 2 layers Ethernet, Wi-Fi, PPP

Layer Communication Methods

Layers communicate with adjacent layers through service access points (SAPs) and service data units (SDUs):

Layers use four types of service primitives to communicate:

  • Vertical Communication: Each layer only communicates with the layer directly above and below it
  • Horizontal Communication: Peer layers on different machines communicate using protocols
  • Service Access Points (SAPs): Defined interfaces where layers exchange information
  • Protocol Data Units (PDUs): Data units exchanged between peer layers
  • Request: Layer requests service from layer below
  • Indication: Layer informs layer above of incoming request
  • Response: Layer responds to request from layer above
  • Confirm: Layer confirms completion of service request

Device and Protocol Mapping

Different network devices operate at specific OSI layers:

Device OSI Layer(s) Function Examples
Hub Layer 1 Repeats electrical signals Passive hub, active hub
Repeater Layer 1 Regenerates and retransmits signals Signal repeater, extender
Switch Layer 2 Filters and forwards frames based on MAC addresses Managed switch, unmanaged switch
Bridge Layer 2 Connects and filters traffic between network segments Network bridge, wireless bridge
Router Layer 3 Routes packets between different networks Home router, enterprise router
Gateway Layers 4-7 Translates between different protocol architectures Email gateway, application gateway
Firewall Layers 3-7 Filters traffic based on security rules Packet filter, application firewall

OSI Model Benefits and Limitations

  • Standardization: Provides a common framework for network vendors
  • Learning Tool: Helps understand complex networking concepts
  • Troubleshooting: Layered approach simplifies problem isolation
  • Protocol Design: Guides development of network protocols
  • Interoperability: Ensures different systems can communicate
  • Theoretical Nature: Not strictly implemented in real-world protocols
  • Complexity: Some layers have overlapping responsibilities
  • Session Layer: Rarely implemented as separate layer in modern protocols
  • Presentation Layer: Often handled by applications directly
  • Performance Overhead: Strict layering can impact performance

OSI Model in Troubleshooting

The OSI model provides a systematic approach to network troubleshooting by examining each layer:

Layer Common Issues Troubleshooting Tools Solutions
Physical Cable faults, loose connections, power issues Cable tester, multimeter, visual inspection Replace cables, secure connections
Data Link MAC address conflicts, switch port issues ARP table, switch logs, packet capture Clear ARP cache, restart switch
Network IP addressing, routing problems Ping, traceroute, route tables Fix IP config, add routes
Transport Port blocking, connection issues Netstat, telnet, port scanner Open ports, check firewall
Session Session timeouts, authentication failures Application logs, session tracking Extend timeout, check credentials
Presentation Encryption issues, data format problems SSL/TLS tools, character encoding check Update certificates, fix encoding
Application Software bugs, configuration errors Application logs, debugging tools Patch software, fix config

OSI Model Mnemonics and Memory Aids

Several mnemonics help remember the OSI layers from top to bottom (7 to 1) or bottom to top (1 to 7):

  • All People Seem To Need Data Processing (Application, Presentation, Session, Transport, Network, Data Link, Physical)
  • Please Do Not Throw Sausage Pizza Away (Physical, Data Link, Network, Transport, Session, Presentation, Application)
  • All Programmers Seem To Need Donuts (Application, Presentation, Session, Transport, Network, Data Link, Physical)
  • People Don't Need To See Paul Allen (Physical, Data Link, Network, Transport, Session, Presentation, Application)

Real-World Protocol Examples by Layer

Understanding how actual protocols map to OSI layers helps in practical network design:

Layer Protocol Purpose Key Features
Application HTTP/HTTPS Web browsing Request/response, stateless, secure (HTTPS)
FTP/SFTP File transfer Binary/ASCII transfer, secure (SFTP)
SMTP/POP3/IMAP Email Send/receive email, mailbox management
Transport TCP Reliable data transfer Connection-oriented, flow control, error recovery
UDP Fast data transfer Connectionless, low overhead, no guarantees
Network IPv4/IPv6 Logical addressing Routing, fragmentation, address resolution
ICMP Error reporting Ping, traceroute, error messages
Data Link Ethernet LAN communication CSMA/CD, MAC addressing, frame structure
Wi-Fi (802.11) Wireless LAN Radio transmission, encryption, roaming

OSI packet-flow walkthrough

OSI packet-flow walkthrough
Client device
  -> local network interface
  -> default gateway or switch
  -> routing/security decision
  -> destination service

For OSI, explain each hop by naming the address, protocol, port, and decision made at that layer.

Encapsulate an HTTPS Request Through the OSI Layers

Encapsulate an HTTPS Request Through the OSI Layers
Layer 7: HTTP GET /courses
Layer 6: TLS records encode and encrypt application bytes
Layer 5: the TLS session resumes or negotiates state
Layer 4: TCP adds ports, sequence numbers, and acknowledgements
Layer 3: IP adds source and destination addresses
Layer 2: Ethernet or Wi-Fi adds local-hop addressing and error detection
Layer 1: signals carry the resulting bits

Troubleshooting moves up or down this stack depending on where evidence first stops matching expectations.

Before you move on

OSI Model All 7 Layers Mastery Check

4 checks
  • I can map a protocol, device, or failure symptom to the OSI layer whose responsibility best explains it.
  • It divides network communication into 7 layers, each with specific responsibilities.
  • The model helps understand how data travels from one computer to another across a network.
  • Layer 7 - Application Layer: The topmost layer that provides network services directly to end-user applications.

Networking Questions Learners Ask

Start at the lowest likely layer and move upward. No link light suggests physical trouble.

Real protocol stacks do not always map perfectly to one OSI layer. HTTP is an application protocol, TCP provides transport, and IP provides network delivery. TLS sits between the application and transport behavior, providing encryption and authentication.

Each layer needs metadata for its responsibility. HTTP describes the request, TCP identifies ports and sequence state, IP identifies routed endpoints, and Ethernet identifies local-link delivery. The receiver removes and interprets these headers in reverse order.

Browse Free Tutorials

Explore 500+ free tutorials across 20+ languages and frameworks.