Networking 101: The OSI Model

 In the last couple of writeups, we talked about various things related to protocols, IP addresses, MAC Addresses, etc. We used the term layers and we talked about various layers like layer 2, layer 3, etc for various terms and protocols and addresses. Here's where all these layers lie and it is the model that comprises of and gives information about these layers. We are going to talk about the OSI Model.

OSI stands for Open System Interconnection and as the name suggests OSI model sets standards for the systems that are open to communicating with other systems.

Sometimes during technical discussions, a switch may be referred to as layer 2 or a router as layer 3 so it is extremely important to have a good idea about the OSI model.

The OSI model comprises 7 layers.

An easy way to remember them is a sentence that goes like

A Penguin Said That Nobody Drinks Pepsi. (Top to bottom order)

(If you're a Pepsi lover please don't get offended this is just for the sake of remembering the model. :P)

Here are  the layers


Let's discuss each layer one by one.

Physical Layer

The physical layer looks after the connectivity of devices. It includes devices such as coaxial cables, cat6 cables, and many such data cables.
It also looks after the physical delivery of data between various devices.
It does the work of converting data into bits or byte streams so that it can be made ready for transfer.
Devices such as Hubs, Modems, Repeaters, antennas, cables, etc., and protocols such as wifi, ethernet, and many more are included in the physical layer.
Moreover, various network topologies eg. Ring, Star, Mesh, etc, and modes such as full-duplex, half-duplex, and simplex also fall under this layer in addition to various signal frequencies and voltages required and things related to the physical transmission medium such as modulation.

Datalink Layer

The Datalink layer does the work of converting the bits, byte streams formed in the (Physical Layer) into Frames.
It's like the data gets into a vehicle that has the algorithms to find out the proper route to the destination. 
Thus data link layer does the work of determining the transmission path between two nodes.
It also looks after Physical Addressing (Determining source and Destination) and Flow Control.
Switches are a part of the Datalink Layer.
Protocols like PPP, HDLC, SDLC, LAP, NCP, LCP, etc fall under the datalink layer.
Datalink Layer can be divided into two sublayers:

  •  LLC Sublayer

LLC stands for Logical Link Control.
This layer looks after flow and error control so that data to be transferred to the other node is accurate and flows in a controlled way.  

  •  MAC Sublayer

MAC stands for Media Access Control.
As the name suggests it looks after which device can access or control media and hence it does the work of managing permissions and access while transmitting data from one node to another.
It makes sure that data is sent sequentially and an acknowledgment is received.


Network Layer

Now that we have the data and know where to send it among networks it's time to expand our limits. Let's prepare to transmit the data from a network to another.
Worried about how to do it? Don't worry Network Layer got your back!
Consider the data link Layer as a  transport operator eg. Any bus travels, Any airline, etc. they help you to move from one city or state to another and provide you the best possible route for the same.
Similarly, Network Layer does the work of finding the best path for you to send your data from a network to another keeping in mind the factors such as network characteristics, traffic controls, shortest path, priority, data congestion, etc.
It uses logical addressing techniques to distinguish between the source and the destination address.
Routers are a part of this layer.
Protocols such as IP, IPSec, IGMP, and ICMP are a part of the Network Layer.
The frames from the Datalink Layer are converted to packets and made ready for transmission.
A node gets its IP Address at this level.
It also has functions of fragmentation and encapsulation and error handling.
The data to be sent is converted to packets whereas the data which is received is reassembled into a form that can be understood by the application layer.

Transport Layer 

Since we're ready with the routes let's do the transport job! How? We just need to call our friend Transport layer.
The Transport Layer fulfills the responsibility of delivering the data packets completely and reliably.
The Transport Layer has the functions of error, flow, and congestion control so that it can keep track of the data packets, check for errors as well as duplicates.
It makes sure that whatever packet it sends is sent in response to a service via ports.
It includes the very famous TCP and UDP protocols.

Session Layer

Session Layer is the layer where the two devices meet, coordinate, and transfer the data.
The session layer takes care of establishing, ending, and re-establishing a session as well as looks after authorization and authentication. It identifies operations and helps in the coordination of data streams.
The session layer comprises of protocols such as RPC, PPTP, SCP, and SDP.
The session layer takes into use sockets, APIs, etc.

Presentation Layer

The presentation layer looks after the syntax, encoding, encryption, decryption, compression of data.
It is further divided into 2 protocols.

  • TLS
TLS stands for Transport Layer Security.
It looks after privacy and integrity between two applications.
It also used to protect information transmitted between browsers and Web Servers.
  • SSL  

SSL stands for Secure Socket Layer.
It is an internet security protocol used to transmit sensitive data between browsers and web servers.


Both SSL and TLS work on the CIA triad. (CIA triad stands for confidentiality, integrity, and availability)

It also has protocols such as SSH, IMAP, FTP, etc.


Application Layer

Application Layer sits at the top of the OSI model and comprises of all that you can actually see on the screen be it E-mail, data sharing, file transfers, file management directories, etc.
It also takes care of end-user application management, determines the availability of resources, manages network requirements, communication synchronization, etc.
It also looks after constraints like syntax, privacy, networking devices, quality of service, and authentication.
Protocols such as HTTP, HTTPS, DNS, SMTP, etc are a part of the Application layer.


 
An example of usage can be as under:
Suppose you are a computer helpdesk and somebody calls and asks you that his internet is not working.
You have to help him troubleshoot the issue.
What will be the first question that you'll ask him? Will it be "Hey can you please  check your DNS settings?" Definitely not!
You will follow the bottom to top approach.
You'll begin with "Can you please check if the ethernet cable is plugged?", "Do you see a green light over there around the cable?", "Can you tell me the current situation of your switch/router" and so on.

Remember: Whenever data is sent it travels from layer 1 to Layer 7 whereas when data is received, it travels from Level 7 to Level 1. 

If you like the content then do consider connecting with me and pour your knowledge into my DM!!😇 

Instagram: bhavak_29

LinkedIn: https://www.linkedin.com/in/bhavak-kotak-3b6b071b1/

:NOTE:

All the images belong to their respective owners.

I am a learner so I learn things from different sources and I DO NOT claim that any of the content(if it does) belonging to someone else as mine.

Also a huge thanks to Heath Adams(AKA The Cyber Mentor). It is because of his course that I am motivated to put this content here and I have taken inspiration from his videos to a considerable amount of extent and tried to convey what I understood in the best way possible.









Comments

Popular posts from this blog

Defeating RootME

TCS HACKQUEST PLAYGROUND WALKTHROUGH

OWASP TOP 10 Explained