How websites works in simple language. How DNS Works.

23-Dec-2023| 15min Read

In this tutorial, we will try to understand: when we type any website in the browser, like www.facebook.com, www.google.com, or any other website, what will happen? We will learn in this tutorial how a request goes to the server, how a response is received, and what steps it will go through.

As we discussed in our last tutorial, the first module will be ‘client’. The devices that reside with the user are called client devices. The software that runs on these is called client software; one of the examples is ‘browser’.

 

Let's see what happens when we type any website name (example: https://www.facebook.com).

Https is the communication protocol. Protocol is nothing but ‘the set of rules’. For example, if I'm communicating with you in the English language, there will be a few grammar rules that I need to follow to speak or write in English. In the same way, https is the set of rules for communication on the web. We will discuss this topic more in future tutorials.

Let's get back to www.facebook.com. It is the domain name; we can call it a website name. What is this domain name? This is the address of the server. www.facebook.com is the address of Facebook’s server, and www.google.com is the address of Google’s server.

But there is one problem here: these English words, www.facebook.com or www.google.com, are for us humans to remember; we cannot directly connect to the server with these English words.

For example, your friend has written his ‘home address’ on paper, but in some other language, let's say in Chinese. If you don't know that language, then what will you do? You will contact someone who knows Chinese and ‘your language’ so that he can help translate the address to your language.

In the same way, www.facebook.com/google.com needs to be translated so that clients can contact the server. What is this translation? It is the IP address. Every device that is connected to the internet will have an IP address, and they are unique.

Lets see how the browser gets the IP address from the general english address(i.e www.your-website.com).

how-websites-work

The first browser checks whether it has the website domain’s IP address or not. If it has, then the browser directly sends the request to that IP address Server. If not, it will ask the ‘Operating System (O.S.)' (windows, mac, etc) whether it has an IP address for that specific website.

If it has, then it will return to the browser, and the browser will send a request to that IP address. If not, the request will go to ‘Router’ to check whether that specific website IP address is present in the router.

If the router has it, then it will return. If not, the request will go to the ‘Resolver Server', usually the Internet Service Provider (ISP). ISPs are the ones who provide Internet connections to our homes and offices.

Now the ISP’s ‘Resolver Server’ checks whether it has the IP address of that specific website. If it has, then it will return that IP address; if not, the request will go to ‘Root Servers’.

Root servers are the servers in this world that will keep track of certain information. Usually, there will be around 13 servers acting as ‘Root Servers’. In fact, there are not 13 servers but rather 13 clusters of servers; each cluster may have multiple servers. But in general, we call it 13 servers.

One of the ‘Root Servers’ will respond, saying, ‘Dude, I don't have the exact IP of your website; rather, I have the IP address of the last word that you sent, i.e.,.com/.org/etc. ‘.

That IP address will be sent back to ‘Resolver Server’ (ISP).

 

Now the resolver server sends a request to that IP address server (TLD server), which was received from the root server.

Now this TLD server responds, saying, 'Dude, I don't have the exact IP of your address; rather, I know another server (an authoritative server) that may have your IP address’. It (the TLD server) will send the IP address of that server (the authoritative server) to the resolver server.

Now the resolver server sends the request to that authoritative server. Now this server checks that website name and responds with the IP address.

If it also doesn't have an IP address, then it will provide the IP address of another server to contact; the same happens until the IP address of the website is found.

The process of converting a website domain to an IP address using various modules falls under DNS. DNS stands for Domain Name System.

 

Now that the resolver server (ISP) has received the IP address of the website, this IP address will be sent to the 'Router'. The router saves it and sends it to the ‘Operating System', and it also saves and forwards it to the 'Browser'. Now the browser sends the request to that ‘IP Address’.

Next time, if the same address is typed in the browser, the browser will check its cache, and if it exists, it will send the request to that IP address. If not, the same will follow, i.e., the operating system, router, resolver server, root server, TLD server, authoritative server, etc.

Now that ‘Browser’ sends the request to that server, there will be three handshakes happening here. To make it simple for you, facebook.com or any website’s server will say, ‘Are you listening’, then the client will say, 'Yes, listening', and then that website server will say, ‘It's okay, let me form the connection’. If you observe here, there are 3 conversations, so we call them 3 handshakes (making you understand in an easy way; there is more complex stuff here).

Now that website’s server will return various resources like HTML files and subsequently CSS files, javascript files, and other media files, and so on. In future tutorials, we will discuss this topic more.

This is what happens from the point we enter the website address to the end of showing the website content.

In our next tutorial we will learn what is the API and how it works, what are HTTP Methods, etc.

Download / Share on:
left iconRoadmap to Software Job for Non IT Person. Types of softwares. Client Server Overview
What is an API ? API Types and different HTTP Methods?right icon