DNS: A backstage pass to the internet’s glamorous name game!

Explore the critical role of DNS in navigating web communication

Ankit Trehan
4 min readJan 30, 2024

Picture this: You wake up in the ’80s, a world pre-dating the internet and modern cellphones 😨. As you meander through this analog wonderland, you stumble upon an ancient relic — the landline. With actual buttons! Who knew such relics existed? Intrigued, you are itching to make the call. But wait — who do you call? No Google to the savior in sight. Panic sets in until your eyes land on a big yellow book next to the landline. Ah, the magic book that deciphers names into dialable digits. You pick up the phone, dial the number and……abruptly wake up from the dream. Alas, you will never be able to know the satisfaction of using a landline!

An image indicating the DNS resolution process

What is DNS?

Well, so what is DNS (Domain Name System) and how is the above rambling relevant to this discussion? Think of DNS as the internet’s phonebook, translating human language into computer language. We humans like to access websites through domain names like programmerbytesrocks.com because they are easier to store in our memory. But web browses and computers prefer numbers, they like to communicate through numbers such as 192.12.98.0, known as IP addresses. DNS translates the human readable names into the machine readable numbers.

DNS translates domain names to IP addresses so browsers can load internet resources. It is a hierarchical and distributed naming system for computers.

But the internet has hundreds of millions of domains. You can’t just ship a massive database (yellow book) of IP addresses with each device. So how does DNS work?

How does DNS work?

There are four servers that work together to deliver an IP address to the client:

  1. The DNS Recursor (Resolver): This is your first point of contact in the DNS process. Think of it like a DNS butler or an assistant. It reaches out to other DNS servers on your behalf. This server is also armed with a caching mechanism to allow for quicker responses for frequently visited websites. A DNS resolver on your network is often the one supplied by your ISP, although nowadays companies like Google and Cloudflare supply one that you can use too.
  2. The Root Server: As noted above, DNS is a hierarchical system. This server can be thought of as the wise elder in the DNS hierarchy, holding directions to the next level. They can guide you on your path for a request to “.com”, “.net” or “.org” TLD (top level domain) servers.
  3. The Top Level Domain Server: This is the middleman in the process. This server knows who you need to talk to in order to get your final answer. These servers store information about which authority may have answer to your DNS query. It points you to the authoritative server, the final step in the process.
  4. Authoritative Server: Authoritative servers are the real stars of the show, holding the actual name to IP conversion answers. They are the servers that actually hold and are responsible for a DNS record. These servers don’t usually cache any information because they are responsible for delivering the most up to date IP record for a query.

Now that we have the above knowledge, it becomes easier to imagine how the entire process looks like:

  1. A user types in www.programerbytesrocks.com in their browser and hit enter.
  2. Behind the scenes, the request is routed to a DNS resolver
  3. This DNS resolver then checks its cache to see if there is already an entry for this hostname. If there is the resolver returns the IP address. If not, it ventures into the DNS hierarchy.
  4. The DNS resolver then reaches out to the root name server which tells it the location of the top level domain server. This is the server with records for the .com domain in this instance.
  5. The resolver then reaches out to the TLD server to get the “authority” that can return the IP address for the given host name.
  6. The TLD server returns a location which may be the authority for handling this hostname to IP conversion.
  7. The resolver now reaches out to the authoritative server. The authoritative server has the actual name records. So the authoritative server returns the IP address of the hostname back to the resolver.
  8. The resolver caches this response for a certain amount of time and returns the response to the web browser.
  9. Now your web browser can make the request to the page that you were dearly searching for

Phew, that is a basic overview of how DNS resolves into IP addresses. All that happens in the blink of an eye blind to us.

Final words:

Why do we use recursive DNS over just bombarding these other DNS servers on our own devices? It is like having well mannered middleman at a bustling party — less chaos, more efficiency. Another benefit is caching; if you pool a large network’s DNS requests you are bound to have a lot of cache hits which reduces the load on root servers (your OS and browser do a little bit of caching too but not as much as the recursive DNS servers).

In conclusion, the internet is an extremely complicated system. DNS is one part of this giant interconnected web and this was just a basic introduction. DNS stands as one of the unsung heroes orchestrating the internet’s ballet, making it the marvelously accessible space that it is today!

Please subscribe to my newsletter here to get these articles as soon as they are out: https://programmerbytes.substack.com/

Sign up to discover human stories that deepen your understanding of the world.

--

--

Ankit Trehan
Ankit Trehan

No responses yet

Write a response