Skip to content

Osi Model And Layer Functions

Category: Network Fundamentals
Type: Network Concepts
Generated on: 2025-07-11 01:32:19
For: Network Engineering, Administration & Technical Interviews


OSI Model Cheatsheet: Your Network Layered Guide

Section titled “OSI Model Cheatsheet: Your Network Layered Guide”

What is the OSI Model?

The Open Systems Interconnection (OSI) model is a conceptual framework that standardizes the functions of a telecommunication or computing system into seven abstraction layers. It defines how data is transmitted between different computer systems over a network.

Why is it Important?

  • Standardization: Provides a common language for network professionals and vendors.

  • Troubleshooting: Helps isolate network problems by focusing on specific layers.

  • Interoperability: Enables devices from different manufacturers to communicate.

  • Understanding: Provides a framework for understanding network protocols and technologies.

  • Design: Facilitates the design and implementation of network solutions.

  • Layering: Dividing network communication into distinct layers with specific functions.

  • Protocol: A set of rules governing data communication between devices.

  • Peer-to-Peer Communication: Each layer communicates with its corresponding layer on the other device.

  • Encapsulation: Adding header and trailer information to data as it moves down the OSI model.

  • De-encapsulation: Removing header and trailer information as data moves up the OSI model.

  • Protocol Data Unit (PDU): The data unit at each layer (e.g., segment, packet, frame).

  • Service Access Point (SAP): A point where a layer provides services to the layer above it.

  • Interface: The boundary between layers, defining how they interact.

Mnemonic: “Please Do Not Throw Sausage Pizza Away” (Physical, Data Link, Network, Transport, Session, Presentation, Application) or “All People Seem To Need Data Processing” (Application, Presentation, Session, Transport, Network, Data Link, Physical)

Data Flow (Simplified):

+----------------+ +----------------+
| Application | -----> | Application |
+----------------+ +----------------+
| Presentation | -----> | Presentation |
+----------------+ +----------------+
| Session | -----> | Session |
+----------------+ +----------------+
| Transport | -----> | Transport |
+----------------+ +----------------+
| Network | -----> | Network |
+----------------+ +----------------+
| Data Link | -----> | Data Link |
+----------------+ +----------------+
| Physical | -----> | Physical |
+----------------+ +----------------+
Sender ---------> Receiver

Encapsulation Process:

  1. Application Layer: Data is created.
  2. Presentation Layer: Data is formatted and encrypted (if needed).
  3. Session Layer: A connection is established and managed.
  4. Transport Layer: Data is segmented and reliable delivery is ensured (TCP) or best effort (UDP). A header is added containing port numbers.
  5. Network Layer: Source and destination IP addresses are added to form a packet.
  6. Data Link Layer: MAC addresses and error detection information are added to form a frame.
  7. Physical Layer: Data is converted into electrical signals for transmission.

De-encapsulation Process:

The receiver reverses the encapsulation process, stripping off headers and trailers at each layer until it reaches the Application Layer.

Visual Representation of Encapsulation:

Application Data
+-------------------+
| Application Data |
+-------------------+
Presentation Header
+-------------------+
| Presentation Header| Application Data |
+-------------------+
Session Header
+-------------------+
| Session Header | Presentation Header| Application Data |
+-------------------+
Transport Header
+-------------------+
| Transport Header | Session Header | Presentation Header| Application Data |
+-------------------+
Network Header
+-------------------+
| Network Header | Transport Header | Session Header | Presentation Header| Application Data |
+-------------------+
Data Link Header
+-------------------+
| Data Link Header | Network Header | Transport Header | Session Header | Presentation Header| Application Data | Data Link Trailer
+-------------------+
Physical Layer (Bits)
LayerNameFunctionExample ProtocolsPDU
7. ApplicationApplicationProvides network services to applications. User interface, network access.HTTP, SMTP, DNS, FTP, SSH, SNMP, TelnetData
6. PresentationPresentationData representation, encryption, and decryption. Data formatting and translation.SSL/TLS, MIME, JPEG, MPEGData
5. SessionSessionEstablishes, manages, and terminates connections between applications. Authentication, authorization, and session restoration.NetBIOS, TLS Session resumptionData
4. TransportTransportProvides reliable or unreliable data transfer between applications. Segmentation, flow control, error control.TCP, UDP, SCTPSegment
3. NetworkNetworkRouting packets between networks. Logical addressing (IP addresses).IP (IPv4, IPv6), ICMP, ARP, Routing Protocols (OSPF, BGP)Packet
2. Data LinkData LinkProvides error-free transmission of data frames between directly connected nodes. Physical addressing (MAC addresses).Ethernet, Wi-Fi (802.11), PPP, Frame Relay, ATMFrame
1. PhysicalPhysicalTransmits raw bits over a physical medium. Voltage levels, cable specifications, data rates.Ethernet Cable, Fiber Optic Cable, Wireless Radio FrequencyBits

