Vaidikalaya

OSI Model


The OSI Model is a conceptual framework that explains how different computer systems communicate over a network. It was developed by ISO (International Organization for Standardization). The OSI model divides the communication process into 7 layers, where each layer performs a specific function and interacts with the layers directly above and below it.

Purpose of the OSI Model
  • Helps understand and troubleshoot network problems
  • Provides standard rules for network communication
  • Makes different devices and systems interoperable
  • Divides complex networking into simpler steps

Layers of the OSI Model

There are 7 layers in the OSI Model and each layer has its specific role in handling data. All the layers are mentioned below:

  1. Physical Layer
  2. Data Link Layer
  3. Network Layer
  4. Transport Layer
  5. Session Layer
  6. Presentation Layer
  7. Application Layer

1. Physical Layer

The Physical Layer is the first and lowest layer of the OSI model. It is responsible for establishing the physical connection between devices. This layer transmits data in the form of raw bits (0s and 1s) from one device to another over a physical medium.

  • Physical Layer is responsible for transmitting individual bits from one node to the next.
  • When receiving data, this layer will get the signal received and convert it into 0s and 1s and send them to the Data Link layer, which will put the frame back together.
  • Common physical layer devices are Hub, Repeater, Modem, and Cables.
Functions of the Physical Layer
  • Bit Synchronization: The physical layer provides the synchronization of the bits by providing a clock. This clock controls both sender and receiver thus providing synchronization at the bit level.
  • Bit Rate Control: The Physical layer also defines the transmission rate i.e. the number of bits sent per second.
  • Physical Topologies: Physical layer specifies how the different, devices/nodes are arranged in a network i.e. bus topology, star topology, or mesh topology.
  • Transmission Mode: Physical layer also defines how the data flows between the two connected devices. The various transmission modes possible are Simplex, half-duplex and full duplex.
Protocols of the Physical Layer

Typically, a combination of hardware and software programming makes up the physical layer. It consists of several protocols that control data transmissions on a network. The following are some examples of Layer 1 protocols:

  • Ethernet (IEEE 802.3): Widely used for wired networks.
  • Wi-Fi (IEEE 802.11): For wireless communication.
  • Bluetooth (IEEE 802.15.1): Short-range wireless communication.
  • USB (Universal Serial Bus): For connecting devices over short distances.
Advantages
  • It ensures devices can transmit and receive raw data over physical mediums.
  • It provides universal standards for cables, connectors, and signaling, ensuring compatibility.
  • Allows multiple types of media like Works with wired (e.g., Ethernet) and wireless (e.g., Wi-Fi) technologies.
  • Foundation for all higher layers
Disadvantages
  • No Error Handling: Cannot detect or correct errors in data transmission.
  • Susceptible to Physical Damage: Cables, connectors, and hardware failures can disrupt communication.
  • No Data Interpretation: It only transmits bits and doesn't understand or process the actual data.

2. Data Link Layer

The Data Link Layer is the second layer of the OSI model. It is responsible for the node-to-node delivery of the message. The main function of this layer is to make sure data transfer is error-free from one node to another, over the physical layer. It organizes the physical layer’s raw bits into frames, handles error detection, flow control, and MAC addressing.

The Data Link Layer is responsible for error-free communication between two directly connected nodes. It performs framing, error detection, flow control, and uses MAC addresses to deliver frames within a LAN.

Sublayers of Data Link Layer

The DLL is divided into two sublayers:

1. LLC (Logical Link Control)
  • Identifies network layer protocols (IP, ARP)
  • Provides flow & error control
2. MAC (Media Access Control)
  • Uses MAC addresses
  • Controls access to transmission medium
  • Defines hardware addressing
Functions of the Data Link Layer
  • Framing: Breaks data into frames before transmission and reassembles them at the receiver.
  • Physical Addressing: After creating frames, the Data link layer adds physical addresses (MAC addresses) of the sender and/or receiver in the header of each frame.
  • Error Detection & Correction: The data link layer provides the mechanism of error control in which it detects and retransmits damaged or lost frames.
  • Flow Control: The data rate must be constant on both sides else the data may get corrupted thus, flow control coordinates the amount of data that can be sent before receiving an acknowledgment.
  • Access Control: When a single communication channel is shared by multiple devices, the MAC sub-layer of the data link layer helps to determine which device has control over the channel at a given time.
Protocols of the Data Link Layer (DLL)

The Data Link Layer uses several protocols to ensure error-free, reliable, and efficient communication between directly connected devices. These protocols handle framing, error detection, flow control, and MAC addressing. Below are the important DLL protocols commonly asked in exams:

