Open System Interconnection Model


OSI Model defines and is used to understand – how data is transferred from one computer to another in a computer network? In the most basic form, two computers (end-points) connected to each other with LAN Cable (Network Media) and connectors (RJ45) sharing data with the help of NICs forms a network. But if one computer is based on Microsoft Windows and the other one has MAC OS installed, then how these two computers are going to communicate with each other? In order to accomplish successful communication b/w computers or networks of different architectures, 7-layered OSI Model or Open System Interconnection Model was introduced by the International Organization for Standardization in 1984.
  • Application Layer
  • Presentation Layer
  • Session Layer
  • Transport layer
  • Network Layer
  • Data Link Layer
  • Physical Layer
APPLICATION LAYER:- It is used by network applications like google chrome, firefox, outlook, skype, etc..
  • Application layer provides services for network application with the help of protocols to perform user activities.
  • Protocols:- DNS,DHCP,SMTP,HTTP,HTTPS 
Types of attacks on application layer:- RAT, Malware.

PRESENTATION LAYER:- In this layer, it includes three types conversion, compression and encryption
  • Conversion:- For example, ASCII to EBCDIC.
  • Compression:- It reduces the number of bits that needed to be transmitted on the network.
  • Encryption:-In this layer the data is encrypted. The encrypted data is known as the cipher text and the decrypted data is known as the plain text. A key value is used for encrypting as well as decrypting.
  • Protocols:- SSL,SSH,IMAP,FTP,MPEG,JPEG
Types of attacks on presentation layer:- finding the key value.

SESSION LAYER:- Session layer helps in setting up and managing the connections enabling sending and receiving followed by termination or session, the data In this layer, it includes three types Authentication, Authorization and session management
  • Authentication:- Authentication is the process of verifying who you are. server performance authentication. once the user name and password is match and their by connection or session is established between your computer and the server.
  • Authorization:- Authorization is the process used by the server to determine whether you have access to use the file or not.
  • Session management:- session layer keeps a track on files that are being downloaded. for example a webpage contain text and images etc..these are stored in a separate folder in a server. when you request a website in a web browser, your web browser opens a separate session to download these each of these texts and images files separately, these files are received in the form of data packets. and this session layer helps that file which it belongs to wether it belongs to text or image files. And tracks where the received data packets go.
  • Protocols:-API's, Sockets,WinSock
 Types of attacks on the session layer:- phishing attack
TRANSPORT LAYER:- The transport layer controls the reliability of communication through segmentation, flow control, and error control.
  • Segmentation:- In segmentation data received from the session layer is divided into small segments, each segment contains source and destination port numbers and port number helps to reach the correct application and the sequence helps to arrange in correct order.
  • Flow control:- The transport layer controls the amount of data being transmitted.
  • Error control:- If some data is missing the transport layer uses automatic repeat request to retransmit the data, a group of bits called checksum is added to segment to check whether the data is received.
  • protocols:-TCP, UDP 
 Types of attacks on the transport layer:- Firewall attack

NETWORK LAYER:- Network layer helps to transfer the received data segments from one computer to another computer located in different networks. It consisting of logical addressing, routing and path determination
  • Logical addressing:- In this layer, the data packets are sent by using IP address from one network to another network.
  • Routing:- Routing is the process of moving data packets from source to destination and it is based on the logical address.
  • Path determination:-  A computer that can be connected to an internet server in a number of ways. choosing the best path to connect to the internet server.
  • protocols:-IPv4, IPv6
Types of attacks on the Network layer:- IP spoofing

DATA LINK LAYER:- In this layer, the mac address is attached to a data packet and form a frame.
data unit in the data link layer is called frame.
  • protocols:- Ethernet, PPP, switch, Bridge
 Types of attacks on the data link layer:- Sniffing attack

PHYSICAL LAYER:- Physical layer converts this binary into signals and transmits over local media.
  • protocols:- Fiber, wireless, Hubs, Repeaters
Types of attacks on the physical layer:-USB


Different type of interview questions on OSI layer:-

1. What is the importance of the physical layer in the OSI model?
A:-Physical layer which is the first layer in the OSI model, which is responsible for sending bits from one device to the another. It deals with the setup of physical connection to the network and with transmission and reception of signals.

2. Authentication comes into the picture in which layer of OSI?
A:- Session layer is responsible for session management, authentication, and authorization.

3. Which layer of OSI is responsible for flow control?
A:- Transport layer 

4. What is the difference between half-duplex and full-duplex?
A:- Half-duplex:-The communication between sender and receiver occurs in both directions in half-duplex transmission, but only one at a time. For example, in walkie-talkies, the speakers at both ends can speak, but they have to speak one by one.  They cannot speak simultaneously.

Full-duplex:- In full-duplex transmission mode, the communication between sender and receiver can occur simultaneously. For example, in a telephone conversation, two people communicate, and both are free to speak and listen at the same time.

5. Which layers perform error detection?
A:- Data link layer performs error detection.

6. Which layer does computer works at?
A:- computer works on all the layers of the OSI model.

7. What is the difference between layer 3 switch and router?
A:-Switch:- is efficient only inside a network.. Switch functions on Mac address.
Router :-works outside the network. Functions on ip address.

8. In which scenario Encryption and decrypting will work?
A:- Encryption is used for maintaining the integrity of the data. So whenever data is sent through https medium data will be encrypted and only at the genuine receiver decryption will happen to convert data into original form. Encryption and decryption will be done at presentation layer of osi. All the data sent through https medium will be encrypted.

9. Firewall works at which layer?
A:- firewalls are used to protect your internal/private LAN from the Internet. A firewall generally works at layer 3 and 4 of the OSI model. Layer 3 is the Network Layer where IP works and Layer 4 is the Transport Layer, where TCP and UDP function.

Are there any alternatives to the OSI Model? If yes, define i