How is it possible that we never learn a single IP address of a site, yet we can browse the Internet without any problems? What magical process transforms simple-to-write domain names into IP addresses and makes it so easy for us humans? It is called DNS resolution!
What is the DNS resolution?
DNS resolution is the process that DNS uses to resolve domain names to their IP addresses. It starts with a simple client’s DNS query for a domain name that later goes through a DNS recursive resolver, different DNS servers on different levels (Root, TLD, and authoritative servers) and brings back the IP address of the domain in the form of an A or AAAA record.
What are the steps of the DNS resolution process?
When a client whats to visit a new site (a domain name that it hasn’t visited before), a DNS resolution will have the following steps:
- The start of the DNS query. The client will write a domain name in their browser, and this will trigger a DNS lookup process that will start searching for the IP address of the domain name.
- The query will go to a DNS recursive resolver server. This kind of server will search for the answer if it doesn’t have it inside its memory cache. It will communicate with the rest of the DNS servers and finally provide the answer to the client. The first check will be to the Root server.
- The Root server is the highest level on the DNS hierarchy. It will see the last extension of the requested domain (The TLD like .net, .info, .com, etc.) and redirect the query to the right TLD server.
- The recursive will ask the TLD server for the domain name, and the TLD server will answer with the correct nameserver for the domain name.
- Once more, the recursive needs to perform another lookup and go to the authoritative nameserver for the domain name. As it is authoritative for the requested domain, it can finally provide the domain name’s IP address.
- The recursive DNS server finally has the answer and sends it to the client. It will save it inside its cache memory for later use.
- The client gets it, saves it in its cache memory too. So now, it can access the site with the provided IP address.
The DNS resolution process takes many steps, and the DNS query needs to go through many servers on the way, but what a client experience is just a short moment of waiting.
Why should we care about it?
We should care about the DNS resolution for 2 reasons:
- Availability. If you are a site owner and your users want to visit your site, then the nameserver that is responsible for your domain name needs to do its task. If you haven’t chosen an extra DNS service, you are relying on your domain registrar’s nameservers. If it is down, your domain and site won’t be available.
- Speed. When a user is visiting your site, the first step will be the DNS resolution. If it is slow, it will take extra time to access the content. If it is extremely slow, many of the users will just leave the page. This is why you want the DNS process to happen fast.