Conceptual models to understand networking

This is second blog in the series - Networking: How internet works. so make sure you had read the first one. Previously i explained the general overview of what happen when you connects to internet and make request, from request to response, and we got the idea of how things works. This blog will be focusing on the conceptual model for understanding this process. This blog will work as bridge between in detail explaination we will see in the further series.

OSI and TCP/IP are Conceptual models

We have 2 famous Conceptual models to understand the process of networking. OSI and TCP/IP model. why i didn’t included them in title was intentional. because, it is very important to emphasize the term: “Conceptual model“. This models divide the process of networking into layers, to understand it. OSI model provides 7 layers and TCP/IP 4 layers. OSI is not the process. It is model, not real, A conceptual model to understand the process of networking. There is no such 7 layer in the process. We divided the process in conceptual way to understand it, in 7 parts. TCP/IP model has 5 layers, These models are not separate methods for networking but theoretical concepts for understanding how the internet and data transmission work.

OSI stands for - Open System Interconnection, designed by ISO - the International Organization for Standardization (ISO) that provides a common basis for how networking should happen. The Internet protocol suite, commonly known as TCP/IP, organizes the set of communication protocols used in the networking according to what it does. So in general both works as framework to understand the networking. First we will see the 7 layers of OSI model and then compare how it matches with TCP/IP model.

7 Layers of OSI model

I personally like to go through from application layer to the last layer: physical layer. And before we begin, keep in mind the example we were taking from the start - requesting google.com from Laptop which is connected to hotspot of mobile.

  1. Application layer: This is where network services and end-user applications operate. In our example, when you type "google.com" into your browser, the request is initiated at the Application layer using HTTP/HTTPS. This layer interacts directly with the web services, sending the request to Google's server and receiving the response, which is then displayed in your browser. All web pages at root are made of HTML and static files and media files which are included in HTML. Standard protocol to transfer this HTML files over the internet which you can see as a layout, is HTTP and HTTPS. which are application layer protocol

  2. Presentation Layer: Think of this layer as the translator, making sure data is properly formatted and secure. When you’re sending an HTTPS request to Google, this layer encrypts your data before it hits the road, keeping it safe from prying eyes. even though this encryption is regarded in presentation layer, it is not hard coded rule that it should be in this layer. it could be done in application layer or even in the session layers. that’s why from start i emphasized on the term: Conceptual and will do that again and again. Serialization and deserialization: converting objects into formats like JSON and XML also done in this layer.

  3. Session Layer : This layer manages the sessions or connections between applications. For example, it maintains the session between your web browser and Google's server, ensuring that all communications during this session are synchronized and managed properly.

  4. Transport Layer: Transport layer either recives the data from application-presentation-session layer and send it to network layer furtrher, or vica versa. In both cases, transport layer ensures that data is transmitted reliably and in the correct sequence. When your PC sends a request to Google, TCP (Transmission Control Protocol) at this layer ensures that the request you made reach at the correct ports and from that to the network gateway. Remember ports and network gateway we discussed previously? We do not transfer 20MB data in one flow(Like obviously), all the data gets divided into chunks of kb or bytes - called data segments. It ensures that data segments arrive intact and in order at Google’s server. How this segments of data transfer take place, based on that we have protocols in this layer. When response from google server come back to your network gateway address it reaches the perticular port(HTTPS: 443 in our example) and ephermal port of your browser tab. And the segments of data gets recombined and hands over to the application-presentation-session layer. We have so much to discuss on this layer in upcoming blogs.

  5. Network Layer: This layer is responsible for IP addressing and routing the data across networks. Identifying and keeping track of the local devices through local IP address, managing them, forwarding requests to the next public network with the best path possible - routing, is the job of this layer. This layer either receives the data segments from transport layer and transfer them to data link layer or vica versa. in our example, when request of “google.com“ made from Laptop it reaches to network gateway. This process of assigning IP address to laptop by your mobile, acting as network gateway, replacing the local IP of laptop with public IP of mobile, can be viewed in this layer. Now data segments of request will be reached at network gateway, This layer will add aditional information like IP of source of request: mobile in our example, and server: google.com, and many more which we will look into details in the series further. this will be handed over to data link layer. At the server side, This layer works same but vica versa, getting the data from data link layer and forwarding to the server IP & then Transport layer. Again when request will come to the data link layer of our mobile, the reverse process happen. identifying the Local ip of laptop and sending the data to it. This layer also we will discuss in detail.

  6. Data Link Layer: This layer ensures error-free data transfer between two directly connected devices. For instance, when your PC communicates with your mobile via Wi-Fi, the Data Link layer handles the framing of data and manages the MAC addresses to ensure the data is sent to the correct device within the local network. MAC addresses are physical address of the drivers on the device. Just like how ports used for identify the service in application, IP used for identifying devices in local or public network, MAC addresses used for identifying driver of the devices at physical level. Like there may be multiple devices connected to hotspot, so this layer basically keep MAC addresses of everyone to identify that devices withing that hotspot range(LAN). Also note that, for Bluetooth there is different MAC address, obviously data type of sound let’s say, how do we know at which address to send, and at which driver? HTTP request to bluetooth? LOL. To the Bluetooth adapter or wifi? So for each type of network there is different MAC address as different drivers.

  7. Physical Layer: This is where the physical connection between devices happens. In our scenario, this includes the Wi-Fi connection between your PC and your mobile device, and the cellular connection between your mobile and the ISP's network. It's responsible for the raw data transmission over these physical mediums. Analog signals -> binary and binary -> analog. Because 0 and 1 can’t fly or transmit through wires over the network. Easy? Pretty eazy…

Relating OSI to TCP/IP model and conclusion

As we discussed OSI, it divides the networking process into layers based on which tasks take place. Very similarly TCP/IP also divides networking process based on the protocols used. In each layer there are perticular protocols being used, based on that it has 4 Layers: Application, transport, network, link layer. Application layer can be viewed same as application-presentation-session layer. The whole idea of this 3 layers shares the same characteristics, so it’s an one combined layer in TCP/IP. transport and network both same as in OSI. Data link layer and physical layer is also an one combined layer in TCP/IP as link layer.
So for the ease we will be using TCP/IP model for conceptual understanding.
In this series next 2 blogs will be: Application and transport layer, Network and Link layer.
The main layers for understanding internet is transport and network layer, so they will be focus of our next blogs

Thank you for reading. suggetions appriciated.