Sunday, March 11, 2012

How OSI 7 Layer Model Works? Understanding OSI Layers

How OSI 7 Layer Model Works? Understanding OSI Layers by Anuj Tyagi


This article aims to study the 7 layers of OSI model used by Computer system, when communicating with any other system in same/ different network.
Note: This article is not about understanding OSI layers. It is a practical approach for how OSI layers works & used by our computer system.
image
Application Layer: Application Layer provides user interface i.e. user directly interacts with this layer. The most common examples of applications which enable us to communicate through different protocols are :
  • FTP (Eg. Filezilla Server Application)
  • http/https (Eg. Firefox or any other Web-browser)
  • SMTP ( via any email client like IBM LOTUS or Microsoft Outlook or WebBrowser)
  • Telnet ( shell interpretaors like Command Prompt in windows/ terminal in linux distro)
As all of these applications accessed through computer .

Presentation Layer: This layer gets name from it’s purpose . This layer responsibility includes :
  • Presents data to application layer and responsible for data translation and formatting. Eg. Translation of data we enter into browser to be converted into web language codes with different tags . Also it takes care of data which has been sent should be understood by browser to present it on user-interface .
  • Compression and encryption of data .
image
I tried to capture a packet for PING REQUEST to www.google.com and on capturing packets got this in packets.
For compression, take an example of browser which uses HTTP Compression to save transfer data volume and speeds ups Web page load time. Firefox uses Gzip encoding to send data .
  • We proved that presentation layer also used by & within computer system .
Session Layer : Session layer establish, maintain and terminates sessions between end devices. We can check current sessions in the system using netstat command and output will look like this :
image
This command is common for windows/Linux OS.

Transport Layer : This layer is concerned with reliability of data transfer .
It is of two types :
  1. Connection Oriented (TCP)
  2. Connectionless (UDP)
It is easy to find if connection is establish is in TCP/UDP state. Look at the above figure in which first column defines whether connection is established as TCP/UDP. This process is Protocol dependent .

It also take care of other responsibilities like :
Flow Control (windows) : Which find how much data should be send in one packet during transfer to minimize the data loss due to buffer overflow. It doesn’t send data but Segment into smaller pieces and size of which is defined through windowing feature. To show this in practical manner, I started to upload a file on mediafire.com .
image
By ping , we got ip address of mediafire.com .it’s 205.196.120.8 .
And Now I started to sniff the packets using wireshark on my pc. So, it’s easy to confirm that below captured packets are those during transfer from mediafire. .
image
So, what do we learn from above image ?
Source address: 205.196.120.8
Destination address: 192.168.1.3
Protocol type: TCP (connection oriented )
Win (window size ): 66240 bytes = 65 KB approx .
Source address is mediafire server as we are uploading data.
So, what conclusion it makes ? Data is being split up into 66240 bytes each and after reaching destination it being re-ordered.
The segments which are delivered are acknowledged back to the sender upon their reception.
Network Layer: Network layer works on Logical address which is IP addresses. A computer system understand IP addresses and communication and identification also takes place in computer system.
image
Any device which use ip-address for communication
Data Link Layer : The main focus of data link layer on use of MAC address. Whenever data flows through the LAN , communication takes place through MAC address .
So, to find if MAC address is being used during data transfer in lan or not ?
I start capturing again using wireshark .
image
Which shows Destination MAC address : 00:26:5e:ff:c5:fc for 192.168.1.3
Source MAC address: 00:26:5e:fc:10:Se for 192.168.1.2 .
image






Physical Layer :
This layer conveys the bit stream through the network at the electrical and mechanical level. It provides the hardware means of sending and receiving data on a carrier.
The Physical Layer defines electrical and physical specifications for devices. In particular, it defines the relationship between a device and a transmission medium, such as a copper or optical cable.
The major functions and services performed by the Physical Layer are:
  • Establishment and termination of a connection to a communications medium.
  • Participation in the process whereby the communication resources are effectively shared among multiple users. For example, contention resolution and flow control.
  • Modulation, or conversion between the representation of digital data in user equipment and the corresponding signals transmitted over a communications channel.
In short, Computer translates the signal and instructions into Binary language (0 or 1). Hardware devices understand Binary language (including computer device components , connecting cables)
image
image
So, during transfer of data, various instructions and signals executed whichch converted into binary language . Similarly, when we transfer data from our system to any other then transfer takes place through various components and leave through cable.

No comments:

Post a Comment