How the OSI Model & Network Communication Layers Work

Honeypot

Sending messages to someone on the other side of the world used to take a lot more time than getting out of bed and clicking send on your email app. Nowadays, we can interact with our colleagues and friends almost instantly. But how does knowledge get from your colleague’s laptop or a friend’s phone to your device? The OSI model comes into play at this stage.

The layers are at the heart of the OSI model and network communications.

What Is the OSI Model?

The International Organization for Standardization (ISO) has provided us with a structure called the Open Systems Interconnection Model (or OSI model) (ISO). What is the point of it? For multi-vendor interoperability, standardise communication protocols and settle on network specifications. In other words, it allows various devices from various vendors to communicate in a consistent manner. It also allows people to break down various sections of network structures according to their network communications roles.

Network Layers: OSI Model vs TCP/IP

The TCP/IP reference model, which has four layers, is also used as an industry standard in addition to the OSI model. Isn’t the OSI model the same as the TCP/IP model, you may be thinking? Both yes and no. They’re related, but they’re still distinct.

TCP/IP stands for transmission control protocol/internet protocol, and it is a protocol suite that has four layers: application, transport, internet, and connection. The application layer of the TCP/IP model is mapped to layers 5, 6, and 7 of the OSI model. In the TCP/IP model, the OSI network layer is referred to as the internet layer. Layer 4 of the OSI model corresponds to the transport layer, while layers 1 and 2 are combined into the network access layer of the TCP/IP model. This suite was developed nearly a decade before the OSI model was developed.

“The OSI Model isn’t itself a networking standard in the same sense that Ethernet and TCP/IP are. Rather, the OSI Model is a framework into which the various networking standards can fit. The OSI Model specifies what aspects of a network’s operation can be addressed by various network standards. So, in a sense, the OSI Model is sort of a standard’s standard.”

Understanding how telecommunication systems operate at a granular level requires familiarity with the OSI model network layers. This will assist you in identifying and resolving network problems. It also allows you to see the larger picture of how data travels through a network of interconnected devices.

Breaking Down Network Layers: A Look at the 7 OSI Model Layers

The OSI model is more of a guideline for manufacturers and developers than a rigid representation of how a network looks. Instead, it provides a high-level view of how data moves through the network. This model has seven layers, each with its own collection of capabilities and protocol suite. Starting with layer seven and working down to layer one, the layers are usually classified in descending order.

Consider how this will work in a two-party connection, such as between your computer and the computer of a friend. On both host devices, the seven layers exist, and each layer shares data with its corresponding counterpart independently of the layers below it. This means that if you send data from your computer to a friend, the data on your system’s OSI layer 2 can exchange directly with the layer 2 of your friend’s device. Your layer 3 will communicate with their layer 3, and so on.

However, there is one crucial piece of information that we must address. Additional information is applied to the data as it passes down from your computer’s application layer until it is passed on to the layers below. Since protocol information is added to the beginning (header) and/or end (trailer) of the data, this phase is known as data encapsulation.

At the recipient’s end, data decapsulation occurs, in which the incoming data is unpacked as it progresses through the layers, before all additional headers and/or trailers are stripped away at the application layer.

Since data travels from the sender to the receiver from the top down, it seems natural to begin with the OSI model’s seventh layer and work our way down. Let’s take a look at the OSI model layers.

OSI Layer 7: Application Layer

The application layer is the seventh layer of the OSI model. It deals with software and programmes that run on our machines, such as the web browser you’re using to read this web page, as the name implies. This layer, in essence, communicates with end-users through those apps and serves as an interface between them and the underlying network connections. HTTP, DNS, FTP, SMTP, and other protocols are commonly used at the application layer.

The application layer is responsible for the human-computer interaction interface, which is focused on end-user services. When we do the following, we depend on the application layer:

  • Access or transfer files on a remote machine,
  • Store and forward emails,
  • Use a virtual terminal, or
  • Access directory services.

OSI Layer 6: Presentation Layer

Layer 6 of the OSI model has three primary responsibilities:

  1. Encoding (for example, ASCII encoding),
  2. Encryption (like when applying SSL/TLS), and
  3. Compression (such as by using gzip).

When sending, the data travels from the application to the presentation layer and in the reverse order while receiving.

OSI Layer 5: Session Layer

Session management is handled by the session layer, or layer five of the OSI model. This layer is primarily concerned with initiating, closing, and handling communication between two parties or endpoints.

Consider how many applications a user could have open at the same time — an email client, a web browser, a text editor, and so on — and how each of those applications might be running several connections. One tab in the web browser might be dedicated to video, another to email, yet another to online shopping, and so on. The session layer is in charge of maintaining, handling, and terminating all of those connections.

OSI Layer 4: Transport Layer

The transport layer, also known as OSI layer four, is responsible for transporting segments (which we’ll discuss in a moment) to the appropriate application or service. Consider an Apache server that is listening for incoming connections on port 80 or 443 in the background. The transport layer can send an incoming message to the corresponding service if the destination port is 80.

