How does the internet works?

How does the internet works?
  1. What is the Internet?

    So, the internet is like the connection of all devices across the globe. The internet handles all the information sent and received from one device to many devices or maybe one. If you send some message, photo, or video, these are all sent into small packets of data.

  2. Journey of Data . . ./\

    First thing, Let's understand the journey of data transferred from India to Dubai. For this, I am considering that you are at your college's computer science department and using a computer from which you have sent a message via Whatsapp to a person in Dubai. So in the following steps, the data will travel. (It might be possible that sometimes data might skip some of the below steps, but I am considering the longest chain of linkage that I know)

  • The device. (Smartphone, Laptop, PC, etc.)

  • Router.

  • Switches. (If there is the LAN is set up)

  • Local Internet Service Provider.

  • Bigger Internet Service Provider.

  • Submarine Cable. (connected via Mumbai to the country where WhatsApp's server are located)

  • Servers of Whatsapp.

  • Submarine Cable. (From that country to Dubai)

  • Bigger Internet Service Provider.

  • Local Internet Service Provider.

  • Switches.

  • Router.

  • The device.

  1. How does it work?

For a better understanding, Let's get some complicated terms and understand them in easy words and by some real-life examples. Here, below the OSI (Open System Interconnection )model shown, the data can flow from top to bottom or vice-versa:

  • Application Layer.

  • Presentation Layer.

  • Session Layer.

  • Transport Layer.

  • Network Layer.

  • Data Link Layer.

  • Physical Layer.

  • Application Layer: It is more of a software thing, where the users interact with applications. For Example, Web browsers, Whatsapp, Instagram, etc. This layer helps us to easily communicate with the lower layer of the OSI model.

    Protocols are defined sets of rules that are followed when sending the data over this layer, These rules are based on timing, sequences, and error handling. These protocols help to effectively communicate and establish a secure connection over a network. Various kinds of protocols used under this layer are:

  • HTTP. (Hyper Text Transfer Protocol) :

  • SMTP. (Simple Mail Transfer Protocol)

  • FTP. (File Transfer Protocol)

  • DHCP. (Dynamic Host Transfer Protocol)

  • SSH. (Secure Shell)

    Ports: Ports are the thing that tells the server who has requested the data from you. If we say we have 10 tabs opened in Google Chrome Application, how will the server know who has requested the data and which tab I have to deliver it to? So here comes the ports in the picture.

HTTP: So, for this let us understand the client-server architecture.

Here the Client requested the server and the server sends a response back.

So the work of HTTP is to specify how is the client gonna send the request and how the server will send back the response. HTTP is a stateless protocol, the server does not maintain any log about the request made by the client.

Types of HTTP Methods:

  1. GET: When you are requesting something from the server. (File, Image, Video, Links, etc)

  2. POST: When you send something back to the server. (When filling out a sign-up form you send a user ID and Password, When you send images and videos to google drive) this method is used there.

  3. Delete: When you request the server to delete something from its side.

  4. PUT: This method replaces or updates an existing file in the server's database.

Concept of Cookies: These are not the ones you eat, but they are the unique set of strings, (Strings = some lines of codes) that are stored in the client's browser, so that whenever a client visits the website for the second time, the server will know at last time, where the person has left the site and what he was doing. So, the server will send the response back, and that response will contain the previous session's continuation of the client. Many times you visit a website, and they may ask you to enable the cookies or accept them.

SMTP: Simple mail transfer protocol is a protocol that only helps in transferring mail. The receiving of mail is made out through POP3, Post office protocol. Firstly the SMTP establishes a connection between the sender's mail server and the receiver's mail server, if the connection is successfully established then the mail will be sent. If in this case both sender and receiver are using the same mail provider server, such as (Google, Yahoo, Hotmail, etc).

Transport Layer: The transportation of information, or the message within the device from the network layer to the application layer is done by the transport layer. Assume you have opened many applications on your device, So the transport layer will decide where and to which application to send the received data. The transport layer also takes care of congestion control, which is the traffic control of the device.

Checksum: It is a method to analyze whether the sent data to someone is sent without any errors and losses. The sender will in some way calculate the value of the sent data with help of some algorithm and then the receiver also checks the value of the data received, If both are the same then the data is reached without any errors and if values are different then the data received is corrupted.

Protocols in the Transport layer:

User Datagram Protocol (UDP): It is a connectionless protocol which means that the data which is sent over this protocol is not checked, can be corrupted, lost, or might get changed in between transfers. Being connectionless it is very fast used in various places such as in the DNS (Domain Name Service) and DHCP. Some real-life examples are Video conferencing, gaming, etc.

UDP Packet:

Source Port Number (2 bytes)Length of Datagram (2 bytes)
Destination Port Number (2 Bytes)Checksum (2 Bytes)
Data (2^16 - 8 Bytes)

TCP Protocol: Transmission control protocol is a connection-oriented protocol that establishes a connection between the client and server and then sends the data over it. It has the property to send the data without any error and make double checks over the receiving of data. It also has congestion control, basically traffic control. Because the application layer sends a lot of data at once over the transport layer so congestion control is mandatory.

Network Layer: The network layer is a layer in the network architecture that is responsible for routing and forwarding the data packet from one network to another. Its main purpose is to build a stable and efficient connection between the server and client in the best way possible using various algorithms. For example, in easy words, the network layer is the traffic manager of the internet it decides where and how to send the data from your device to the destination.

Network Layer's Protocol :

Internet Protocol :