DNS Resolution Process
In this tutorial, we are going to discuss about how DNS Resolution Process will work in internet. DNS translates human-readable domain names into machine-readable IP addresses. This translation process, known as DNS resolution, enables users to access websites and online services using easy-to-remember domain names instead of having to memorize complex numerical IP addresses.
The DNS resolution process involves a series of recursive and iterative queries, utilizing a distributed and hierarchical infrastructure of DNS servers, resolvers, and caching mechanisms. This tutorial dig into the details of the DNS resolution process, providing a clear understanding of how domain names are resolved into IP addresses and the role of various DNS components in ensuring a seamless and efficient browsing experience for users.
Domain name resolution is the process by which internet users receive the address of the domain they were looking for. To be more precise, the domain name resolution is a translation process between the domain name that people use while writing in their browsers and the site’s IP addresses. You need the IP address of a site to know where it is located and load it.
A website could have both IPv4 and IPv6 addresses, and the DNS resolution of a domain name will ask for both of them. The IPv4 address will come in the form of a DNS A record, and the IPv6 will come in a DNS AAAA record.
Let’s get into the details, and see how it works, shall we?
Domain name resolution – Why is it important?
In the world of the Internet, the addresses don’t contain streets and cities. They have numbers and symbols. There are two types of addresses: IPv4 and IPv6. In order to enter a particular website, the user needs to get its IP. Instead of remembering all of the IPs of every website, we simply need to remember the domain name. The domain name is usually not hard to remember, and this makes it easier. When the user types the name of the website, the process of the domain name resolution starts.
So let’s proceed and explain the whole process of DNS resolution.
DNS resolution process
The browser of a user needs to get the IP and sends queries to the name servers. This process involves domain name resolvers. The first answer that your browser will get is the root server, then the TLD (top-level domain). The servers with the TLD of the website you want to visit (com, net, or another) will refer your queries to the next step in searching authoritative servers that know the exact IP address of the domain name. Then the domain name will be resolved.
Let’s breakdown the DNS resolution step-by-step
- A user is typing a domain name like waytoeasylearn.com into their browser. The user needs an A or AAAA DNS record to resolve the domain name.
- If your device’s cache has the IP address of waytoeasylearn.com, the domain name resolution will finish here, and the user will be able to open the website. But, if it does not, there will be more steps. The devices keep DNS records for visited sites, depending on the TTL (Time to Live) values of those DNS records. After the time they indicate, they will be deleted, and a new query needs to be performed.
- If your computer doesn’t have the needed IP address, it will search for the answer by performing a DNS resolution query. The next destination on the way will be the recursive DNS servers of the internet services provider. They also keep a cache with DNS records of domain names that users have accessed. If the desired site’s DNS records are still there, the user will get an answer to its query and access the site. If not, there will be a series of interactive DNS queries to find the answer.
- If the domain name resolution didn’t finish with the previous step, the recursive nameserver would search for the answer. The next step will be to ask the Root server, which is indicated with a “.” sign after the TLD (top-level domain). The Root server does not have an answer about the exact domain name, but it will provide one for the part it is responsible for – it will indicate all the nameservers for the TLD that we asked for. In our case, it will show the nameservers of .com.
- The TLD DNS servers will have the answer of which exactly are the authoritative nameservers for the domain you are searching. The TLD servers of .com will have that information for all of the domain names that finish with .net. They will return that answer so the query can continue.
- Now that we know where the authoritative nameserver of the domain name we want is, we can ask and get the A and AAAA records to understand the site’s IP address.
- The Authoritative nameservers of the domain name will provide the DNS records, the DNS resolution will be made. The recursive nameserver of our ISP and our device will both save the DNS records that we obtained based on their TTL values. That way, if we soon want to visit the site again, we will save time and access the site faster.
- Visit the site. Now with the DNS record already obtained, the user can access the site.
Recursive and Iterative DNS queries
DNS resolution is the process of converting a domain name into its corresponding IP address. There are two types of DNS queries involved in this process: recursive and iterative queries.
- Recursive query: In a recursive query, the DNS resolver asks for the complete answer to a query from the DNS server. If the server has the answer, it responds with the required information. If not, the server takes responsibility for contacting other DNS servers to find the answer and then returns it to the resolver. Recursive queries put more responsibility on the DNS server to find the requested information.
- Iterative query: In an iterative query, the DNS resolver asks the DNS server for the best answer it has at the moment. If the server doesn’t have the complete answer, it responds with a referral to another server that might have more information. The resolver then contacts that server with a new iterative query, repeating the process until it finds the complete answer. In iterative queries, the resolver takes on more responsibility for finding the requested information.
DNS caching and TTL (Time To Live)
To speed up the DNS resolution process, resolvers and servers cache the results of previous queries. When a resolver receives a query, it first checks its cache to see if the answer is already available. If it finds the cached information, it returns the answer without contacting other servers, saving time and reducing network traffic.
Each DNS record has an associated Time To Live (TTL) value, which specifies how long the record should be stored in the cache. TTL is measured in seconds, and once the TTL expires, the cached information is removed to ensure that outdated information is not used.
Negative caching
Negative caching is the process of caching the non-existence of a DNS record. When a resolver receives a query for a non-existent domain or record, it caches this information as a negative response, preventing repeated queries for the same non-existent resource. This reduces the load on DNS servers and improves overall performance.
In short, the DNS resolution process involves converting a domain name into its corresponding IP address using recursive and iterative queries. Resolvers and servers cache the results of previous queries to speed up the resolution process, with TTL values determining how long the records are stored. Negative caching helps improve performance by caching the non-existence of DNS records.
Do we need to care about it?
The answer is yes! For humans, the DNS resolution process is essential. And if something goes wrong, the use of the Internet by regular users would be extremely difficult.
So we should be concerned about DNS resolution for two reasons:
- The first one is the importance of the speed. When a user accesses your website, the DNS resolution is the first thing that happens. If your page takes too long to load and access, the user will probably leave. That’s why this process needs to be performed fast.
- The second one is the availability. The nameserver in charge of handling your domain name needs to be trustworthy. A backup DNS service is a great technique to guarantee that your domain is always reachable by your customers.
That’s all about DNS Resolution Process and how it works. If you have any queries or feedback, please write us email at contact@waytoeasylearn.com. Enjoy learning, Enjoy system design..!!