Protocols Description
1. Ethernet (IEEE 802.3)Ethernet is a widely used LAN protocol that uses MAC addressing and CSMA/CD for media access.
2. PPP (Point-to-Point Protocol)PPP is a data link protocol used for direct communication between two nodes, providing authentication and error detection.
3. HDLC (High-Level Data Link Control)HDLC is a reliable, bit-oriented data link protocol used in WANs for point-to-point connections.
4. Wi-Fi (IEEE 802.11)Wi-Fi is a wireless LAN protocol that uses CSMA/CA for access control and defines wireless MAC layer communication.
5. Frame RelayFrame Relay is a high-speed WAN protocol that switches variable-length frames with minimal error control.
6. ATM (Asynchronous Transfer Mode)ATM is a high-speed switching protocol that uses fixed-size cells for efficient data transmission in WANs.
7. Token Ring (IEEE 802.5):Token Ring is a LAN protocol where a token circulates, and only the device holding the token can transmit data.
8. LAPB (Link Access Procedure – Balanced):LAPB is a reliable data link protocol used in X.25 networks, providing error correction and flow control.

3. Network Layer

The Network Layer is the 3rd layer of the OSI model. Its main job is to move data packets from the source to the destination across multiple networks (routing).

  • The sender and receiver's IP address are placed in the header by the network layer. Segment in the Network layer is referred to as Packet.
  • Network layer is implemented by networking devices such as routers and switches.
Functions of the Network Layer
  • Routing: The network layer protocols determine which route is suitable from source to destination. This function of the network layer is known as routing.
  • Logical Addressing (IP Addressing): Assigns IP addresses to identify devices uniquely on a network.
  • Packet Forwarding: Moves packets from one network to another using routers.
  • Packet Fragmentation & Reassembly: Breaks large packets into smaller ones based on network limits (MTU) and reassembles them at the destination.
Protocols of the Network Layer
  • IP (IPv4 / IPv6) – Main protocol for addressing & routing
  • ICMP – Error and diagnostic messages (ping)
  • ARP – Maps IP address → MAC address
  • RARP – Maps MAC address → IP address
  • OSPF, BGP, RIP – Routing protocols
Advantages of the Network Layer
  • Efficient Routing: Finds the best path for data packets, improving network communication speed and efficiency.
  • Logical Addressing (IP Addressing): Assigns unique IP addresses so devices can be identified across different networks.
  • Inter-network Communication: Enables communication between multiple networks (LAN ↔ WAN), not just inside one network.
  • Packet Switching: Breaks data into packets and routes them independently, improving flexibility and reliability.
  • Congestion Control & Traffic Management: Uses routing protocols and metrics to avoid overloaded paths.
  • Error Reporting: Protocols like ICMP help in diagnosing issues (e.g., unreachable hosts).
  • Fragmentation & Reassembly: Allows large packets to be split to fit network MTU limits.
Limitations of Network Layer
  • No Guarantee of Delivery: It uses a best-effort service (especially in IPv4). Packets can be lost, duplicated, or delivered out of order.
  • No Ensure of Data Security: Network layer does not provide encryption or authentication (unless IPv6 with IPsec is used).
  • Limited Error Correction: It reports errors (ICMP) but cannot fix or retransmit lost packets — Transport layer handles that.
  • Fragmentation Overhead: Fragmentation can slow down the network and cause packet drops.
  • Routing Complexity: Routing tables, dynamic updates, and path calculations increase processing load on routers.
  • IP Address Exhaustion (IPv4): IPv4 has limited addresses, requiring NAT and causing complexity (solved with IPv6).
  • Vulnerable to Attacks: IP spoofing, ICMP floods, and routing attacks can exploit weaknesses in Layer 3.

4. Transport Layer

The Transport Layer is the 4th layer of the OSI model. It provides end-to-end communication between applications on different hosts. It provides services to the application layer and takes services from the network layer. The data in the transport layer is referred to as Segments. It is responsible for the end-to-end delivery of the complete message. It acts as a bridge between the Application Layer and the lower layers.

  • The transport layer also provides the acknowledgment of the successful data transmission and re-transmits the data if an error is found.
  • Protocols used in Transport Layer are TCP, UDP NetBIOS, PPTP.
  • At the sender's side, the transport layer receives the formatted data from the upper layers, performs Segmentation, and also implements Flow and error control to ensure proper data transmission.
  • It also adds Source and Destination port number in its header and forwards the segmented data to the Network Layer.
  • Generally, this destination port number is configured, either by default or manually.
  • Example: when a web application requests a web server, it typically uses port number 80, because this is the default port assigned to web applications. Many applications have default ports assigned.
  • At the Receiver’s side, Transport Layer reads the port number from its header and forwards the Data which it has received to the respective application. It also performs sequencing and reassembling of the segmented data.
Functions of the Transport Layer
1. End-to-End Communication

