In this guide, we will discuss OSI model in computer network and seven layers of OSI model in detail.
1. OSI Model stands for Open System interconnection model.
2. OSI Model defines how data is transferred from one computer to another computer.
3. In a very basic scenario two computers connected with a LAN and connectors transfer data using the NIC. This forms a computer network, however if both the system uses different operating systems, for example one system runs on windows and other one runs on MacOS then how can data be transferred between these two different systems, here comes the role of a OSI model which is a seven layered model that defines how a data can be transferred between different systems.
4. OSI model was introduced by International Organisation for standardisation (ISO) in 1984.
5. There are seven layers in a OSI model
- Application layer
- Presentation Layer
- Session layer
- Transport layer
- Network Layer
- DataLink layer
- Physical layer
We now learned that a transport layer converts the data into segments, network layer converts the segments into packets and data link layer converts the packets into frames. A frame is nothing but a sequence of bits such as 1001011.
Physical layer converts these binary sequences into signals and transfer it through a transmission media such as cables etc.
The signals generated by physical layer is based on the transmission media. For example an electrical signal is generated if the media is copper cable, light signal if media is optical fibre and radio signal in case of transmission media is air. This generated signal is received by the physical layer at the receiver side and converts it into bits.
Main functions of Physical Layer:
One of the main functions of physical layer is to transfer data in form of signals. In this guide, we will learn about digital transmission. A data can be either analog or digital. To transfer the data over a transmission media such as wire, cable etc. physical layer must need to convert the data to its digital signal.
Digital data to Digital signal conversion:
In this section we will learn how physical layer converts digital data to digital signal. It uses two techniques to do this conversion: Line coding and block coding.
A digital data is in form of binary sequence such as 1000111 (combination of 0s and 1s). Line coding uses three schemes to represent these binary sequences in form of signals that can be transferred.
Data Link Layer
Data link layer receives the data from network layer.
There are two types of addressing done to the packets transfers from one computer to another computer.
Logical addressing: Logical addressing is assigning sender and receiver IP addresses to data packets. This is done at the network layer.
Physical addressing: Physical addressing is done at data link layer where MAC addresses of sender and receiver are assigned to each data packets.
Data unit in the data link layer is called frame. A frame is transferred from one computer to another computer and transmission is done through a transmission media such as wire, cable etc. Both sender and receiver computer has NIC that helps in sending and receiving frame. These NICs presents at sender and receiver provides a physical link between sender and receiver.
Main functions of data link layer:
Access the Media: Allows upper layers of OSI model to use the media using a technique called framing
Media Access control: How data is placed and received from the media.
Error Detection: Tail of the each frame transferred contains certain bits to check whether the data received on the side is corrupted or not.
The main purpose of network layer is to receive the data segments from transport layer and transfer them from one computer to another computer on different network.
The main functions of network layer:
Logical Addressing: Every computer on a network has a unique IP address. Network layer assigns the sender and receiver IP address to the data packets before transmitting them so that the data packet reach the correct destination.
Routing: It is a method of transferring data packets from source to destination. It uses the combination of Mask and IP address to transfer the data to correct destination. Each data packets contains three addition components mask, sender IP, receiver IP. The Mask determines the computer network to which the data needs to be delivered and then the IP address determines which computer on that particular network needs to receive the data packet.
Path determination: A computer can be connected to another computer in number of ways. Network layer determines the optimal path for data transmission so that the data can be transmitted faster to the receiver. OSPF, BGP, IS-IS protocols are used to determine best possible path for data delivery.
The main role of transport layer is to check the reliability of data communication.
The main functions of transport layer are:
Segmentation: Data received from session layer is divided into small data units called segments. Each segment contains the sender and receiver port number along with the sequence number. Port number helps to direct the data segments to the correct application and the sequence number helps to reassemble the data from data segments in correct order.
Flow control: It controls the flow of data. It checks the capability of the receiver device receiving capability before transmitting data. For example a sender server can send the data at a rate of 200Mbps but a receiving data can only receive data at a rate of 10 Mbps then it controls the flow of data to 10Mbps so that the data doesn’t get lost during transmission.
Error control: Transport layer also performs error control using Automatic Repeat Request, if a data is lost during transmission, it is send again using automatic repeat request. Transport layer also adds a group of bits called checksum with each segment to check whether the data received at receiver side is not corrupt.
Connection oriented transmission: Connection oriented transmission is done using transmission control protocol (TCP). TCP is considerably slower than UDP because it provides the feedback that the data is received or not, thus a data can be sent again if it is not received.
Connectionless transmission: Connectionless transmission is done using User Datagram protocol (UDP). UDP is faster than TCP because it doesn’t provide the feedback that the data is actually received at the receiver side or not.
The main role of session layer is to setup and maintain the connection between different systems.
Main functions of session layer:
Authentication: Before a computer can be connected to a server, the computer has to provide user name and password for the authentication. The function of authentication and setting up a connection after authentication is performed by session layer.
Authorization: Once a connection is established, session layer checks whether the connected computer is authorised to access the data, this function of authorisation checking is also performed by session layer.
Session management: Session layer also checks that the data which is received from the server in form of data packets belongs to which application for example when you access Facebook profile through your browser, the data transferred from the Facebook server is transferred to your web browser application, thus the session layer helps in session management.
Presentation layer receives the data from top most layer which is application layer.
Functions of Presentation layer:
Translation: The data received from application layer is in form of characters and numbers such as 1234, ERFF etc. The presentation layer converts these characters and numbers into machine understandable format which is known as binary format for example 100111101.
Encryption: To protect the sensitivity of data, presentation layer encrypts the data at the sender side before the transmission and the receiver side this data is decrypted by the presentation layer at the receiver side. Secure sockets layer protocol (SSL) is used by the presentation layer for encryption and decryption.
Compression: Compress the data to small size so that it can be transferred faster over a network. This compression can be lossy or lossless compression.
1. Application layer is used by computer applications such as google chrome, outlook, FireFox, Skype etc.
2. Application layer defines the protocols that are used by computer applications for example:
HTTP and HTTPS protocols are used by web browsers such as google chrome, FireFox, Safari etc.
FTP protocol is used for file transfer between two or more computers.
SMTP protocol is used for emails
Telnet is used for virtual terminals.
There are dozens of other protocol that forms the application layer, such as NFS, FMTP, DHCP, SNMP, POP3, IRC, NNTP etc.
3. In short you can say that application layer provides the services to computer applications with the help of protocols that are defined in it.