7 Layers of The OSI Model (A Complete Guide)

What is OSI Model: A Complete Guide to The 7 Layers of the OSI Model

In this Free Networking Training Series, we explored all about Computer Networking Basics in detail.

OSI Reference Model stands for Open system interconnection reference model which is used for communication in various networks.

The ISO (International organization for standardization) has developed this reference model for communication to be followed worldwide on a given set of a platform.

7 Layers of OSI Model

What Is OSI Model?

Open system interconnection (OSI) reference model consists of seven layers or seven steps which concludes the overall communication system.

In this tutorial, we will take an in-depth look at the functionality of each layer.

As a software tester, it is important to understand this OSI model as each of the software applications works based on one of the layers in this model. As we dive deep in this tutorial, we will explore which layer it is.

Architecture Of The OSI Reference Model

seven layers of OSI Reference Model

Relationship Between Each Layer

Let’s see how each layer in the OSI reference model communicates with one another with the help of the below diagram.

Relationsip between the layers of osi reference model

Enlisted below is the expansion of each Protocol unit exchanged between the layers:

  • APDU– Application protocol data unit.
  • PPDU– Presentation protocol data unit.
  • SPDU– Session protocol data unit.
  • TPDU– Transport protocol data unit (Segment).
  • Packet– Network layer host-router protocol.
  • Frame– Data-link layer host-router protocol.
  • Bits– Physical layer host-router protocol.

Roles & Protocols Used At Each Layer

7 layers

Features Of The OSI Model

The various features of the OSI Model are enlisted below:

  • Easy to understand the communication over wide networks through the OSI Reference Model architecture.
  • Helps to know the details, so that we can get a better understanding of the software and hardware working together.
  • Troubleshooting of faults is easier as the network is distributed in seven layers. Each layer has its own functionality, hence the diagnosis of the issue is easy and less time is taken.
  • Understanding new technologies generation by generation becomes easier and adaptable with the help of the OSI Model.

7 Layers Of The OSI Model

Before exploring the details about the functions of all 7 layers, the problem generally faced by first-timers is, How to memorize the hierarchy of the seven OSI Reference layers in sequence?

Here is the solution which I personally use to memorize it.

Try to remember it as A- PSTN- DP.

Starting from top to bottom A-PSTN-DP stands for Application-Presentation-Session-Transport-Network-Data-link-Physical.

Here are the 7 Layers of the OSI Model:

#1) Layer 1 – Physical layer

  • The physical layer is the first and bottom-most layer of the OSI Reference Model. It mainly provides the bitstream transmission.
  • It also characterizes the media type, connector type and signal type to be used for communication. Basically, the raw data in the form of bits i.e. 0’s & 1’s are converted into signals and exchanged over this layer. Data encapsulation is also done at this layer. The sender end and the receiving end should be in synchronization and the transmission rate in the form of bits per second is also decided at this layer.
  • It provides a transmission interface between the devices and the transmission media and the type of topology to be used for networking along with the type of transmission mode required for transmission is also defined at this level.
  • Usually, star, bus or ring topologies are used for networking and the modes used are half-duplex, full-duplex or simplex.
  • Examples of layer 1 devices include hubs, repeaters & Ethernet cable connectors. These are the basic devices that are used at the physical layer to transmit data through a given physical medium which is suitable as per the network need.

Physical layer

#2) Layer 2 – Data-link Layer

  • Data-link layer is the second layer from the bottom of the OSI Reference Model. The main function of the data-link layer is to perform error detection and combine the data bits into frames. It combines the raw data into bytes and bytes to frames and transmits the data packet to the network layer of the desired destination host. At the destination end, the data-link layer receives the signal, decodes it into frames and delivers it to the hardware.

Data-link Layer

  • MAC Address: Data-link layer supervises the physical addressing system called the MAC address for the networks and handles the access of the assorted network components to the physical medium.
  • A media access control address is a unique device address and each device or component in a network has a MAC address on the basis of which we can uniquely identify a device of the network. It is a 12 digit unique address.
  • Example of MAC address is 3C-95-09-9C-21-G1 (having 6 octets, where the first 3 represent the OUI, the next three represent the NIC). It can also be known as the physical address. The structure of a MAC address is decided by the IEEE organization as it is globally accepted by all firms.

The structure of MAC address representing the various fields and bit length can be seen below.

Variable length

  • Error Detection: Only error detection is done at this layer, not error correction. Error correction is done at the Transport layer.
  • Sometimes data signals encounter some unwanted signals known as error bits. In order to conquer with the errors, this layer performs error detection. Cyclic Redundancy check (CRC) and checksum are few efficient methods of error checking. We will discuss these in the transport layer functions.
  • Flow control & Multiple Access: Data which is sent in the form of a frame between the sender and a receiver over a transmission media at this layer, should transmit and receive at the same pace. When a frame is sent over a medium at a faster speed than the receiver’s working speed, then the data to be received at receiving node will be lost due to a mismatch in speed.
  • In order to overcome these type of issues, the layer performs flow control mechanism.

There are two types of flow control process:

