DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Basic OSI
Katerina Braide
Katerina Braide

Posted on

Basic OSI

What is OSI?

OSI stands for Open System Interconnection, it’s a conceptual framework for how application communicate over a network. The purpose of the OSI model is to facilitate communication between different systems without requiring changes to the logic of the underlying hardware and software. OSI has a stack of seven layers within the model and the layers are used to help user identify what is happening within a networking system.

What is OSI layer?

The OSI layer are typically described from the top layer down. With the help of layering we decompose the problem of building a network into manageable components (layers), these layers help with modular design and easy troubleshooting. Going down and up the stack is called encapsulating and decapsulating respectfully. The layers are:

7- Application
6- Presentation
5- Session
4- Transport
3- Network
2- Data link
1- Physical

These layers are provided by a mixture of network card drivers, application, operating system, and networking hardware that enable the transmission of signals over WI-fi, Ethernet, fiber optic, and other wireless protocols. We’ll describe the layer from the top down as the top layer is the application layer or layer 7.

Layer 7/Application: This is the layer that users interact with. The application layer provides protocols as network services to the end user, that work with the data the client is using. An example of these protocols may be Hypertext Transfer Protocol (HTTP) that is used with web browsers such as google chrome and internet explorer. Another example is Simple Mail Transfer Protocol (SMTP), a protocol for emails and such, All of those interactive application provide a set of services that allow the application layer to supply data to and receive data from the presentation layer.

Layer 6/Presentation: This performs the task of syntax processing or converting data from one format to another. For example, consider you are buying a concert ticket. These transactions are handled in a secure transmission which means that the data passing between the website application will transmit encrypted data to the presentation layer that will need to be decrypted and processed. This layer translates the data from the top layer, which is presented in application format, to network format and vice versa. After the presentation layer processes the data and changes it’s format from one to another, the information is then passed to the session layer or the application layer depending on if the data is transmitting or receiving.

Layer 5/Session: This is where the conclusion of connections between devices occur. This layer supports multiple types of connections as well as being responsible for authentication and re-connection when and if a network interruption occurs. After this session is established the data then passes to or from the transport layer.

Layer 4/Transport: This is responsible for the transmission of data across network connections. This layer coordinates how much data to send, speed of data, direction of data, and such. These services may be provided by Transmission Control Protocol (TCP) and User Data-gram Protocol (UDP), which are the most widely known protocols for internet applications. Other protocols may provide additional functionalities such as error recovery and re-transmission. Once the transport layer has completed it’s function, the data is then passed to or from the network layer.

Layer 3/Network: This handles the routing of the data. After the data gets to this layer, each frame of data is examined to check if the data has arrived at it’s ultimate target. The layer sends data to the correct destination on outgoing transmissions and receives incoming transmissions as well. The IP portion of TCP/IP is the commonly known network layer for the internet. This layer also manages the mapping between logical addresses and physical addresses, for IP addresses, this is accomplished through Address Resolution Protocol (ARP). The data is then passed to the next required layer.

Layer 2/Data link: This layer is often divided into sub-layers called Media Access Control (MAC) or Logical Link Control (LLC). The layer sets up links across the physical network. When this layer receives data from the physical layer, it checks for transmission errors and then packages the bits into data frames. From there, this layer manages the physical addressing methods for MAC or LLC layers. An example of MAC layer includes 802.11 wireless specifications as well as Ethernet. At the data link layer, the data passes to or from the final layer.

Layer 1/Physical: This is the electrical layer of the model. This layer includes all the network cables, wireless radio frequencies, receivers, repeaters, connectors, transceivers, pulses of light, electric voltages, power plugs, cable pin-outs, etc. When troubleshooting problems, this is the first place to start. Is the device plugged in? Is the wireless card working? At this layer, the model transmits the digital data bits from source or sending devices physical layer, over network communications media, which can be electrical, mechanical, or radio, to the receiving or destination devices physical layer.

Layer 7, 6 and 5 can be grouped in, the sole responsibility for the three of these is to produce protocol data unit (PDU) for the transport layer.

How the layers work!
Let’s say you send an email, the data travels through the OSI model, adding and processing data on each layer, this process is called encapsulation

  • step 1: Our work creates the data. the email you wrote, the email addresses, etc and gets ready to send it using Simple Mail Transfer Protocol (SMTP).
  • Step 2: The data is formatted in a way the receiving device will understand, in this example let’s say QsR3@4Fgg. This layer could also encrypt the data if needed.
  • step 3: A session with receiving mail server is started.
  • step 4: This is where it decides to use TCP or UDP. In this example we’ll use TCP to make sure every packet gets delivered also the source and destination port is added to the data.
  • step 5: The IP address of the mail server is added as the destination and the source IP address is also added to the data.
  • step 6: The MAC address of the router and the source MAC address of the host is added to the data.
  • step 7: The data is sent out on the network using Ethernet so when the data reaches the other side the receiving device will process the data in the same way but in reverse starting from the bottom up.

OSI helps with troubleshooting!
It’s easier to diagnose the problem with the network if you go through this model, checking every layer step by step for example, layer1: are all the cables plugs in? is the network card functioning?. Layer2: is the switch bad?. Layer3: is the route functioning? Do i have the correct address? And the process goes on and on from there

conclusion
The OSI model is more of a reference, a guideline for developers and vendors to smoothen the delegation of responsibilities to enable us understand what the communication process entails and the progress of developing communication products and software programs that will work in cooperation with a commonly established model. Once you understand the model, you can then understand which protocol and devices will be compatible with one another.

Top comments (2)

Collapse
 
azubuikeduru profile image
Azubuike Duru

It’s a good read. It’s basic too

Collapse
 
divofred profile image
Fredrick Emmanuel

πŸ€—πŸ€—

Timeless DEV post...

How to write a kickass README

Arguably the single most important piece of documentation for any open source project is the README. A good README not only informs people what the project does and who it is for but also how they use and contribute to it.

If you write a README without sufficient explanation of what your project does or how people can use it then it pretty much defeats the purpose of being open source as other developers are less likely to engage with or contribute towards it.