Provides direct communication between sender and receiver processes. It ensures data reaches the correct application.

Example: Computer A → Port 80 → Computer B

2. Segmentation and Reassembly

Breaks large data from the application into smaller chunks called segments (TCP) or datagrams (UDP). Reassembles them at the receiver in the correct order.

3. Service Point Addressing

To deliver the message to the correct process, the transport layer header includes a type of address called service point address or port address. Thus, by specifying this address, the transport layer makes sure that the message is delivered to the correct process.

Protocols of the Transport Layer
TCP – Transmission Control Protocol

TCP is connection-oriented and reliable Protocol that means first the connection is established between two ends and then data is transferred and then the connection is terminated after all data being sent. It is used by HTTP, HTTPS, FTP, SSH, Email (SMTP/IMAP/POP)

Features:
  • 3-way handshake (SYN → SYN-ACK → ACK)
  • Reliable delivery
  • Ordered delivery
  • Congestion control
  • Flow control
  • Error control
TCP Header Contains:

Source Port, Destination Port, Sequence Number, Acknowledgment Number, Data Offset, Reserved Bits, Flags (SYN, ACK, FIN, RST, PSH, URG), Window Size, Checksum, Urgent Pointer

UDP – User Datagram Protocol

It is connectionless and fast protocol but not reliable protocol. When speed and size are more important than security and dependability, this kind of protocol is employed. It is used in Video streaming, VoIP, DNS, Gaming.

Features:
  • No handshake
  • No reliability
  • No guaranteed order
  • Very low overhead
  • Faster than TCP
UDP Header Contains:

Source Port, Destination Port, Length, Checksum

Advantages of Transport Layer
  • Ensures reliable communication (TCP)
  • Performs error detection and correction
  • Prevents congestion and overload
  • Supports multiple applications through port numbers
  • Manages ordered and complete data delivery
  • Ensures speed efficiency using flow control
Limitations of Transport Layer
  • UDP is unreliable
  • TCP introduces delay due to handshakes
  • Retransmissions reduce speed
  • Congestion control may slow down fast networks
  • Complex header (TCP) increases overhead
  • Not responsible for routing or addressing

5. Session Layer

The Session Layer manages and controls the sessions (connections) between two computers. It establishes, maintains, and terminates communication sessions. It also provides authentication and security. It works above the Transport Layer and below the Presentation Layer.

Functions of the Session Layer
  • Establishing Sessions: Creates a stable communication session between two devices or applications. Example: When you log into a website → session starts.
  • Maintaining Sessions: Keeps the session active while systems exchange data. Example:Video conferencing audio/video flows continuously → session stays alive.
  • Terminating Sessions: Closes the session gracefully when communication is finished. Example:You click "logout" → session ends.
  • Synchronization: This layer allows a process to add checkpoints that are considered synchronization points in the data. These synchronization points help to identify the error so that the data is re-synchronized properly, and ends of the messages are not cut prematurely, and data loss is avoided.
  • Dialog Controller: The session layer allows two systems to start communication with each other in half-duplex or full duplex.
  • Session Recovery: If a connection drops, the session layer can help resume communication instead of restarting.
Session Layer Protocols

Several protocols and technologies operate at the Session Layer:

  • AppleTalk Data Stream Protocol (ADSP): Developed by Apple for LAN communication with self-configuration support.
  • Real-time Transport Control Protocol (RTCP): Provides QoS feedback for RTP-based multimedia sessions.
  • Point-to-Point Tunneling Protocol (PPTP): Enables Virtual Private Networks (VPNs) over TCP/IP.
  • Password Authentication Protocol (PAP): Provides password-based user authentication in PPP connections.
  • Remote Procedure Call Protocol (RPCP): Allows a program to execute procedures in another address space (client-server interaction).
  • Sockets Direct Protocol (SDP): Supports socket communication over RDMA-enabled networks.
Examples of Session Layer
  • Logging into a remote server (SSH session)
  • Maintaining login session on a website
  • Video conferencing call session (Zoom, Teams)
  • Online banking session timeout after inactivity
  • Voice call signaling (SIP)
Advantages of Session Layer
  • Manages stable sessions between devices
  • Supports communication recovery using checkpoints
  • Prevents data repetition or loss
  • Controls dialogs (full/half duplex communication)
  • Improves reliability of long data transfers
Limitations of Session Layer
  • Added overhead because maintaining sessions uses extra resources
  • Session failures can break communication if not properly handled
  • Not many pure session layer protocols exist (often merged with layer 4 & 7)
  • Dependent on underlying transport layer reliability
  • Modern applications sometimes bypass it, making it less visible

6. Presentation Layer

