A Full Breakdown of the OSI 7 Layer Model

What is a network?

A network is like the heart that connects all our devices, allowing them to share resources and communicate with each other seamlessly. A resource can encompass a wide range of items spanning from a web page on the Internet, files stored on a server in your office, to physical devices like printers or cameras. Whether you’re just a tech-savvy person troubleshooting your home network, a student gearing up for the Network+ exam, or a seasoned IT professional, having a solid grasp of the core concepts in modern computer networking will save you from countless headaches and make your journey smoother.

The OSI Model

In the early days of networking, single manufacturers offered customers complete packages of hardware and software, which worked well as standalone networks. However, connecting multiple networks from different manufacturers became problematic. To address this, a model was needed to describe network functions, encouraging collaboration among networking equipment manufacturers to create compatible hardware and software. Enter the OSI model—a powerful tool for network technicians that serves both as a mental aid for diagnosing issues and as a common language to describe specific network functions. Teams using the same model for diagnosis and communication can save time by avoiding false leads and quickly understanding what actions need to be taken.

The OSI seven-layer model defines important functions in computer networking, with protocols operating at each layer to provide solutions for those functions. These protocols establish clear rules, standards, and procedures, enabling devices and applications to function properly at specific layers. The model encourages modular design, where each layer has minimal interaction with others. The seven layers are (1) Physical, (2) Data Link, (3) Network, (4) Transport, (5) Session, (6) Presentation, (7) Application. While protocols often align with these layers, designing a network is not bound by the model, allowing flexibility for various implementations. Lets take a look at a common networking example that breaks down each layer.

The Situation

Let’s take, for example, a two-person team of social media marketers who work for a local surf shop. The marketers, John and Sarah, work in a small office in the back of the surf shop and each have their own windows workstation.

Windows comes with all the software and hardware necessary to connect to a network and is the most common operating system in the world. John and Sarah are constantly sharing files and collaborating on projects and need a way to access each other’s files over the network. We can use the OSI model to solve this inefficiency and create a workable local network. The initial four layers of the OSI model lay the groundwork for data transmission in a network, covering the fundamental aspects. In contrast, the final three layers delve into the user-facing aspects of networking, focusing on the end-user experience and applications.

Layer 1 – Physical Layer

The surf shop’s physical layer forms the foundation of its local network, consisting of essential physical infrastructure and hardware components facilitating data transmission. Ethernet cables interconnect the workstations belonging to social media marketers, John and Sarah, with a central network switch. These Ethernet cables transmit data in the form of electrical pulses, where the presence of a charge represents a binary one, and the absence of a charge indicates a binary zero.

The network switch, which belongs in layer 2 or 3, plays a critical role in efficiently managing data flow within the network. It operates by utilizing Media Access Control (MAC) addresses assigned to each device (such as John and Sarah’s computers) to forward data frames accurately to their intended destinations. Essentially, when John or Sarah sends data, the switch reads their respective MAC addresses and forwards the data frame only to the targeted recipient’s workstation, enhancing network performance and security.

A data frame is a fundamental unit of data transmission in a network. It consists of the data to be transmitted, as well as control information, such as the source and destination MAC addresses. Data frames ensure that data reaches the intended recipient correctly and reliably.

The physical layer includes any wireless access points integrated into the network for enabling wireless connectivity within the surf shop. These access points provide additional options for devices to connect and communicate over the local network without the need for physical Ethernet cables.

Layer 2 – Data Link Layer

A network interface card, which operates at both layer 1 and 2, provides many purposes to a network. It provides a unique identifier to each device in the form of a 12-character hexadecimal address (MAC address) and is the interface for communication between a computer and the network. Data transmission is done by breaking down whatever is moving across the physical layer into chunks (frames). A frame puts a wrapper around information for easier transmission, they are created, received, and sent by NICs.

Ethernet frames are broken down into the sections shown above. The frame begins with the receivers MAC address followed by the senders MAC address. The type indicates whats inside of the frame and the data field is the information being sent. Lastly, FCS is the frame check sequence which verifies that the frame was not tampered with. In Ethernet networks, frames have a maximum size of 1500 bytes, and when data to be sent exceeds this limit, the sending system’s software breaks it into frame-sized chunks that the NIC handles for transmission. On the receiving end, the system’s software recombines these data chunks as the frames arrive from the network. This process of breaking down and reassembling data is essential for proper communication between systems, ensuring that data is efficiently transmitted and received in the network.