A segment is the protocol data unit (PDU) at this layer. To obtain some reliability, the original data is broken up into chunks called segments and sent over several pathways (by avoiding congestion). Since the segments are spread, it incorporates security by making it more difficult for an attacker to read the entire document.

The transport layer on the receiving system is in charge of reassembling these segments in the correct order before sending it to the session layer. Each segment has header details such as source port, which is allocated by the client’s operating system based on availability, destination port, series, and acknowledgment numbers, which communicate which segment was delivered and what it intends to receive next. TCP or UDP protocols are used depending on whether the transmission is secure or unreliable.

Error control tests are in effect in the case of a secure link (TCP) to decide whether the message received is complete. If not, it requests that the message be sent again. Transmission failures can occur as a result of link speed differences. The use of flow control ensures that a sender with a faster link does not overpower a receiver with a slower connection. Multiplexing and demultiplexing are also included in the transport layer to allow clients to connect with multiple application processes in a single session.

So, how does UDP work? Let’s go back in time to your eighth-grade math class for a moment (or any lecture that you can recall). That is an example of inconsistency in delivery. It’s a UDP transmission because the instructor transmitting the lecture (i.e., the data transmitted) didn’t wait for students to agree that the message was delivered in its entirety. Where the file size is large and the transmission is time-sensitive, such as in audio or video transmissions, UDP is used. In a video, for example, you wouldn’t want a time lag after each frame.

OSI Layer 3: Network Layer

The data is routed through multiple pathways in Layer 3 of the OSI model. This OSI layer’s PDU is referred to as a packet. To distinguish end devices, it contains information such as source and destination IP addresses. IPv4 is the most widely used protocol at this layer. The network layer is in control of:

Routing packets from source to destination through several networks (host-to-host delivery),
Fragmenting packets into smaller pieces to allow them to move over links with lower maximum transmission units and translating logical addresses into physical addresses (MTU).

OSI Layer 2: Data Link Layer

Layer two of the OSI model is the data link layer, which is also the last layer where encapsulation (frame assembly and disassembly) takes place. While sending out information, it takes data from the layers above it and links it to the last layer. A frame is a packet with a header and a trailer that is used by the data link layer. The header denotes the start of a frame, while the trailer denotes the end of data transmission for that frame.

There are two sublayers in the data link layer:

  • The upper sublayer, the Logical Link Control (LLC) layer, assists with multiplexing and demultiplexing over the MAC layer. It takes a packet from the network layer and adds control information so that it can be sent to the correct location (hop-to-hop flow and error control).
  • The lower sublayer, the Media Access Control (MAC) layer, communicates directly with the physical layer and handles framing and de-framing, which is usually handled by NIC cards on PCs. It’s also in charge of resolving collisions on mutual or transmitted links where multiple end nodes are linked to the same connection.

OSI Layer 1: Physical Layer

The physical layer is the first and lowest layer of the OSI model. It deals with the physical connections between devices, such as cables, switches, and network interface cards (NICs), as well as the raw data transfer between them. To send and receive information, consider the following:

  • Ethernet cables,
  • Fiber optic cables,
  • Radio signals used in wireless communication, etc. to send or receive information.

Bit-by-bit delivery, translating signals from one type to another, line coding, carrier sensing and collision detection, bit synchronisation, specifying the transmission mode, and so on are all tasks of the physical layer.

How Is the World Connected?

The short response is that it is done by cables. It would be fascinating to learn about the physical communication channels that data flows through, how they are designed, who owns them, and how these channels that bind the entire world came to be.

When you try to send a picture file to a mate, what happens in the background? It is converted into binary (1s and 0s) and transmitted to the router via radio waves. This is accomplished by frequency modulation, which uses one frequency to represent 1s and another to represent 0s. The signal can be read as long as the receiver knows which frequency is used to reflect the 1s and 0s.

Depending on the wire’s content, the information then leaves the router through cables in the form of light or electricity. Internet service providers typically instal and own these cables (ISPs). ISPs are in charge of figuring out the most effective path for the message to travel to its next destination, an internet hub. Multiple ISPs, telecommunication firms, and internet operators share traffic at the internet hub.

Submarine cable operators are largely responsible for laying down undersea cables for long-distance communication. These cables carry data through oceans and continents. However, not everyone has internet access. The return on investment for providers that bear the expense of establishing infrastructure in sparsely populated or low-income areas is insufficient.

Final Thoughts

The four-layered TCP/IP model can be mapped to the OSI layers (that came before it). This means that, rather than being a static network implementation model, it is a structure or a guideline that helps us understand what happens when machines from all over the world or within the same network interact with one another.

Hopefully, going over the OSI model and its various network layers gave you a good idea of how data travels at the level of bits and signals and how we, as end-users, communicate with it at the application level.

Melina Richardson is a Cyber Security Enthusiast, Security Blogger, Technical Editor, Certified Ethical Hacker, Author at Cybers Guards & w-se. Previously, he worked as a security news reporter.