Presentation Layer is the sixth layer of the OSI (Open Systems Interconnection) model. The main job of presentation layer is to translate, format, encrypt, compress, and prepare data so that applications can understand it. It acts as the “translator” between the application layer and the rest of the network.

Functions of the Presentation Layer
  • Translation (Data Format Conversion): Converts data between different formats so both sender and receiver understand it. Examples: ASCII ↔ EBCDIC,JPEG, PNG, MP4, JSON ↔ XML
  • Data Encryption & Decryption: Encrypts data before sending and decrypts it on arrival for security. Examples:HTTPS SSL/TLS encryption, VPN data encryption
  • Data Compression & Decompression: Reduces data size to improve speed and reduce bandwidth. Examples: Zip files, Video compression (H.264/H.265), Image compression (JPEG/PNG)
  • Data Serialization: Converts complex data structures into a bit-stream and back. Examples:JSON, XML, YAML, Protocol buffers (Google Protobuf)
  • Data Formatting: Ensures data is in a format acceptable to the application layer. Examples: Formatting email data, Character encoding formats like UTF-8 or Unicode
Presentation Layer Protocols
  • Apple Filing Protocol (AFP): File services protocol for macOS.
  • Lightweight Presentation Protocol (LPP): Provides ISO presentation services over TCP/IP stacks.
  • NetWare Core Protocol (NCP): Used in Novell NetWare for file and print services.
  • Network Data Representation (NDR): Defines data types and representations for network communication.
  • External Data Representation (XDR): Standard for describing and encoding data across different architectures.
  • Secure Socket Layer (SSL): Provides encryption and secure communication between web browsers and servers.
  • Transport Layer Security (TLS): The modern, more secure successor to SSL.
Advantages of Presentation Layer
  • Ensures interoperability between different systems
  • Provides security via encryption/decryption
  • Reduces bandwidth usage through compression
  • Standardizes data formats
  • Separates data processing from application logic
Limitations of Presentation Layer
  • Adds processing overhead (encryption, compression require CPU)
  • Not all applications use it consistently
  • Complex formats can make debugging harder
  • Strong dependency on application design
  • Performance issues if data is heavily encoded/encoded repeatedly

7. Application Layer

The Application Layer is the topmost (7th) layer of the OSI model. It is the layer closest to the end-user and directly interacts with software applications to provide network services. It provides the functionality to send and receive data from users. It acts as the interface between the user and the application. This layer does not run applications—it only provides the services that applications need to communicate over the network.

Functions of the Application Layer
  • Network Virtual Terminal: Provides a virtual interface for remote login. Example: Telnet, SSH.
  • File Transfer & Access: Allows files to be uploaded, downloaded, and retrieved across networks. Examples:FTP, TFTP.
  • Email Services: Enables sending, receiving, and managing emails. Protocols:SMTP, IMAP, POP3
  • Web Browsing Services: Provides access to web pages and web applications.Protocol: HTTP / HTTPS
  • Directory Services: Helps in organizing and locating resources in a network. Examples:DNS, LDAP
Protocols of the Application Layer

The application layer provides several protocols which allow any software to easily send and receive information and present meaningful data to its users. The following are some of the application layer protocols.

  • HTTP (HyperText Transfer Protocol) - Used for web communication (Port 80).
  • DNS (Domain Name System) - Translates domain names into IP addresses (Port 53).
  • TELNET - Provides remote login and file management services (Port 23).
  • DHCP (Dynamic Host Configuration Protocol) - Assigns IP addresses to hosts dynamically (Ports 67 & 68).
  • FTP (File Transfer Protocol) - Facilitates file transfer between systems (Ports 20 for data, 21 for control).
  • SMTP (Simple Mail Transfer Protocol) - Handles sending of emails (Ports 25 & 587).
  • NFS (Network File System) - Enables remote access to files as if they were local (Port 2049).
  • SNMP (Simple Network Management Protocol) - Manages and monitors devices in a network (Ports 161 & 162).
Real World Examples
  • Opening a website using a browser → HTTP/HTTPS
  • Logging into Gmail → SMTP/IMAP
  • Downloading a file → FTP
  • Resolving a domain name → DNS
  • Connecting to a server via SSH → Terminal access
  • Getting IP address automatically → DHCP
Advantages of Application Layer
  • Direct user interaction
  • Supports many network services (web, email, file transfer)
  • Allows interoperability between different applications over a network
  • Provides standardized protocols for communication
  • Improves user experience through high-level functionality
Limitations of Application Layer
  • High dependency on lower layers for reliability & delivery
  • Vulnerable to attacks (HTTP attacks, phishing, SMTP hacking)
  • Performance issues if underlying network is slow
  • Protocol complexity (especially in secure communication like HTTPS)
  • Security heavily depends on application implementation

MCQ

OSI Model