DEV Community

Cover image for The OSI Model explained
Mariam Antar
Mariam Antar

Posted on • Updated on

The OSI Model explained

The Open Systems Interconnection (OSI) is a framework and logical model that has outlined how applications and network systems communicate to each-other by breaking down the different components of network communications into layers. It was developed by the ISO (International Standards Organisation) in 1984.

The OSI model consists of seven layers that allow engineers to identify what is happening within a networking system and helps them to identify or solve a networking problem by looking at each individual layer. It is good to note that the OSI model is more of a theoretical model and not every layer is put into use like the TCP/IP Model which is more of a practical model used by engineers and only consists of four layers. The fifth and sixth layer are blended into the application layer and the data link layer is blended with the with the physical layer.

Alt Text

The OSI model is typically described from the top layer down, so what the end user is interacting with all the way down and is defined as follows:

7. Application - The top layer of the OSI model that is the interface that the user is interacting with the information on like browsers (Eg: Firefox, Brave), outlook for email, virtual terminal etc.

Alt Text

6. Presentation - This layer ensures that the data being sent from the application layer of the client is translated to a format the can be understood by the application layer of the server. When a user is interacting with the Application layer, that sends information down to the presentation layer where the data is formatted, converted, encrypted and decrypted. Data conversion, encryption and compression are the main functions on this layer. For example, If a user wants to upload a video to youtube they must use a certain format like mp4.

Alt Text

5. Session - This layer deals with communication, creating a session between the two computers. When you visit a website your computer creates a session with the server that you're trying to access to get data from and when you exit the website that session is terminated. You can think of this from the perspective of calling a friend. When that friend answers your phone call a session is established between both parties and when your friend ends the phone call that session is terminated.

Alt Text

4. Transport - This layer accepts data from the session layer and splits up the data into smaller segments which contain additional header information such as the destination port number, source port number and a sequence number.

Once created, these segments are sent to the network layer and the transport layer must ensure the bits delivered are the same as the bits sent without loss or duplication. If the transport layer detects a corrupted segment it will try to re-send the damaged data or restart the process from the beginning because the transport layer can also keep track of segments and retransmit those that fail. If no receipt of a segment is present it will time out the connection and throw an error.

This layer is the reason why more than one applications can use the same internet at the same time. When you are communicating with a website this layer decides how much information you will communicate to the website and how much will be communicated back.

3. Network - This layer is the layer that routers operate at, your ip address is at this layer. It looks at the content of the segments sent from the transport layer and adds more header information such as senders ip address and receivers ip address thus data packets are created on this layer. It is all about ip addresses and routing.

Alt Text

2. Data link - The purpose of this layer is to abstract the need for other layers to care about the physical layer and what hardware is being used, switches operate on this layer. When the data packets arrive at this layer more header information such as the MAC address is added to each packet and ethernet frames are created, thus at this level data packets are known as ethernet frames. A MAC address is the physical address for your network interface card or NIC and the NIC is responsible for reading or destroying frames on the receiver side.

Alt Text

- Quick breakdown on the structure of the ethernet frame

The ethernet frame on the data link layer has 7 main parts and it is a structured collection of information presented in a specific order. There are different types of frames, we will focus on the ethernet frame. The preamble tells the receiving NIC that a frame is coming. The last byte of the preamble is the SFD (start frame delimiter) which indicates the beginning of the ethernet frame. The SFD is followed by the MAC address of the recipient, and following that is the source MAC address which is the address where the frame originated from. The ether-type field is next and it describes the protocol of the contents of the frame. Next up is the payload which is the actual data from the high layers being transported. Finally we have the FCS (frame check sequence) which is used for error checking and the integrity verification of a frame.

1. Physical - The final layer is all the physical stuff that connects the computers together like wire, cables, panels etc. It is concerned with transmitted raw bits of data over a communication channel. Protocols at this layer accept frames from the data link layer and generates bits.It sends ones and zeros through network cables, a process known as modulation which allows devices on either end to understand that an electrical charge is either a one or a zero depending on whether copper or fibre optic wires are used. The data travels to the receiver completing a whole cycle of 7 layers.

Alt Text

The protocols on each layer:

Application:
The protocols that the user is dealing with at this level include HTTP, SMTP, POP3, IMAP4, TLS/SSL.

Presentation: Formats data to be viewed by the user. JPEG, GIF, TIF, PNG, MIDI, ASCII, ANSI, SSL, TLS etc.

Session: Establishes and terminates connections between two parties. NetBIOS, PPTP etc.

Transport: Responsible from the transport protocol and error handling, the protocol data unit at this level is called a segment. TCP, UDP, SCTP etc.

Network: Reads the IP address from the packet, the protocol data unit at this level is called a packet. Router, IP, IPSec etc.

Data Link: Reads the MAC address from the data packet, the protocol data unit at this level is called a frame Ethernet, Switches, WIFI, PPP, SLIP,Token Ring, ARCnet

Physical: Coax, Fibre, Wireless, Hubs

Alt Text

Top comments (0)