Site icon

Understanding 7 layers of OSI model

7 Layers of OSI model is a base of networking. Let’s understand what is OSI model first
OSI Model is a conceptual model for understanding and designing a network architecture that is flexible, robust, and inter-operable. An open system is a set of protocols that allows any two different systems to communicate regardless of their underlying architecture.

To make it more simple, let’s divide the discussion into multiple Question-

  1. How does OSI Model came into picture?
  2. How Layers of OSI model functions?
  3. How packets encapsulation and decapsulation works?

Let’s start discussion with our 1st question-

1. How does OSI Model came into picture?

In the early 1980s, companies added networks and expanded existing networks as rapidly as new network technologies and products were introduced. By the mid-1980s, companies began to experience difficulties from all the expansions they had made. It became more difficult for networks using different specifications and implementations to communicate with one another. To address this problem, the ISO created the OSI reference model. The intention of the model was to provide vendors with a set of standards that ensure greater compatibility and interoperability between the various types of network technologies that are produced by companies around the world. The model was never actually implemented; but it is still used today as a conceptual model to provide a means of describing how data is transmitted over a network.

2. How Layers of OSI model functions?

The model consists of seven layers, each of which specifies particular network functions, such as addressing, flow control, error control, encapsulation, and reliable message transfer. The lowest layer (the physical layer) is closest to the media technology. The lower two layers are implemented in hardware and software whereas the upper five layers are implemented only in software. The highest layer (the application layer) is closest to the user. The OSI reference model is used universally as a method for teaching and understanding network functionality. Let discuss seven layers of OSI model.

7 Layers of OSI model

The OSI reference model separates network functions into seven categories, or layers, and defines the network functions that occur at each layer. Each layer provides services to the layer above it, uses services from the layer below it.

Layer 1, Physical: The physical layer coordinates the functions required to carry a bit stream over a physical medium. It deals with the mechanical and electrical specifications of the interface and
transmission media. Characteristics such as voltage levels, timing of voltage changes, physical data rates, maximum transmission distances, physical connectors, and other similar attributes are defined by physical layer specifications.
Examples of Layer 1 devices are transceivers, modems, CSU/DSU, and hubs.

Layer 2, Data Link: The data link layer defines how data is formatted for transmission and how data accesses the physical layer. This layer also typically includes error checking. The data link layer divides the stream of bits received from the network layer into manageable data units called frames. Although MAC addresses are typically physical addresses, they operate at the data link layer of the OSI model.
Examples of Layer 2 devices are bridges and switches, which forward and flood traffic based on MAC addresses.

Layer 3, Network: The network layer is responsible for the source-to-destination delivery of a packet,
possibly across multiple networks (links).The network layer provides connectivity between two host systems that can be located on geographically separated networks. It provides logical addressing, selects the best path for data delivery, and routes data packets. An example of a Layer 3 device is a router.

Layer 4, Transport: The transport layer is responsible for process-to-process delivery of the entire message. The transport layer segments data from the system of the sending host and reassembles the data into a data stream on the system of the receiving host.

Segmentation and reassembly. A message is divided into transmittable segments, with each segment containing a sequence number. These numbers enable the transport layer to reassemble the message correctly upon arriving at the destination and to identify and replace packets that were lost in transmission. For example, business users in large corporations often transfer large files from field locations to a corporate site. Reliable delivery of the files is important, so the transport layer breaks down large files into smaller pieces, which are known as segments, that are less likely to incur transmission problems.
The transport layer shields the upper layers from transport implementation details. Specifically, issues such as reliability of transport between two hosts are assigned to the transport layer. In providing a communication service, the transport layer establishes, maintains, and properly terminates virtual circuits. Transport error detection, error recovery, and information flow control ensure reliable service.

Layer 5, Session: The session layer establishes, manages, and terminates sessions between two communicating hosts. The session layer also synchronizes dialog between the presentation layers of the two hosts and manages their data exchange. For example, web servers have many users, so there are many communication processes open at a given time. Therefore, it is important to keep track of which user communicates on which path.

Layer 6, Presentation: The presentation layer ensures that the information that is sent at the application layer of one system is readable by the application layer of another system. For example, a PC program communicates with another computer, with one computer using EBCDIC and the other using ASCII to represent the same characters. If necessary, the presentation layer translates between multiple data formats by using a common format. Main function of Presentation layer – Translation, Encryption, and compression.

Layer 7, Application: The application layer is the OSI layer that is closest to the user. This layer provides network services to the applications of the user, such as email, file transfer, and terminal emulation. The application layer differs from the other layers in that it does not provide services to any other OSI layer, but only to applications outside the OSI model. The application layer establishes the availability of intended communication partners and synchronizes and establishes agreement on procedures for error recovery and control of data integrity.

3. How packet encapsulation and decapsulation works?

If one computer wants to send data to another computer, the data must first be packaged by a process called encapsulation. Encapsulation works very similarly to sending a package through a postal service. The first step is to put the contents of the package into a container. Next, you write the address of the location to which you want to send the package on the outside of the container. Then you put the addressed package into the postal service collection bin, and the package begins its route toward its destination.
Encapsulation wraps data with each network layer’s necessary protocol information before network transit. As the data moves down through the layers of the OSI reference model, each OSI layer adds a header (and a trailer, if applicable) to the data before passing it down to a lower layer. The process is illustrated in the figure below. The headers and trailers of an upper layer are not for use by the lower layers, instead they contain control information for the network devices along the way, and ultimately, the receiver. The control information ensures proper delivery of the data and to ensure that the receiver can correctly interpret the data.

The following steps occur to encapsulate data:

    1. The user data is presented to the application layer.
    1. The application layer adds the application layer header (Layer 7 header) to the user data. The Layer 7 header and the original user data become the data that is passed down to the presentation layer.
    1. The presentation layer adds the presentation layer header (Layer 6 header) to the data. The combined data and header then become the data that is passed down to the session layer.
    1. The session layer adds the session layer header (Layer 5 header) to the data. This combination then becomes the data that is passed down to the transport layer.
    1. The transport layer adds the transport layer header (Layer 4 header) to the data. This combination, which is known as a segment, becomes the data that is passed down to the network layer.
    1. The network layer adds the network layer header (Layer 3 header) to the data. This combination, which is known as a packet, becomes the data that is passed down to the data link layer.
    1. The data link layer adds the data link layer header and trailer (Layer 2 header and trailer) to the data. A Layer 2 trailer is usually the FCS, which is used by the receiver to detect whether the data is in error. This combination, which is known as a frame, then becomes the data that is passed down to the physical layer.
  1. The physical layer then transmits the bits onto the network media.

When the remote device receives a sequence of bits, the physical layer at the remote device passes the bits to the data link layer for manipulation, beginning the de-encapsulation process. The de-encapsulation process is similar to that of reading the address on a package to see if it is for you, and then removing the contents of the package if it is addressed to you.

When the data link layer receives the data, it checks the data-link trailer (the FCS) to see if the binary data has been corrupted in transit. While some data-link technologies can request retransmission for corrupt data, most modern data-links, including Ethernet, will simply discard the corrupted frame. In such environments, if reliability is required, it must be provided by upper layers in the stack. If the data is not in error, the data link layer reads and interprets the control information in the data-link header. The data link layer strips the data-link header and trailer, and then passes the remaining data up to the network layer based on the control information in the data-link header. Each subsequent layer performs a similar de-encapsulation process eventually presenting the original user data from the source to the program running on the peer system.

Exit mobile version