DEV Community

Abinaya Dhanraj
Abinaya Dhanraj

Posted on

DNS

Title: How DNS Resolver Works in Simple Steps

Whenever we open a website like google.com, we don’t actually know its IP address. But computers need IP addresses to communicate. So there is a process that happens behind the scenes to convert the domain name into an IP address. This process is called DNS resolution.

First, what is DNS

DNS stands for Domain Name System. It works like a phonebook of the internet. Instead of remembering numbers like 142.250.190.78, we just use names like google.com.

Now I will explain step by step what happens when I type a website in the browser

Step 1: Request from browser

When I type google.com in the browser, the browser first checks if it already knows the IP address.

It looks in browser cache. If found, it uses that directly.

If not found, it goes to the next step.

Step 2: OS cache check

The request goes to the operating system. It also checks its own cache.

If the IP is already stored, it returns it.

If not, then it goes to DNS resolver.

Step 3: DNS Resolver

DNS resolver is usually provided by the internet service provider.

Its job is to find the IP address for the domain.

If it already has the answer cached, it returns immediately.

If not, it starts asking other DNS servers.

Step 4: Root server

The resolver first contacts the root DNS server.

Root server does not know the exact IP, but it knows where to find the next level.

It tells the resolver to go to the TLD server.

Step 5: TLD server

TLD means Top Level Domain like .com, .org.

The resolver asks the .com server for google.com.

The TLD server responds with the address of the authoritative name server.

Step 6: Authoritative server

Now the resolver contacts the authoritative DNS server.

This server has the actual IP address of google.com.

It returns the IP address.

Step 7: Response back

The resolver sends this IP address back to the browser.

The browser now uses this IP to connect to the actual web server.

Step 8: Website loads

Finally, the browser sends HTTP request to that IP and the website loads.

Caching

At every step, caching is used.

Browser cache
OS cache
DNS resolver cache

This makes future requests faster.

What I understood

DNS resolver acts like a middle person. It does not always know the answer, but it knows how to find it step by step.

This process happens very fast, usually in milliseconds, so we don’t notice it.

Conclusion

DNS resolution is an important part of how the internet works. Without it, we would have to remember IP addresses for every website. It makes the internet easy to use by converting names into IP addresses automatically

Top comments (0)