Tripp Lite Switch Industrial Unmanaged 5-Port Gigabit, PoE+ 30W - Primespec1

Switches are network devices that operate either at Layer 2 (Data Link Layer) or Layer 3 (Network Layer) of the OSI model. Layer 2 switches forward data frames based on MAC addresses within a local network, using MAC address tables for efficient data delivery. Layer 3 switches, in addition to Layer 2 functionality, can perform routing using IP addresses, allowing for inter-VLAN communication and more complex network setups. The choice between using a Layer 2 or Layer 3 switch depends on the network’s size and requirements, with Layer 2 switches suitable for simpler networks and Layer 3 switches offering greater flexibility and scalability for more extensive and segmented setups.

When a sending NIC needs to communicate with a specific destination and knows its MAC address, the data transfer occurs directly. However, if the sending system is unaware of the destination MAC address, it may send a broadcast frame using the broadcast address FF-FF-FF-FF-FF-FF. This broadcast frame requests the target system’s MAC address. If the target system recognizes its IP address within the broadcast frame, it responds with its MAC address, enabling successful data communication between the two systems. The process of using MAC addresses and broadcast frames ensures efficient and accurate data delivery within the local network.

The NIC is responsible for two main functionalities: the MAC (Media Access Control) layer and the LLC (Logical Link Control) layer. The Logical Link Control (LLC) manages communication between the NIC and the operating system through device drivers, handling various network protocols and flow control. The Media Access Control (MAC) creates and addresses frames, adding sender and recipient MAC addresses, and verifies Frame Check Sequence (FCS) before transmitting frames over the network cabling. The NIC functions by receiving data from its device driver and then appropriately addressing it for the specific system it belongs to, the payload (data) inside the frame is handled by specialized software.

Devices that handle MAC addresses are categorized within the OSI model as part of the Data Link layer or Layer 2.

Layer 3 – Network Layer

In a simple network where computers connect to a switch, data transfer is effortless between systems. However, as networks grow larger, broadcasting for MAC addresses becomes inefficient and impractical. To handle large networks, a logical addressing method, like subnets, is necessary to break down the network. This transition from physical MAC addresses to logical addressing requires network protocols, such as TCP/IP, with IP (Internet Protocol) being a key element in managing data flow over the Internet.

At the network layer packets are formed and addressed to facilitate their transfer between different networks. The Internet Protocol ensures data is correctly routed to its destination on the network by assigning each device a unique numeric identifier called an IP address. IP addresses are represented in a dotted decimal notation with four 8-bit numbers ranging from 0 to 255, separated by periods. These logical addresses are different from the physical addresses (MAC) associated with a devices NIC.

To allow communication from devices on different subnets a router is used. Routers use IP addresses to forward data and enables networks to connect across data lines that do not use ethernet.

In the TCP/IP protocol, data is wrapped in packets, and then the NIC wraps the packet inside a frame for transfer to another device. The frame may pass through multiple routers to reach its final destination, with each router stripping and rewrapping the frame to determine the next hop. The packet remains unchanged throughout the process, while the frame itself is altered. Once the packet reaches the destination subnet’s router, the frame is stripped off, and a new frame with the appropriate destination MAC address is added before the NIC’s driver passes the packet to the networking software for further processing and delivery to various services.

Layer 4 – Transport Layer

When data is transmitted over a network, it is typically larger than what a single packet can handle. Therefore, the Transport Layer breaks down this data into smaller, more manageable chunks called segments. Each segment is assigned a unique sequence number, allowing the receiving system to correctly order and reassemble the data.

When a computer receives a request to send data, it prepares the data for transmission by segmenting it into packets. These packets are then organized and formatted for efficient transmission, eventually encapsulated into frames by the NIC.

On the receiving end, the receiving system’s Transport Layer performs the crucial task of reassembling the received packets into their original order and format. To achieve this, the receiving system relies on the sequence numbers assigned to each segment during the segmentation process. By correctly ordering and recombining the incoming segments based on the sequence numbers, the receiving system ensures that the entire data transmission is complete and arrives intact. This segmentation and reassembly process is essential for reliable data transmission, especially when dealing with large files or data streams.

