> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/networking-fundamentals/osi-model-open-systems-interconnection.md).

# OSI Model (Open Systems Interconnection)

When a device from one vendor is unable to communicate with a device from another vendor, although it successfully communicates with devices from the same vendor, this lack of interoperability can stem from differences in protocols, configurations, or proprietary implementations. The OSI model serves as a standard reference model for understanding and designing communication systems. It separates functionality between the layers, allowing for easy interoperability between different devices and network architectures.

## **7. Application Layer**

The Application Layer is the top layer in the OSI model that enables end-users to interact with the network and access resources such as file sharing, email, and web browsing. It provides services and interfaces to user applications, facilitating the exchange of data and enabling network communication.

***Some Examples of application layer protocols include:***

* **HTTP (Hypertext Transfer Protocol):** Port 80 (HTTP) and 443 (HTTPS)
* **FTP (File Transfer Protocol):** Port 20 (FTP Data) and 21 (FTP Control)
* **SMTP (Simple Mail Transfer Protocol):** Port 25 (SMTP)
* **DNS (Domain Name System):** Port 53 (DNS)
* **SSH (Secure Shell):** Port 22 (SSH)
* **Telnet:** Port 23 (Telnet)
* **POP3 (Post Office Protocol):** Port 110 (POP3)
* **IMAP (Internet Message Access Protocol):** Port 143 (IMAP)

## **6. Presentation Layer**

&#x20;The presentation layer is responsible for translating data from the application layer into a format that can be transmitted over the network. It handles data encryption and decryption, compression and decompression, and data formatting.

***Some Examples of presentation layer protocols include:***

* **JPEG (Joint Photographic Experts Group)** — a compression algorithm used for image files
* **MPEG (Moving Picture Experts Group)** — a compression algorithm used for video and audio files
* **ASCII (American Standard Code for Information Interchange)** — a character encoding scheme for text-based data
* **MIME (Multipurpose Internet Mail Extensions)** — a protocol used to format email messages with multimedia content, such as images and audio files
* **XDR (External Data Representation)** — a protocol used for the exchange of data between different systems, regardless of their underlying hardware or software platforms.

## **5. Session Layer:**

The Session Layer is responsible for managing the communication sessions between two endpoints or systems. It establishes, manages, and terminates sessions between applications running on different devices, and provides synchronization and checkpointing capabilities to ensure that data is transmitted correctly and reliably.

***Some Examples of session layer protocols include:***

* **L2TP (Layer 2 Tunneling Protocol)** — A protocol used to establish virtual private network (VPN) connections over the internet or other public networks. It is often used in combination with the Internet Protocol Security (IPsec) protocol to provide secure communication between different networks.
* **NetBIOS (Network Basic Input Output System)** — A protocol used to provide services such as file and print sharing between computers on a local area network (LAN). It provides a set of commands and procedures for network communication and resource sharing.
* **PPTP (Point-to-Point Tunneling Protocol)** — A protocol used to establish VPN connections over the internet or other public networks. It is often used in combination with the Microsoft Challenge-Handshake Authentication Protocol (MS-CHAP) to provide secure communication between different networks.
* **PAP (Password Authentication Protocol) —** A protocol used to authenticate users and devices on a network using passwords. It is a simple and widely-used authentication protocol, but it has some security vulnerabilities and is not recommended for use in high-security environments.

## **4. Transport Layer**

The Transport layer is responsible for providing reliable data transmission between two endpoints in a network. It ensures that data is delivered without errors and in the correct order. It also regulates the flow of data between the two endpoints, preventing one endpoint from overwhelming the other with too much data.

The Transport layer is critical in ensuring that data is delivered correctly and efficiently over a network. It achieves this through the use of protocols such as TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). TCP provides reliable data transmission with error recovery and flow control, while UDP provides a faster, but less reliable transmission method without error recovery or flow control.

## **3. Network Layer**

The Network layer receives data from the Transport layer and adds a header to it, which contains the source and destination logical addresses. These addresses are used to identify the source and destination devices on the network. The Network layer then determines the best path for the data to reach its destination, using a process called routing.

***Some Examples of network layer protocols include:***

* **Internet Protocol (IP):** The primary protocol used on the Internet for transmitting data between networks. IP is responsible for logical addressing, routing, and fragmentation/reassembly of data packets.
* **Internet Control Message Protocol (ICMP):** A protocol used by network devices to communicate error messages and operational information, such as testing network connectivity and troubleshooting.
* **Address Resolution Protocol (ARP):** A protocol used to map a device’s physical address (MAC address) to its logical address (IP address) on a local network.
* **Routing Information Protocol (RIP):** A distance-vector routing protocol used by routers to exchange information about network topology and determine the best path for data to travel.

## **2. Data Link Layer**

The Data Link Layer is also responsible for controlling access to the network media and for error detection and correction. It is the layer on which the switches operate and uses the MAC address to direct frames to the correct destination.

***Examples of data link layer protocols include:***

* Ethernet (IEEE 802.3)
* Wi-Fi (IEEE 802.11)
* Point-to-Point Protocol (PPP)
* High-Level Data Link Control (HDLC)

## **1. Physical Layer**

The physical layer is responsible for transmitting raw bits over a physical medium, such as a copper or fibre optic cable. It defines the electrical, mechanical, and procedural specifications for transmitting data.

***Examples of physical layer protocols include:***

* Fibre optic cables (various physical layer standards)
* DSL (Digital Subscriber Line) technologies (various physical layer standards)

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*ZGnXoisgbx3EKeKtQyMVFg.png" alt="" height="712" width="700"><figcaption><p>OSI Model (Open Systems Interconnection)</p></figcaption></figure>

{% hint style="success" %}

* The layers from the Application Layer down to the Transport Layer are collectively called the **Host Layer**.
* The layers from the Network Layer down to the Physical Layer are collectively known as the **Media Layer**.
  {% endhint %}
