Day 004 #FromZeroToHacker – OSI Model and its layers

One of the basics of “How this whole think of the internet” works: OSI Model

What it is? How important it is? What’s going on with those “layers”? Let’s learn it today in #FromZeroToHacker.

Table of contents
Introduction
What I have learnt today?
Stats
Resources

Introduction

The OSI model (Open Systems Interconnection model) is a fundamental model used in networking and coordinates all the standards for the purpose of systems interconnection: From the computer to routers, switches, and more:

7 layers of the OSI model

What I have learnt today?

The OSI model (Open Systems Interconnection model) is a fundamental model used in networking. It provides a framework dictating how all networked devices will send, receive and interpret data.

The OSI model consists of seven layers, and each layer has a different set of responsibilities.

OSI Model and its 7 layers

Layer 7 – Application

This is the layer that probably you are most familiar with, as this is the layer where protocols and rules are in place to determine how the user should interact with the data sent or received in Layer 6.

Everyday apps such as email clients or browsers, present data in a friendly GUI (Graphical User Interface).

Layer 6 – Presentation

This layer acts as a translator for data to and from the application layer (Layer 7). This layer presents the data to its users in a form that can be easily understood.

The layer also performs data encryption at the sender’s end and data decryption and the receiver’s end.

Layer 5 – Session

Once data has been formatted from the presentation layer (Layer 6), this layer lets the user of different platforms set up an active connection session between themselves, providing a needed synchronization for efficient data delivery without any loss.

Sessions are unique: Data cannot travel over different sessions but between their own.

OSI Model: Layer 5 Session

Layer 4 – Transport

This layer in the OSI model is a vital part. And a difficult one to understand.

When data is sent between devices, it follows one of these two protocols:

  • TCP
  • UDP
TCP
OSI Model: Layer 4 Transport TCP

Transmission Control Protocol, or TCP, was designed with reliability in mind. This protocol reserves a constant connection between two devices. This is very important to understand.

TCP also incorporates error checking into its design, to guarantee that data sent (packets) are received and reassembled in the same order on the receiving end.

Advantages

  • Guarantees the accuracy of data sent
  • Synchronizes two devices to prevent data flooding
  • More reliable

Disadvantages

  • Requires a reliable connection between two devices; otherwise, data won’t be sent.
  • A slow connection can bottleneck another device
  • TCP is slower than UDP

TCP is good for file sharing, internet browsing, or sending an email or a photo: When we need ALL the data (imagine receiving half of an email or a file!).

UDP
OSI Model: Layer 4 Transport UDP

User Datagram Protocol, or UDP, is not as advanced as its brother (the TCP). It has a load of disadvantages, such as a lack of error checking and reliability: Data sent may get lost. There isn’t even synchronization between the two devices. Just wishful thinking.

While it sounds awful, it has some advantages:

Advantages

  • UDP is faster than TCP
  • UDP leaves the application layer (Layer 7) to decide how to control how quickly packets are sent
  • UDP does not need a continuous connection on a device

Disadvantages

  • UDP doesn’t check if the data sent is received
  • An unstable connection is an awful experience for the user

When is useful UDP? When speed is more important than accuracy. For example, when video streaming. Losing data just means parts of the video are pixelated, instead of disconnected or slowing down everything.

Layer 3 – Network

The network layer is where routing and re-assembling data takes place (from packets to the file).

Routing means finding the most optimal path that the packets should be sent. The most used protocols to this end are OSPF (Open Shortest Path First) and RIP (Routing Information Protocol). When finding out which route is best, important factors to take into account are what past is the shortest, what is the most reliable, or which one has the faster physical connection.

Devices capable of sending packets are known as Layer 3 devices, such as routers.

OSI Model: Layer 3 Network

Layer 2 – Data link

Data link layer focuses on the physical addressing of the transmission.

It receives a packet from the network layer (Layer 3), including the IP address of the remote computer, and adds the MAC address of the receiving endpoint.

Data link adds the physical address to the packages, along with the IP address of the device.

Layer 1 – Physical

This layer is the one related to the physical components of the hardware used: Ethernet cables, hubs, etc.

Stats

From 397.489th to 330.534th. Not bad! I don’t know when it will stop going so fast, but I like it.

Here is also the Skill Matrix:

Resources

Path: Pre Security

Network Fundamentals

TryHackMe: OSI Model

Other resources

7 Layers Of The OSI Model (A Complete Guide)