OSI model layers explanation

For explanation of OSI model layers, first question comes in mind that what is OSI and where it came from? OSI full form is Open Systems Interconnection.  Open system means devices those can connect to other devices. OSI model is a reference model developed by International Organization for Standardization (ISO).  Reference model means , guidelines how a communication system should be developed. It does not mention any underlying technologies or any other specific protocol.  This is a framework , to which an actual implementation can refer. In this OSI model tutorial we will cover following.

  1. What is a layer.
  2. What is Layered Architecture. 
  3. Peer to Peer communication.
  4. Layer addressing in OSI model.
  5. What is physical Layer.
  6. What is Data Link Layer.
  7. What is Network Layer.
  8. What is Transport Layer.
  9. What is session layer. 
  10. What is presentation layer. 
  11. What is application layer.
  12. Example Message Flow


Why there are layers in OSI Model:

There are two main important things in OSI model. One it is based on layered architecture and another there are primitives between layers. 

What is layer? A layer is a independent entity which implements a fix set of functionalities .

What is primitives ? Services offered by a layer is defined in terms of primitives. E.g a transport layer sends the message on user request , so one of the primitives is the message transfer request.

In layered architecture, a  layer provides services to the user of layer and uses services from another layer. There can be multiple users,  and multiple service providers for the same layer. 

Layers can be loosely coupled or tightly coupled

In loosely coupled system, communication between layers is message based. 

In tightly coupled, communication between layers is function based. Means if layer 2 want to use the functionality of layer 1 then , it will directly invoke the primitive function in layer 1.



Layers In OSI Model

There are seven logical layers in OSI model.  Or you can say logical demarcation of functionalities for achieving computer network communication.  Each layer defines a set of functionalities. In actual implementation , the actual protocol stack implementation for communication may break an layer in more than one independent layers or it can combine more than one layers in one.

Layers in OSI model
Layers in OSI model

Peer to peer Communication in OSI Model:

Fist we will explain, what is peer to peer communication?  What is peer in OSI model ? A peer is the remote layer at the same level.  For example. Transport layer of remote protocol stack is the peer of local transport layer. When a local peer sends a message to the remote , it adds its own address and peer address in header. For lower layer , the header is user data only. The remote peer uses the header to handle the message.

Addressing In OSI Model:

For communication the addressing is must. Specially if the remote application is not present on local machine. In osi reference model, till layer 4 there is address for each layer. For upper layers there is no address. The address format depends on the actual protocol implementation and  underlying technologies.

Pdu in osi model:

Protocol data unit or PDU  in networking is the information unit exchange between the two layers. There is one to one relation between a primitive and protocol data unit.   A pdu contains header part and data part.  Header part is optional . In OSI model till layer 4  a pdu have header and data. From layers 4 to 7 there is only user data.

protocol data unit in networking
protocol data unit in networking

A header may contain following parts:

  1. Source Address, this is the address of sending layer.
  2. Destination Address, this is the address of peer layer.
  3. Control Flags, this is the information present in header for controlling the behavior of message over network.  For example, a flag may convey that the message is management message not the user data message. So that the receiving peer layer process the message locally. Do no transfer message to upper layer.

Physical Layer:

This is the lowest layer in OSI model.  The functionality of this layer to communicated with peer physical layer over a wire/wireless. Physical media understand the electrical signals. In 0 and 1 format. Zero means low current and 1 means high current.  For an example if one end want to send a byte value 0x56. Its binary equivalent will be 01010110, Now there will be low,high,high,low,high,low,high,low will be the sequence for electric current.  There will be a separate details tutorial for physical layer.

Data Link: 

Second layer is OSI model.  Provides error free and in sequence delivery of frames between directly contented machines.  Data link layer have two sub layers.

  • MAC or Medium Access Control

  • LLC or Logical Link Control

The details of layer is explained in a separate tutorial.

Network Layer:

Third layer is OSI model. It does the routing of packets received from the upper layer. Upper layer is the user of Network Layer.  In OSI model the user is transport layer. The routing is end to end. What does end to end means? Means source to destination IP layer. There can be multiple IP layers in middle from source to destination. The intermediate layers checks if packet destination address is the address of current IP layer or Host? If yes then layer sends the packet  is to the user else forwarded to the next hope for further routing.  For example, if you are browsing yahoo.com. Then source IP layer is in your Computer or Laptop and destination is on yahoo server.

The intermediate IP layers are in the router you are connected via LAN cable of WiFi and in ISP network.

Transport Layer:

Fourth Layer In OSI model. Responsible  for delivering user message to the destination. The destination is the user of peer transport layer user.  It also do end to end routing.  So only end node transport will receive the message. On intermediate nodes , message will be routed from network layer only. Layer also does the error correction and sequencing. SCTP protocol is one of the example of transport layer implementation.

Session Layer:

Fifth layer in OSI model. Session is a logical connection with peer. Same session layer may have multiple session with remote peer. A session is useful to correlate request and response. As example HTTP protocol uses session. If a response comes and there is no session then response is dropped.  Why session layer is needed?  User layer can not so the session management? The answer is yes, user layer can do. But like other layers this is a functionality.  Which saves time and errors in session or dialogue control.

Presentation Layer:

Computer network runs with multiple computers with different machine architectures. A computer may be big endian or little endian etc. Its not only the machine but there are other factors also , like character set etc.  Presentation layer convert form local application format to the network format and vice versa.  It does the data encryption, translation an compression for user application layer.

Application Layer:

As name suggest , it the which implements user application logic rather than focusing data transfer over network. FTP, SSH, SCP are the few examples of an application layer.  There can be already defined applications or a user developed new application.


Example Message Flow In OSI Model tutorial

This section of OSI model tutorial includes the sample protocol data unit flow. The upper three layers don’t  have a specific header for routing. Following is flow from layer 4.

Transport Layer Add its header in user data. User data is the data from Session Layer.

Flow sender side:

OSI model example message flow
OSI model example message flow

Upon receiving primitives from transport layer. Network layer adds its own header to the data received from transport  layer.

Network User (NU)- Data = Transport header + session data.

Network layers issues the primitive to the  data link layer. Data link layer adds its own header to the data from Network Layer.

Data Link User (DU)- Data = Network  header + Transport header + session data.

Data link uses service of physical layer. Physical layer adds its own information and sends message to the peer physical layer.

Flow receiver side:

On receiving side actions are opposite as compare to sender.

Physical layer remover the header and sends the renaming data to the Data Link.

Data Link remove the data link header and sends remaining data to the network layer.

Network Layer removes the header and sends the remaining data to the transport layer.

Transport layer, removers the its header and sends remaining data to the session layer.

Now the others layers transfers to the application layer.

We can see in example, that the receiving OSI application layer got the same data or message , which was intiated by the sender application layer.

osi model tutorial 


Leave a Reply

Your email address will not be published. Required fields are marked *