How the internet really works?

Internet network map representing less than 30% of internet

Internet is the backbone of the web. According to internet live stats, there are currently more than 4.5 billion people using the internet.

We use internet everyday, but do we actually know how it works behind the scenes? Let me take you step by step and make you understand how internet actually works so that you can be one of the few who actually understands how internet works. Let's get started!

What is the Internet?

Internet is a connected network consisting of simply a wire buried in the ground which lets computers or servers connect with each other. It can be a fiber optic cable or even a copper cable as well. Do not believe me? See it yourself in the below picture.

Internet backbone. World connected with wires transferring data.

The above picture which you just saw depicts that the whole world is just connected through wires and all the information and data is exchanged through wires only. If you want to see the the map and the wires connected with any country yourself, I've placed a link in the credit section of this post.

Okay, that was simply about what internet is. But how actually it works? How we are able to access any website just sitting at our homes? Let's take a look into that.

Now that you've an idea that internet is just a connected network of wires, let us see the whole picture how data gets transferred from these wires to your devices.

This happens behind the scenes when you click on any URL.

Okay, the picture says a lot, let's break it one by one.

  1. Browser - The application from which you access various websites. Example - Google Chrome, Mozilla Firefox, etc..
  2. ISP - An ISP (Internet Service Provider) in a nutshell is a company which gives you access to the internet through just 1 wire/medium. ‌‌Let's say you visit 'X' number of websites daily and it is quite possible that those 'X' number of websites are hosted on different servers (more on servers in next points) in different countries. Now, would you want to have a cable for each of the websites you visit? No, right?
  3. DNS - DNS (Domain Name System) is a distributed database which keeps tracks of domain names and their corressponding IP addresses. ‌‌DNS plays a very crucial role in the internet as it helps us to access a webpage by simply typing a domain name `www.google.com' instead of their IP address `216.58.203.36` . Without DNS, our brains would have been filled with numbers, just trying to remember the IP addresses of the websites that we visit.
  4. Server - In simple words, a server is a computer program or a device that provides data to another computer and it's user. A server can be of various types such as Web Server, Application Server, etc...‌‌In our scenario in the picture, the google servers enact as web servers which essentially are serving us the HTML, CSS and Javascript files.

Now, as we know about the individual components involved in the whole process, let's jump right onto how these individual components interact with each other and provide us the internet.

What happens when you click on a URL?‌‌
Let's take a real life example first. Let's say your exams are going on and you have a major exam tomorrow, but wait, you notice something is missing. Oh, you don't have your Unit-5 and Unit-6 notes. Chill, no need to panic, you've your best friend 'Rohan' which has you covered. You know that 'Rohan' is very intelligent that he must have studied already, so you decide to go to Rohan's house and ask for notes so that you can study as well.

What are the steps you'll follow?

  1. You look for Rohan's address in your address book. You search for Rohan in your address book and you find his address.
  2. You go to Rohan's house and ask for the notes, he happily gives you his notes because a. he is your best friend,  b. He had already studied all of the syllabus as you thought. 😉
  3. You know have the notes and can study as much as you want.

Similarly, when you enter a URL in the address bar of your browser and press enter/go, the following process occurs:

  1. Your request goes through your ISP to the DNS to find the address of the domain just like you reached out to the address book to look for Rohan's address.
  2. DNS behaves like the address book and gives you the IP Address of the domain where you can get all the files that you've requested.
  3. After the browser has the address of the server, the request goes to that server and fetches all the required files and returns back to you with the content which was returned.

Now, if you have read and understood the concept shared in this post, trust me, you're one of the few individuals that actually understand how internet works!

BONUS: Interesting FAQs

Q1. Does the request always have to go through the DNS?‌‌
A1. The short answer is No. There are caches maintained at various levels such that you do not have to always reach out to the public DNS to find the address of the website that you want to visit. ‌‌To find a DNS record, the browser checks four caches‌‌ -

a) Browser cache:  A browser maintains a storehouse of DNS records for a fixed time duration to quickly fetch the address.‌‌

b) OS cache: If the DNS record is not found in the browser cache, the browser initiates a system call to look for the DNS records in the store of your operating system to find the address of the DNS record.‌‌

c) Router cache: If even the operating system cache does not have that specific DNS record, then the search is forwarded to the router cache, because a Router also maintains it's set of DNS records cache as well.‌‌

d) ISP cache: If the router fails to provide the required DNS record, then the search is forwarded to the DNS records cache maintained by ISP.

e) Recursive search: When even the ISP cache fails to return the DNS record, then the recursive DNS search query is triggered which continues to hop to various public DNS' to finally either get the address or an error response stating it was unable to find any address.

Q2. Can I be my own ISP, I am ready to do whatever it takes?‌‌
A2. Absolutely, you can be your own ISP. But, there are various costs that you'll need to bear because, even ISPs need ISPs. The internet is a very large connected network. Ultimately, you'd need a backbone connection to connect to the actual internet servers.  

Please, share if you liked the post and subscribe if you loved it! 💓

Credits: ‌‌
Internet network map image.‌‌
Internet backbone.


Thanks. That's it for now! Let's see you in the next detailed concept post and don't forget to subscribe.