Monday, November 18, 2024
DNS (Domain Name System) is one of the key components responsible for interacting with websites in the most human-readable way possible.
We use names or characters to search the web, like youtube.com, but computers do not understand human terms. There is a need to convert these into machine-readable forms, i.e., the IP addresses.
DNS just does that work!
Behind the scenes, the Domain Name System (DNS) acts as the internet’s phonebook, converting human-readable domain names into machine-friendly IP addresses. Let’s break this down step-by-step, based on the flow shown in the accompanying diagram.
The flowchart below provides an overview of how a typical DNS flow works:
Here is a brief description of the flowchart:
Before making any external queries, your device (or local resolver) checks cache memory.
Why Cache Matters: Caching ensures faster responses for commonly visited sites, saving bandwidth and reducing latency.
The resolver (typically managed by your ISP) is responsible for handling your DNS query when the cache comes up empty. It starts by asking higher-level servers for help, beginning with the Root Servers.
The resolver sends a query to one of the Root DNS Servers. These servers don’t know the exact IP address of www.youtube.com, but they do know which Top-Level Domain (TLD) Server to ask.
In this case, the root server would direct the resolver to the .com TLD server, since YouTube’s domain ends with .com.
Fun Fact: There are only 13 logical root servers (mirrored worldwide) managing billions of queries daily.
Once the resolver contacts the TLD server for .com, it receives a more specific answer: the location of the Authoritative Name Server for youtube.com.
This server holds the final piece of the puzzle—the exact IP address of www.youtube.com.
The resolver queries the authoritative name server for the IP address of www.youtube.com. Finally, the IP address (e.g., 172.217.164.110) is returned to the resolver.
Before passing the IP address to your browser, the resolver stores it in its cache. This ensures that subsequent requests for www.youtube.com (or related domains) will be much faster.
This layered query system ensures two key things:
Imagine you’re looking for the address of a popular restaurant in a new city. Here’s how DNS compares:
This layered approach ensures that even if one source doesn’t know the answer, another can point in the right direction.