Example: TCP Header (Simplified)

+-------------------+-------------------+-------------------+-------------------+
| Source Port | Destination Port | Sequence Number |
+-------------------+-------------------+-------------------+-------------------+
| Acknowledgment Number |
+-------------------+-------------------+-------------------+-------------------+
| Data Offset | Reserved|Flags| Window Size |
+-------------------+-------------------+-------------------+-------------------+
| Checksum | Urgent Pointer | Options (Padding) |
+-------------------+-------------------+-------------------+-------------------+
| Data |
+----------------------------------------------------------------------------------------+

Common TCP Flags:

  • SYN: Synchronize (Initiate a connection)
  • ACK: Acknowledgment (Confirms receipt of data)
  • FIN: Finish (Terminate a connection)
  • RST: Reset (Abruptly terminate a connection)
  • PSH: Push (Data should be delivered to the application immediately)
  • URG: Urgent (Indicates urgent data)

Example: IP Header (Simplified)

+-------------------+-------------------+-------------------+-------------------+
| Version | IHL |Type of Service| Total Length |
+-------------------+-------------------+-------------------+-------------------+
| Identification |Flags| Fragment Offset |
+-------------------+-------------------+-------------------+-------------------+
| Time to Live | Protocol | Header Checksum |
+-------------------+-------------------+-------------------+-------------------+
| Source IP Address |
+-------------------+-------------------+-------------------+-------------------+
| Destination IP Address |
+-------------------+-------------------+-------------------+-------------------+
| Options (Padding) |
+----------------------------------------------------------------------------------------+
| Data |
+----------------------------------------------------------------------------------------+
  • Web Browsing (HTTP):

    1. Application Layer: User types a URL in a web browser.
    2. Presentation Layer: Data is formatted and possibly encrypted (HTTPS).
    3. Session Layer: A session is established with the web server.
    4. Transport Layer: TCP segments the data and ensures reliable delivery.
    5. Network Layer: IP packets are routed to the web server.
    6. Data Link Layer: Ethernet frames are transmitted over the local network.
    7. Physical Layer: Electrical signals are sent over the network cable.
  • Email (SMTP):

    1. Application Layer: Email client composes and sends an email.
    2. Presentation Layer: Data is formatted (e.g., MIME).
    3. Session Layer: A session is established with the SMTP server.
    4. Transport Layer: TCP segments the email data.
    5. Network Layer: IP packets are routed to the SMTP server.
    6. Data Link Layer: Frames are transmitted over the network.
    7. Physical Layer: Electrical signals are sent over the network cable.
  • File Transfer (FTP): Uses separate TCP connections for control (port 21) and data transfer (port 20). Demonstrates the use of multiple sessions on the same application.

  • Video Streaming: Uses UDP (typically) for real-time streaming to minimize latency, sacrificing reliability. Error correction is often handled at the application layer.

  • Physical Layer: Cable problems, faulty network cards, signal interference.

    • Troubleshooting: Check cables, replace network cards, move away from sources of interference. Use tools like a cable tester.
  • Data Link Layer: MAC address conflicts, incorrect VLAN configuration.

    • Troubleshooting: Check MAC address assignments, verify VLAN configuration. Use arp -a to view ARP table.
  • Network Layer: Incorrect IP addressing, routing problems, firewall blocking.

    • Troubleshooting: Verify IP addresses, check routing tables, examine firewall rules. Use ping, traceroute/tracert, ipconfig/ifconfig.
  • Transport Layer: Port conflicts, firewall blocking ports, TCP connection issues.

    • Troubleshooting: Check port assignments, verify firewall rules, analyze TCP connections. Use netstat, tcpdump/Wireshark.
  • Application Layer: Application errors, incorrect configuration.

    • Troubleshooting: Check application logs, verify application configuration.

Example: Troubleshooting Network Connectivity (using ping and traceroute)

  1. Problem: Cannot access a website.
  2. Step 1: Ping the website’s IP address: ping 8.8.8.8 (Google’s public DNS server).
    • If successful, the problem might be DNS-related (Application Layer issue).
    • If unsuccessful, proceed to Step 2.
  3. Step 2: Ping the default gateway: ping 192.168.1.1 (Typical home router address).
    • If successful, the problem is likely outside your local network (Network Layer issue).
    • If unsuccessful, the problem is within your local network (Data Link or Physical Layer issue).
  4. Step 3: Use Traceroute/Tracert: traceroute 8.8.8.8 (Linux/macOS) or tracert 8.8.8.8 (Windows). This command shows the path your packets take to reach the destination, identifying where the connection breaks down.
  • Setting a Static IP Address (Linux):
