Introduction

Today topic is DNS, Domain Name System. Why we use Domain Name System or Domain Name servers? The purpose is to map the Domain names with the IP address. This means that in a real-life environment, on a daily basis, we open lots of websites and web applications. What do we enter? Let’s say Google, Facebook, YouTube.

Domain Names vs. IP Addresses

We always enter domain names. So, here the concept is that users always recall websites by domain names, not by IP addresses. The reason behind this is that it is easy to remember pictures and names, as our mind can easily capture names and pictures. Capturing numbers is difficult. For example, as I have written an IP address, do we ever discuss with our friends or anyone to open this or any IP address? No, we never talk like this. Let’s say this is an IP address, and this IP address is of crickinfo.com. As a cricket lover, I take the example of cricket. It is an IP address of crickinfo.com.

Importance of DNS

We never open websites with IP addresses; we always use domain names. So, the very first use of a domain name server or domain system is that users always remember domains with names. This makes it very easy to search for any website. We can also say that DNS works like a phonebook. In a phonebook, we never search for anyone with a number; we remember the person’s name, and then by the person’s name, we search alphabetically in the dictionary or phonebook to find the particular value.

Dynamic Nature of IP Addresses

The second main reason to use DNS is that IP addresses are dynamic; they are never static. If you create a web application, let’s say xyz.com, you made a website and hosted it on Amazon Web Services. You purchased a database and hosting, which means you got your IP address. But everyone will search for you by which name? They will search for you by the name xyz, not by your IP address. Let’s say after 1-2 years, you or Amazon decided to shift to another IP address, or you find Amazon a bit expensive, so you decide to use another web provider, like GoDaddy. When you shift to another web application, your database will remain the same.

Consistency of Domain Names

So there, the name of your website xyz remains the same. Everyone remembers you by your name xyz, not by your IP address. Your IP address in this case has changed, but your name remains the same. If you change the name of your website from xyz to abc, then you have to start the business in a new way because everybody knows you by your name xyz. Here, IP addresses are changing from the backend, but the name of the domain database remains the same. Yes, it keeps on updating, but the domain name should remain the same. So these are the major two reasons to use DNS.

How DNS Works

Next, let’s talk about how we search by adding a domain name. Let’s say in my system, I opened a browser, and on the browser, I entered crickinfo.com. When I typed crickinfo.com, what happens next is that I have entered the domain name. This domain name will first get mapped with an IP address. This is not my responsibility. For this, we have this architecture, and this is a hierarchical architecture.

Role of Root Server

In this architecture, there is a Root server. This is a root node. From here, the request will first go to the root server. This also has two methods; it can be recursive or iterative mode. So firstly, the request goes to the root server, or basically, it works as a resolver. The work of the resolver is to resolve this domain name into an IP address. The root server will get the request first. For your knowledge, I tell you that in this entire world, there are 13 root servers all over the world. So your request will go to the root server first, and from the root server, it will give you an IP address. This means that the resolver will get the IP address and location of the next level.

Next Level: Generic Server Level

Now, the next level is the generic server level or country server level, where the domain you have searched, crickinfo.com, will be resolved from right to left. This means it resolves from the backside to .com. Here, the .com is a commercial, non-profitable organization. .in is used for India, for military, for education; there are different domains. Your request will be forwarded to which server? It will be forwarded to .com servers. So here, what we have done is distribution. We have divided the traffic. Instead of going to one place, traffic is sent to this load or to this link. There is no need to move to the rest. Generally, these .com servers are not single servers; they are multiple servers so that load balancing can be done easily.

Authoritative Server Level

After .com, from the second level, we move to the authoritative level. Authoritative servers are servers that store all IP addresses and names. The name is crickinfo, and crickinfo’s IP address is saved in the authoritative server. It can also happen that crickinfo has multiple IP addresses. Like Google, YouTube, these are high-level organizations; they cannot work with a single server. For example, if we talk about Facebook, Facebook alone has about 70,000 servers. So, as there are so many servers, there could be a chance of having multiple IP addresses as well. The authoritative server will choose one of the IP addresses, and that IP address is what you have to search.

Process of Resolving the Domain Name

So how does your request work? Firstly, it is sent to the resolver. The resolver sends it to the root server. The root server asks the resolver to move to the commercial server, then to the commercial server. The commercial server gives the address to the resolver, and with that address, the resolver moves to the authoritative server. From there, the request is sent to the authoritative server, which provides the IP address. That IP address is given to the resolver, and the resolver brings it back to my browser.

Conclusion

This is how the domain name is mapped with the IP address. Although every time we don’t require this because our ISP (Internet Service Provider) is responsible, it always keeps a cache. Cache meaning it stores in cache memory. Not every time your request is sent to the root server. Whenever we search for any website for the first time, it is sent to the root server. The next time, the ISP will store it so that the next time, your request does not take this much time and gets resolved easily.

Categorized in:

Uncategorized,

Last Update: September 1, 2024