What is DNS? And How Does its Work?

Hello everyone, In this article, we discuss what is DNS? and How does its work in briefly so let’s get started.

What is DNS?

What is DNS, and how does it work DNS, first you need to understand how the communication with the computer from one server to another server works DNS is required because humans don’t remember an IP address, and if you remember an IP address to reach a server, that won’t be a feasible option, so that’s why we have this system. Whereas a computer understands the IP address, we understand the domain name that is an actual name like facebook.com or google.com, and for converting these values, we use the domain name system, which is the main purpose of the DNS. 

What is DNS?

Example of DNS Resolution 

Let’s say, for example, we type www.google.com. When somebody types that in a browser, what happens? How does a computer know that it has to reach a Google server? From a human perspective, it is easy to understand that it just goes to google.com, but for a computer, it only understands once and zero, so how can it go to a specific location to get the data? Now, to get that data, it first needs an IP address. Ipv4 is four octets; these are a numeric system for the computer, so each computer in the network will have a specific IP address, and based on these IP addresses, all the communications happen in the network. So we need to convert www.google.com or google.com into an IP address.

DNS resolver

Now how do we do that? First of all, whenever we are in the browser, We enter this, and it first sends a request to reduce. It is the responsibility of the DNS resolver to get an IP address for that specific DNS Resolver name that we providing, which is currently google.com. So what it will do is it will first try to go to a root-level domain server.

Root Level Domain Name Server

There it will ask, this is the domain name space, how do I get the IP address? Then, looking at the domain name server, what it does is that it looks at the URL in parts, so let’s say you have google.com at the end, you can see there is a.com.

Top Level Domain Name Server

So it will say, Okay, I know that this is a .com, so it needs to go to a specific server, or you need to ask somebody else to know where exactly I can find that IP address. That specific server is called the top-level domain server, so when it reaches the .com server, it then again asks if I need to know what is the IP address of google.com so the top-level domain server will forward that request to the authoritative server.

Authoritative Domain Name Server

So the authoritative server is the last server responsible for returning the domain name, So all this recursive query that is happening would be done by the DNS resolver, and at the end of this recursion it will get that specific data, like what is the IP address, and that would be written by an authoritative server. Now the authoritative server will have like multiple entries for the DNS, and when it gets the data back to the DNS resolver it checks what kind of entries it had.

A Record

So there is an IPv4 record, so it is just a mapping between an IPv4 address to a domain name, so it will just return that specific IP address to the DNS resolver, and then the DNS result will return that query to the client. One more thing can happen like an alternative server can have a schema entry.

C Name 

That is a canonical entry that signifies that this domain name is an alias for another name so it can only have a mapping from a domain name to a domain name and a domain name to an alias it cannot have a domain name to an IP address map. Okay, this can be used basically when you have sub-level domains or a different Alias for the same website, so it maps to the original root domain, and eventually the record of that specific route domain name is searched and sent back to the DNS, so every time to perform these recursive queries to the different servers takes time.


So whenever a browser requests something, the first thing it checks is whether it already has that record or the mapping inside its cache. The caching can happen at multiple levels in multiple places, so first we will tell you about the caching that happens in the browser. So the browser itself will store the mapping of the IP address and the domain name, and it will also have a field like TTL, like time to live, like how much time that entry would be valid. Also, there is another caching that is OS-level caching, where way before the OS senses the query outside its system, it first checks if it already has the entries or not. There can be one more scenario where the local system doesn’t have any caching, so it goes to the DNS resolver. Now the DNS resolver will check if it already has the A record. If it doesn’t have the Name Records, it checks whether it has the NS Record.

NS record

An NS record is a name server record that is an authoritative server record where it can directly send the query to the name server, which is an alternative server for the IP address, and the name server should return the IP address to the DNS resolver.

Leave a Comment