The Transport Layer also handles connection-oriented and connectionless communication. Some protocols, like SMTP for sending emails, require a connection to be established before data transmission to ensure the data’s integrity. This connection-oriented approach ensures that data arrives intact without corruption. On the other hand, connectionless protocols, such as User Datagram Protocol (UDP), simply send data without prior verification of the receiving system’s readiness.

The Transport Layer creates TCP segments or UDP datagrams depending on the protocol used. TCP segments include fields such as source and destination port numbers, sequence numbers, and acknowledgment numbers, ensuring reliable and ordered data delivery.

TCP segment

In contrast, UDP datagrams have fewer fields and a simplified structure, making them suitable for applications that tolerate minor data loss and prioritize speed over reliability.

UDP segment

This process helps maintain data integrity, correct ordering, and seamless delivery, making Layer 4 essential for effective communication and data transfer in modern networks.

Layer 5 – Session Layer

The Session Layer (Layer 5) in the OSI model is responsible for establishing, maintaining, and terminating communication sessions between devices. Its primary purpose is to enable seamless and coordinated data exchange, ensuring efficient and reliable communication within a network.

One use case of the Session Layer is in collaborative document editing. For example, when two coworkers want to work together on a Word document simultaneously, the Session Layer comes into play. It facilitates the creation of a virtual session between their computers, negotiating access rights, editing privileges, and synchronization rules. This allows both coworkers to interact with the document in real-time without encountering data conflicts or overwriting each other’s changes.

The session protocol, operating systems, and session software work together to enable communication and coordination between different systems. The session protocol defines the rules and conventions for establishing, maintaining, and terminating communication sessions between applications on different machines. Operating systems provide the underlying infrastructure and resources to support these sessions, managing data transfer, security, and access to hardware. The session software, built into the operating systems, handles the establishment and maintenance of sessions, facilitating the connection between applications on various systems. Through this collaborative framework, applications can interact and exchange data seamlessly, ensuring effective communication and cooperation across interconnected systems.

The Session Layer builds upon Layer 4, the Transport Layer, to establish communication sessions. While Layer 4 focuses on reliable data transmission and end-to-end communication, Layer 5 adds an additional layer of organization and coordination. By managing the establishment, maintenance, and termination of sessions, the Session Layer enhances the capabilities of the underlying Transport Layer, ensuring a smooth and efficient user experience in a networked environment.

Layer 6 – Presentation Layer

This layer ensures that the receiving application can interpret and present the information accurately, regardless of the differences in data formats and conventions between the sender and receiver.

In the presentation layer, encryption is used to secure data during transmission by converting it into a ciphertext that can only be decrypted by authorized recipients. Compression, on the other hand, reduces the size of data to optimize bandwidth usage and speed up data transfer between applications.

In an office setting where two coworkers are collaborating together, the presentation layer would facilitate their seamless communication and data exchange. Suppose one coworker uses a Windows-based application to create a document while the other coworker uses a macOS-based application. The presentation layer would be responsible for translating the data format used by each application into a standardized format that both systems can understand.

Layer 7 – Application Layer

The Application Layer in networking represents the uppermost layer of the OSI model, where user-facing software applications interact with the underlying network infrastructure. It serves as the interface through which users engage with the network’s functionalities. For example, accessing files on a remote system within a network can be accomplished through a tool like “Network” in Windows 10, and web browsers such as Google Chrome or Mozilla Firefox provide users with the means to view web pages.

Within the Application Layer, software applications possess specific features tailored to their respective functions. For instance, in applications like Microsoft Word, users can employ password protection to secure their documents. The Application Layer ensures the seamless integration and operation of these functionalities within the network context.

When two coworkers collaborate on a project, they can both edit the same document simultaneously from separate computers, thanks to the Application Layer’s networking capabilities. As one coworker makes modifications, the changes are instantaneously propagated to the other coworker’s screen in real-time. This efficient collaboration is facilitated by the Application Layer, which handles the necessary communication between their devices, allowing them to cooperatively work on the same document irrespective of their physical locations.