Terminal window
sudo nano /etc/network/interfaces
# Add the following lines:
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
sudo ifdown eth0 && sudo ifup eth0
  • Setting a Static IP Address (Windows):

    1. Open “Network and Sharing Center.”
    2. Click on “Ethernet” or “Wi-Fi.”
    3. Click “Properties.”
    4. Select “Internet Protocol Version 4 (TCP/IPv4)” and click “Properties.”
    5. Select “Use the following IP address” and enter the desired IP address, subnet mask, default gateway, and DNS server addresses.
  • Configuring a Router (Cisco IOS):

enable
configure terminal
interface GigabitEthernet0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
ip route 0.0.0.0 0.0.0.0 192.168.10.1 (Default route to the internet)
end
write memory
  • Firewall Rules (iptables - Linux):
Terminal window
# Allow SSH traffic
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Block all other incoming traffic
sudo iptables -A INPUT -j DROP
  • “Explain the OSI model and its seven layers.”

    • Answer: “The OSI model is a conceptual framework for understanding network communication. It divides the process into seven layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application. Each layer has specific responsibilities, and they work together to ensure data is transmitted reliably and efficiently.” (Then briefly describe each layer’s function)
  • “What is the difference between TCP and UDP, and where would you use each?”

    • Answer: “TCP is a connection-oriented protocol that provides reliable data transfer with error checking and flow control. UDP is a connectionless protocol that offers faster but less reliable data transfer. TCP is suitable for applications requiring guaranteed delivery, such as web browsing, email, and file transfer. UDP is suitable for applications where speed is more important than reliability, such as video streaming, online gaming, and DNS lookups.”
  • “What is the purpose of the Network Layer?”

    • Answer: “The Network Layer is responsible for routing packets between networks. It uses logical addressing (IP addresses) to identify devices and determine the best path for data to travel. Key functions include IP addressing, routing, and packet fragmentation/reassembly.”
  • “Explain the process of encapsulation and de-encapsulation.”

    • Answer: “Encapsulation is the process of adding header and trailer information to data as it moves down the OSI model. Each layer adds its own header containing control information. De-encapsulation is the reverse process, where the receiver removes the headers and trailers at each layer until it reaches the original data.”
  • “How would you troubleshoot a network connectivity issue?”

    • Answer: “I would start by checking the Physical Layer (cables, network card). Then, I would use ping to test connectivity to different devices (default gateway, DNS server, destination host). If ping fails, I would use traceroute/tracert to identify where the connection breaks down. I would also check IP addressing, routing tables, and firewall rules.”
  • “What is a MAC address, and how is it used?”

    • Answer: “A MAC (Media Access Control) address is a unique hardware address assigned to a network interface card (NIC). It is used by the Data Link Layer to identify devices on the same network segment. MAC addresses are used for local network communication, while IP addresses are used for routing across networks.”
  • “What are the common TCP flags, and what do they signify?”

    • Answer: “The common TCP flags are SYN, ACK, FIN, RST, PSH, and URG. SYN is used to initiate a connection, ACK acknowledges receipt of data, FIN terminates a connection, RST resets a connection, PSH indicates data should be delivered to the application immediately, and URG indicates urgent data.”
  • “Explain the difference between IPv4 and IPv6.”

    • Answer: “IPv4 uses 32-bit addresses, while IPv6 uses 128-bit addresses. IPv6 was developed to address the IPv4 address exhaustion problem. IPv6 also offers improvements in security, mobility, and auto-configuration.”
  • TCP/IP Model: A simplified model with four layers (Application, Transport, Internet, Network Access). Often used interchangeably with the OSI model in practice.

  • Network Topologies: Bus, Star, Ring, Mesh, Hybrid. How devices are physically connected.

  • Subnetting: Dividing a network into smaller subnets for better organization and security.

  • Routing Protocols: OSPF, BGP, RIP. How routers exchange routing information.

  • Network Security: Firewalls, Intrusion Detection Systems (IDS), Intrusion Prevention Systems (IPS).

  • Cloud Computing: Understanding how the OSI model applies to cloud-based networking.

  • Software-Defined Networking (SDN): How SDN decouples the control plane from the data plane, impacting how network functions are implemented.

Further Reading:

  • CompTIA Network+ Certification Study Guide
  • Cisco CCNA Certification Study Guide
  • RFCs (Request for Comments): The official documentation for Internet standards. Search for RFCs related to specific protocols (e.g., RFC 793 for TCP, RFC 791 for IP).
  • Wireshark Documentation: Learn how to use Wireshark for packet analysis.

This cheatsheet provides a solid foundation for understanding the OSI model and its practical applications in network administration, troubleshooting, and design. Remember to practice using network tools and analyzing network traffic to solidify your knowledge. Good luck!