DEV Community

Mohammed Azim J
Mohammed Azim J

Posted on • Edited on

A blog on how DNS resolver is happening.

When we type a website address like google.com into a browser, the page loads in a few seconds, and we usually don't think about what happens behind the scenes. However, many steps occur before the website opens. One key process in this is DNS resolution. DNS stands for Domain Name System, and it acts like the internet's phonebook. People remember website names, but computers use IP addresses to communicate. DNS helps turn the website name into an IP address so the browser can locate the correct server.

Let's simplify this. Imagine you want to call a friend but don't remember their phone number. You open your contacts and look for their name. The contact list shows you the number, and then the call connects. DNS works similarly. The website name is like the contact name, while the IP address is like the phone number.

Now, let's go through what happens step by step when you enter a website address in the browser.

First, you type something like www.example.com in your browser and press enter. The browser checks its own cache to see if it already knows the IP address for that website. Browsers store the addresses of recently visited websites to avoid asking repeatedly. If the IP address is found in the cache, the website loads immediately without needing to query DNS.

If the browser can't find the IP address, the request goes to the operating system on your computer, which also has a small DNS cache. It checks if the IP address is stored there. If it's found, the operating system returns the IP address to the browser, allowing the website to load.

If the IP address isn't found in the browser or the operating system cache, the request is sent to a DNS resolver, typically managed by your Internet Service Provider. The resolver's job is to find the IP address by asking various DNS servers on the internet.

Now the resolver begins the DNS resolution process. It first contacts a Root DNS server. The root server doesn't know the precise IP address of the website, but it knows where to find the top-level domain servers, like the ones for .com domains.

Next, the resolver reaches out to the TLD server, which stands for Top Level Domain server. In this case, that would be the .com server. This server may not know the exact IP address, but it can direct the resolver to the authoritative name server for that specific domain.

Then, the resolver contacts the Authoritative DNS server. This server holds the website's IP address and sends it back to the resolver.

Now the resolver finally has the IP address of the website. It sends this IP address back to your computer, which then sends it to the browser. The browser can now request the web server using that IP address, and the website appears on your screen.

Although this may seem like a lot of steps, the entire process usually takes place in milliseconds. That’s why websites load quickly, even with many servers involved.

Another important aspect of DNS is caching. Caching reduces the time required for DNS resolution. When a resolver finds an IP address, it stores it for a while. If someone else requests the same website, the resolver can quickly return the IP address without going through the whole process again. This speeds up the internet and lessens the load on DNS servers.

DNS resolution is crucial for the internet's functioning. Without it, we would have to remember IP addresses for every website we want to visit, which would be very challenging. DNS makes the internet user-friendly by allowing us to use simple domain names instead of numbers.

In summary, DNS resolution is the process of turning a domain name into an IP address. It involves checking the browser cache, the operating system cache, the DNS resolver, the root server, the TLD server, and the authoritative server. Once the IP address is found, the browser connects to the web server and loads the website. Even though many steps are involved, the process is quick and happens almost instantly.

So the next time you open a website, remember that a DNS resolver is working behind the scenes to locate the correct server for you before the page loads.

Top comments (0)