Stop and Wait for flow control: In this mechanism, it pushes the sender after the data is transmitted to stop and wait from the receiver’s end to get the acknowledgment of the frame received at the receiver end. The second data frame is sent over the medium, only after the first acknowledgment is received, and the process will go on.

Sliding window: In this process, both the sender and the receiver will decide the number of frames after which the acknowledgment should be exchanged. This process is time-saving as fewer resources are used in the flow control process.

  • This layer also provisions to provide access to multiple devices to transmit through the same media without collision by using CSMA/CD (carrier sense multiple access/collision detection) protocols.
  • Synchronization: Both the devices between which data sharing is taking place should be in synchronization with each other at both the ends so that data transfer can take place smoothly.
  • Layer-2 Switches: Layer-2 switches are the devices which forward the data to the next layer on the basis of the physical address (MAC address) of the machine. Firstly it gathers the MAC address of the device on the port on which the frame is to be received and later learns the destination of the MAC address from the address table and forwards the frame to the destination of the next layer. If the destination host address is not specified then it simply broadcasts the data frame to all the ports except the one from which it learned the address of the source.
  • Bridges: Bridges is the two port device which works on the data link layer and is used to connect two LAN networks. In addition to this, it behaves like a repeater with an additional function of filtering the unwanted data by learning the MAC address and forwards it further to the destination node. It is used for the connectivity of networks working on the same protocol.

#3) Layer 3 – Network Layer

The network layer is the third layer from the bottom. This layer has the accountability to accomplish the routing of data packets from the source to destination host between the inter and intra networks operating on the same or different protocols.

Apart from the technicalities, if we try to understand what it really does?

The answer is very simple that it finds out the easy, shortest, and time-efficient way out between the sender and the receiver to exchange data using routing protocols, switching, error detection and addressing techniques.

  • It performs the above task by using a logical network addressing and subnetting designs of the network. Irrespective of the two different networks working on the same or different protocol or different topologies the function of this layer is to route the packets from the source to destination by using the logical IP addressing and routers for communication.

Network Layer

  • IP Addressing: The IP address is a logical network address and is a 32-bit number which is globally unique for each network host. It principally consists of two parts i.e. network address & host address. It is generally denoted in a dotted-decimal format with four numbers split by dots. For Example, the dotted-decimal representation of the IP address is which in binary will be 11000000.10101000.00000001.00000001, and is very hard to remember. Thus usually the first one is used. These eight bits sector are known as octets.
  • Routers work at this layer and are used for communication for inter and intra network-wide area networks (WAN’s). Routers who transmit the data packets between the networks do not know the exact destination address of the destination host for which the packet is routed, rather they only know the location of the network to which they belong to and use the information that is stored in the routing table to establish the path along which the packet is to be delivered to the destination. After the packet is delivered to the destination network, it then is delivered to the desired host of that particular network.
  • For the above series of procedure to be done the IP address has two parts. The first part of IP address is network address and the last part is the host address.
    • Example: For the IP address The network address will be and the host address will be

Subnet Mask: The network address and the host address defined in the IP address is not solely efficient to determine that the destination host is of the same sub-network or remote network. The subnet mask is a 32-bit logical address that is used along with the IP address by the routers to determine the location of the destination host to route the packet data.

Example for combined usage of IP address & subnet mask is shown below:

Subnet mask

For the above Example, by using a subnet mask, we get to know that the network ID is and the host address is When a packet arrives from subnet and has a destination address as, then the PC will receive it from the network and process it further to the next level.

Thus by using subnetting, the layer-3 will provide an inter-networking between the two different subnets as well.

The IP addressing is a connectionless service, thus the layer -3 provides a connectionless service. The data packets are sent over the medium without waiting for the recipient to send the acknowledgment. If the data packets which are big in size are received from the lower level to transmit, then it splits it into small packets and forwards it.

At the receiving end, it again reassembles them to the original size, thus becoming space efficient as a medium less load.

#4) Layer 4 – Transport Layer

transport layer

The fourth layer from the bottom is called the transport layer of the OSI Reference model.

(i) This layer guarantees an end to end error-free connection between the two different hosts or devices of networks. This is the first one which takes the data from the upper layer i.e. the application layer, and then splits it into smaller packets called the segments and dispenses it to the network layer for further delivery to the destination host.

It ensures that the data received at host end will be in the same order in which it was transmitted. It provides an end to end supply of the data segments of both inter and intra sub-networks. For an end to end communication over the networks, all devices are equipped with a Transport service access point (TSAP) and are also branded as port numbers.

A host will recognize its peer host at the remote network by its port number.

(ii) The two transport layer protocols include:

  • Transmission control protocol (TCP)
  • User Datagram Protocol (UDP)

TCP is a connection-oriented and reliable protocol. In this protocol, firstly the connection is established between the two hosts of the remote end, only then the data is sent over the network for communication. The receiver always sends an acknowledgment of the data received or not received by the sender once the first data packet is transmitted.

