DEV Community

Cover image for DNS LOOKUP
Vishal Rajput
Vishal Rajput

Posted on

DNS LOOKUP

When you type www.google.com in your browser, have you ever wonder how your computer magically know about where the google server are?

That's where DNS Lookup comes in, it’s like the phonebook of the internet, translating human-friendly domain names into machine-readable IP addresses.

What is DNS Lookup

DNS (Domain name system) is system that maps the human readable domain(www.google.com) to actuall server IP Address(8.8.8.8).

It is a process that our system perform to get the IP Address behind domain name. Without it, you’d need to remember long strings of numbers instead of simple names.

Types of DNS loopup

1) Forward DNS Lookup:

It map the domain name to server IP Address.

Example:

www.google.com //Domain
8.8.8.8 //Output

This is what happen when you open a website in your browser.

2) Reverse DNS Lookup

It map the IP Address → domain name.

Example:

nslookup 8.8.8.8 //Bash Command
dns.google //output

Often used for spam filtering, logging, and security.

Process of DNS Lookup

Whenever you type a web address in you browser you computer doesn't get the Server IP Address Magically Instead it follows some steps including:

1) Browser Cache:

When you visit a website, your browser temporarily stores its IP address.
If you revisit the site within that time frame,

the Browser says:

Hey, I already know this IP! No need to ask anyone.

and uses the stored IP to connect directly, skipping the next steps. Otherwise, it proceeds to check the OS Cache.

2) OS Cache:

If browser doesn't know then it asks the Operating system (Windows, Mac or Linux).
Your operating system keeps a small cache of domain to IP mappings.
On windows you can check it using

ipconfig /displaydns
Enter fullscreen mode Exit fullscreen mode

This will display all the DNS entries currently stored in your OS cache.
If the OS doesn’t have the answer either, the process moves to the next step.

3) Router / ISP Cache

If the OS also doesn’t know, the query travels to your home router or ISP’s (Internet Service Provider) DNS cache.

ISPs usually store a huge DNS cache because thousands of users often visit the same sites (Google, Facebook, etc.).

If the Router / ISP also doesn't have answer, process moves to next step.

4) Recursive DNS Server

If no cache has the answer, your ISP forwards the request to a recursive DNS server (sometimes also called a resolver).

Think of it as a detective:

I don’t know the answer, but I’ll ask around until I find it.

This server does the heavy lifting of contacting other DNS servers on your behalf.

5) Root DNS Servers

The root servers don’t know the exact IP of a website.

Instead, they act like directory assistants.

They look at the last part of the domain (the extension, like .com, .org, .in, etc.).

Based on this extension, they guide the query to the right TLD (Top-Level Domain) server.

Example:

You search for example.com.
The root server checks: “This ends with .com.”
Then it says: “Go ask the .com TLD servers; they’ll know who manages example.com.”

6) TLD Servers

Once the Root Server directs the query to the correct category (for example, .com), the TLD Servers take over.

TLD (Top-Level Domain) Servers manage all the domains under that extension (.com, .org, .net, .in, etc.).

But here’s the catch:

They don’t know the exact IP address of the website you’re looking for.
Instead, they know which Authoritative DNS Server is responsible for that specific domain.

7) Authoritative DNS Server

This is the final authority in the DNS lookup chain.

It’s managed by the domain’s owner or hosting provider (for example, if you bought your domain from GoDaddy or host it on AWS, their DNS server usually acts as authoritative).

The Authoritative DNS server knows the actual IP address of the website because it holds the domain’s DNS records (like A record, CNAME, MX, TXT, etc.).

In simple words:

They are the ones who say:

Yes, this domain belongs to me, and here’s its exact IP address.

8) Response & Caching

Once the Authoritative DNS Server provides the IP address, that information travels back through the entire chain:
Authoritative Server → TLD Server → Root Server → Recursive Resolver → ISP → OS → Browser.

Finally, your browser has the IP address it needs and can connect directly to the website’s server.🎉

To avoid repeating this long journey every time, the result is cached at multiple layers:

Browser Cache → remembers the IP for a short while.

OS Cache → stores DNS entries system-wide.

ISP / Recursive Resolver Cache → keeps answers for many users.

Example

  • You search for example.com.
  • The Root Server sends you to the .com TLD servers.
  • The .com TLD servers say: “The authoritative DNS server for example.com is at ns1.exampledns.com.”
  • Finally, the Authoritative Server looks into its database and replies: “example.com = 93.184.216.34.”

Conclusion

Every time you open a website, your device quietly goes through a well-orchestrated journey — from checking its own cache to asking root, TLD, and authoritative servers — all just to find the correct IP address. This entire process, called DNS Lookup, usually happens in milliseconds, but without it, the internet would feel impossible to use.

By understanding how DNS Lookup works, you can better appreciate:

  • Why websites load faster after the first visit (thanks to caching).
  • Why DNS errors sometimes occur (when servers can’t resolve the IP).
  • Why TTL and DNS management matter for developers and businesses.

In short, DNS is the hidden backbone of the internet — making sure that the names we type are always translated into the machines’ language of numbers, so we can browse, connect, and explore without ever thinking twice.

Top comments (0)