After receiving the acknowledgment from the receiver, the second data packet is sent over the medium. It also checks the order in which the data is to be received otherwise data is re-transmitted. This layer provides an error correction mechanism and flow control. It also supports client/server model for communication.

UDP is a connectionless and unreliable protocol. Once data is transmitted between two hosts, the receiver host doesn’t send any acknowledgment of receiving the data packets. Thus the sender will keep on sending data without waiting for an acknowledgment.

This makes it very easy to process any network requirement as no time is wasted in waiting for acknowledgment. The end host will be any machine like a computer, phone or tablet.

This type of protocol is widely used in video streaming, online games, video calls, voice over IP where when some data packets of video are lost then it doesn’t have much significance, and can be ignored as it doesn’t make much impact on the information it carries and doesn’t have much relevance.

(iii) Error Detection & Control: Error checking is provided in this layer because of the following two reasons:

Even if no errors are introduced when a segment is moving over a link, it can be possible for errors to be introduced when a segment is stored in the router’s memory (for queuing). The data link layer is not able to detect an error in this scenario.

There is no assurance that all the links between the source and destination will provide error scrutiny. One of the links may be using a link layer protocol which doesn’t offer the desired outcomes.

The methods used for error check and control are CRC (cyclic redundancy check) and checksum.

CRC: The concept of CRC (Cyclic Redundancy Check) grounds on the binary division of the data component, as the remainder of which (CRC) is appended to the data component and sent to the receiver. The recipient divides data component by an identical divisor.

If the remainder comes up to zero then the data component is allowed to pass to forward the protocol, else, it is assumed that the data unit has been distorted in transmission and the packet is discarded.

Checksum Generator & checker:  In this method, the sender uses the checksum generator mechanism in which initially the data component is split into equal segments of n bits. Then, all the segments are added together by employing 1’s complement.

Later, it complements once again, and now it turns into checksum and then is sent along with the data component.

Example: If 16 bits is to be sent to the receiver and bits are 10000010 00101011, then the checksum that will be transmitted to the receiver will be 10000010 00101011 01010000.

Upon receiving the data unit, the receiver divides it into n equal size segments. All the segments are added using 1’s complement. The result is complemented once more and If the result is zero, the data is accepted, else discarded.

This error detection & control method permits a receiver to rebuild the original data whenever it is found corrupted in transit.

#5) Layer 5 – Session Layer

This layer permits the users of different platforms to set up an active communication session between themselves.

The main function of this layer is to provide sync in the dialogue between the two distinctive applications. The synchronization is necessary for efficient delivery of data without any loss at the receiver end.

Let’s understand this with the help of an Example.

Assume that a sender is sending a big data file of more than 2000 pages. This layer will add some checkpoints while sending the big data file. After sending a small sequence of 40 pages, it ensures the sequence & successful acknowledgment of data.

If verification is OK, it will keep repeating it further till the end otherwise it will re-synchronize and re-transmit.

This will help in keeping the data safe and the whole data host will never completely get lost if some crash happens. Also, token management, will not allow two networks of heavy data and of the same type to transmit at the same time.

Session layer

#6) Layer 6 – Presentation Layer

As suggested by the name itself, the presentation layer will present the data to its end users in the form in which it can easily be understood. Hence, this layer takes care of the syntax, as the mode of communication used by the sender and receiver may be different.

It plays the role of a translator so that the two systems come on the same platform for communication and will easily understand each other.

The data which is in the form of characters and numbers are split into bits before transmission by the layer. It translates the data for networks in the form in which they require it and for devices like phones, PC, etc in the format they require it.

The layer also performs data encryption at the sender’s end and data decryption at the receiver’s end.

It also performs data compression for multimedia data before transmitting, as the length of multimedia data is very big and much bandwidth will be required to transmit it over media, this data is compressed into small packets and at the receiver’s end, it will be decompressed to get the original length of data in its own format.

#7) Top Layer – Application Layer

This is the topmost and seventh layer of the OSI reference model. This layer will communicate with the end users & user applications.

This layer grants a direct interface and access to the users with the network. The users can directly access the network at this layer. Few Examples of services provided by this layer include e-mail, sharing data files, FTP GUI based software like Netnumen, Filezilla (used for file sharing), telnet network devices etc.

There is vagueness in this layer as is not all user-based information and the software can be planted into this layer.

For Example, any designing software can’t be put directly at this layer while on the other hand when we access any application through a web browser, it can be planted at this layer as a web browser is using HTTP (hypertext transfer protocol) which is an application layer protocol.

Therefore irrespective of the software used, it is the protocol used by the software that is considered at this layer.

Software testing programs will work on this layer as the application layer provides an interface to its end users to test the services and their uses. The HTTP protocol is mostly used for testing at this layer but FTP, DNS, TELNET can also be used as per the requirement of the system and network in which they are operating.


From this tutorial, we learned about the functionalities, roles, inter-connection, and relationship between each layer of the OSI reference model.

The bottom four layers (from physical to transport) are used for data transmission between the networks and the top three layers (session, presentation & application) are for data transmission between hosts.

PREV Tutorial | NEXT Tutorial