<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How DNS Resolution works]]></title><description><![CDATA[How DNS Resolution works]]></description><link>https://dns-resolution-works-haradhan-das.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 26 Oct 2026 19:53:21 GMT</lastBuildDate><atom:link href="https://dns-resolution-works-haradhan-das.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How DNS Resolution Works]]></title><description><![CDATA[DNS address resolution converts human-readable domain names into IP address that computer use to locate server. It works like a digital phonebook, mapping…]]></description><link>https://dns-resolution-works-haradhan-das.hashnode.dev/how-dns-resolution-works</link><guid isPermaLink="true">https://dns-resolution-works-haradhan-das.hashnode.dev/how-dns-resolution-works</guid><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Haradhan Das]]></dc:creator><pubDate>Fri, 23 Jan 2026 07:10:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768997524123/68cb0c36-5b42-45dd-a43f-578c9184698d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-resolution-in-dns-domain-name-server">Resolution in DNS (domain name server)</h3>
<hr />
<p>DNS address resolution converts human-readable domain names into IP address that computer use to locate server. It works like a digital phonebook, mapping names to numbers to numbers so websites can load correctly.</p>
<ul>
<li><p>Translates domain names (e.g., www.example.com) into IP addresses</p>
</li>
<li><p>Essential for loading the correct server</p>
</li>
<li><p>Enables browsers to connect to websites</p>
</li>
<li><p>Function like looking up phone numbers in a contact list</p>
</li>
<li><p>Critical for proper internet communication</p>
</li>
</ul>
<p><img src="https://media.geeksforgeeks.org/wp-content/uploads/20250801110158118237/key_components_of_dns.webp" alt="image description" /></p>
<ul>
<li><p>Domain names: Human-readable addresses (e.g., www.example.com).</p>
</li>
<li><p>IP Addresses: Numeric addresses used by computers to identify to each other (172.217.3.116).</p>
</li>
<li><p>DNS Records: Structured data that provides in information about the domain name, such as IP address mappings.</p>
</li>
</ul>
<pre><code class="lang-mermaid">flowchart TD
    A[User enters google.com] --&gt; B[Browser asks resolver]
    B --&gt; C[Resolver asks root server]
    C --&gt; D[Root points to .com servers]
    D --&gt; E[Resolver asks .com TLD]
    E --&gt; F[TLD points to Google DNS]
    F --&gt; G[Resolver asks authoritative server]
    G --&gt; H[IP address returned]
    H --&gt; I[Browser loads website]
</code></pre>
<h3 id="heading-the-role-of-the-dns-resolver-in-address-resolution">The Role of the DNS Resolver in Address Resolution</h3>
<p>DNS operates as a client- server application. A host that needs to map a domain name to an IP address (or vice versa) calls a DNS client called a <strong>resolver</strong>. The resolver accesses the nearest DNS server with a mapping request. Here is how the process works:</p>
<p><strong>Step 1:</strong> The resolver send a query to the nearest DNS server. <strong>Step 2:</strong> If the server has the required information, then it returns the result. If not it refers the resolver to other DNS server to lookup A record. <strong>Step 3:</strong> The resolver checks if the response is correct and immediately delivers it to the requesting application or user.</p>
<h3 id="heading-how-does-address-resolution-work-in-dns">How Does Address Resolution Work in DNS?</h3>
<p>Address resolution in DNS can be broken down into the following categories:</p>
<p><img src="https://media.geeksforgeeks.org/wp-content/uploads/20250801171021517035/address_resolution_in_dns.webp" alt="image description" /></p>
<h3 id="heading-a-mapping-domain-names-to-ip-addresses">A) Mapping Domain names to IP Addresses</h3>
<p>When a user types a domain name into their browser, the DNS system queries various DNS server to find the corresponding IP address. The resolver checks different domain sections (e.g., generic and country domains) domain name.</p>
<h3 id="heading-b-mapping-ip-addresses-to-domain-names">B) Mapping IP addresses to domain Names</h3>
<p>A client can send an IP address to server to be mapped to a domain name. this is called a ptr query. to answer queries of this kind, DNS uses the inverse domain. however , in the request , the ip address is reversed and two labels , in-addr and arpa are appended to create a domain acceptable by the inverse domain section.</p>
<p>For example. if the resolver receives the ip address 132.34.45.121, the resolver first inverts the address and then adds the two labels before sending. the domain name sent is "121.45.34.121 in - addr.arpa", which is received by the local DNS and resolved.</p>
<p>To find a particular DNS requesting host place its query to the local DNS server to mapping with a mapping request. If it has the information, the resolver is satisfied else the resolver is referred to other servers or other servers are asked to provide the information. After the resolver , get the response, it checks whether the response is correct or not. If the response is correct, the response is passed to the process that requested it , or else the name query fails.</p>
<pre><code class="lang-mermaid">flowchart TD
    A[Developer has DNS doubt] --&gt; B[Uses dig command]
    B --&gt; C[dig sends DNS query]
    C --&gt; D[DNS servers reply]
    D --&gt; E[DNS records shown]
    D --&gt; F[Server information shown]
    D --&gt; G[Query time shown]
    E --&gt; H[Understand DNS data]
    F --&gt; I[Find who controls domain]
    G --&gt; J[Debug DNS issues]
</code></pre>
<hr />
<h3 id="heading-what-is-the-dig-command-and-when-it-is-used">What is the dig command and when it is used</h3>
<p>The <code>dig</code> (Domain Information Groper) command is a powerful professional-grade command line tool used interrogate DNS server. While your browser handles DNS automatically, <code>dig</code> allows you manually to ask a DNS server for information and see what exactly it says back.</p>
<h4 id="heading-when-to-use-dig">When to Use <code>dig</code></h4>
<p>You usually use dig whenever you need to look "under the hood" of your internet connection:</p>
<ul>
<li><p><strong>Troubleshooting Site Outages:</strong> If a website wont load, <code>dig</code> can tell you if the problem is a missing DNS record, an expire domain, or a server that is completely down.</p>
</li>
<li><p><strong>Verifying DNS changes:</strong> When you update your website's IP address, it can take time to propagate. Use <code>dig</code> to see if the new record are live yet.</p>
</li>
<li><p><strong>Checking Email Settings:</strong> To receive email, a domain needs "MX records". You can use <code>dig</code> to verify these are set up correctly, so you don't lose mail.</p>
</li>
<li><p><strong>Debugging Security:</strong> You can use it to inspect security certificates or TXT records used to verify domain ownership (like Google Workspace or Microsoft 365).</p>
</li>
</ul>
<hr />
<h3 id="heading-understanding-dig-ns-and-root-name-servers">Understanding dig . NS and root name servers</h3>
<p>To understand <strong>dig</strong>, <strong>NS records</strong>, and <strong>Root Servers</strong>, it helps to think of the internet as a massive library where every website is a book.</p>
<p><strong>1. Root Name Servers (The "Master Lobby")</strong></p>
<p>Imagine you walk into a library with millions of floors. You don't know where to go.</p>
<ul>
<li><p><strong>What they are:</strong> There are 13 sets of Root Servers around the Globe (named A through M) that sit at the very top of the internet.</p>
</li>
<li><p><strong>Their Job:</strong> They don't know the address of <code>google.com</code>. They only know where the "elevators" are for different categories. If you ask for a <code>.com</code>, the Root Server says: "I don't have the book, but go to the .com "elevator" on Floor 5."</p>
</li>
<li><p><strong>Why they matter:</strong> They are the first step of every search. If they disappeared, the internet wouldn't know how to find any website.</p>
</li>
</ul>
<p><strong>2. NS records (The "Who is in charge" Tag)</strong></p>
<p>NS stands for Name Server.</p>
<ul>
<li><p><strong>What it is:</strong> An NS record is a piece of digital "ID" for a domain. it tells the internet: "If you want to find the IP address for <code>example.com</code>, you must ask these specific computers."</p>
</li>
<li><p>**Example: ** If you use GoDaddy to host your site, you NS records might look like <code>ns1.godaddy.com</code>.</p>
</li>
<li><p><strong>The Difference</strong>: While a Root Server sends you to a category (like .com), the NS record sends you to the final person who actually has the "key" to your specific website.</p>
</li>
</ul>
<pre><code class="lang-python-repl">Command                                                     Simple Explanation
dig example.com                                   "Tell me everything you know about this site."
dig example.com NS                               "Who are the specific servers in charge of this site?"
dig +trace example.com                "Show me the whole path: starting from the Root, then the TLD, then the NS."
</code></pre>
<h3 id="heading-putting-it-together-the-flow">Putting it together (The Flow)</h3>
<ol>
<li><p>You ask your computer for a site.</p>
</li>
<li><p>Your computer asks the Root Server (The Master Lobby).</p>
</li>
<li><p>The Root points to the TLD Server (The .com Elevator).</p>
</li>
<li><p>The TLD Server looks at the NS Records to see who is in charge.</p>
</li>
<li><p>You arrive at the Name Server (The Librarian) who gives you the IP.</p>
</li>
<li><p>dig is the tool you use to see every single one of those steps.</p>
</li>
</ol>
<hr />
<h3 id="heading-understanding-dig-com-ns-and-tld-name-servers">Understanding dig com NS and TLD name servers</h3>
<p>Think of the internet like a giant global organization with millions of employees (websites). To find anyone, you have to go through the right departments. Here is the simplest way to understand how <code>.com</code> and its "bosses" work using the <code>dig</code> command.</p>
<ol>
<li>What is a TLD? (The Department) TLD stands for Top-Level Domain. Its just the last part of web address.</li>
</ol>
<ul>
<li><p><code>.com</code> is like the "Commercial Department" (for businesses)</p>
</li>
<li><p><code>.org</code> is like the "Non-Profit Department" (for organizations).</p>
</li>
<li><p><code>.edu</code> is like the "Education Department" (for schools).</p>
</li>
</ul>
<h3 id="heading-2-what-are-tld-name-servers-the-department-heads">2. What are TLD Name servers? (The Department Heads")</h3>
<p>Every department needs a manager. You can think of like this , <code>.com</code> department is so huge that it is manged by special computers called TLD servers. These server are ultimate middleman. if you them for the address of <code>google.com</code>, Instead, they act like a recipionist who says: "i don't have the IP address, but I know who does. Go talk to Google’s private secretary." 3. <strong>The Command:</strong> <code>dig com NS</code> When you run the command dig com NS, you are basically walking up to the internet's information desk and asking: <strong>"Who is in charge of the entire .com department?"</strong></p>
<ul>
<li><p><code>dig</code>: This is your "Detective Tool."</p>
</li>
<li><p><code>com</code>: This is the department you’re asking about.</p>
</li>
<li><p><code>NS</code>: This stands for Name Server. You’re saying, "Give me the names of the servers that run this place."</p>
</li>
</ul>
<hr />
<h3 id="heading-the-result-meeting-the-bosses">The Result: Meeting the "Bosses"</h3>
<p>When you hit enter, you’ll see a list of names like:</p>
<ul>
<li><p>a.gtld-servers.net</p>
</li>
<li><p>b.gtld-servers.net</p>
</li>
<li><p>(ad so on...)</p>
</li>
</ul>
<p>There are <strong>13 of these "boss" servers</strong> for the <code>.com</code> world. Their only job is to sit there all day and tell people which direction to go to find specific websites like Google, Facebook, or your own personal blog.</p>
<h3 id="heading-why-this-matters-to-you">Why this matters to you:</h3>
<p>Every single time you type a .<code>com</code> website into your browser, your computer has to "talk" to one of these 13 bosses first. Without them, your computer would have no idea which direction to go to find the website you’re looking for!</p>
<p><img src="https://media.licdn.com/dms/image/v2/D4D22AQHbqF6_RHUZGw/feedshare-shrink_800/B4DZoW8vvBIEAg-/0/1761321614641?e=1770854400&amp;v=beta&amp;t=7P1NzyrNSQr5wp44hTmiyuOpaIrM-vIZfEsxwuhUOCU" alt="image description" /></p>
<hr />
<h3 id="heading-understanding-dig-googlecom-ns-and-authoritative-name-servers">Understanding dig google.com NS and authoritative name servers</h3>
<p>If the <strong>TLD Servers</strong> we talked about earlier are the "Department Heads," then the Authoritative Name Servers are the "Private Secretaries" for a specific company.</p>
<p>Here is the simple breakdown of what happens when you look up a specific site's records.</p>
<h3 id="heading-1-what-is-an-authoritative-name-server-the-secretary">1. What is an Authoritative Name Server? (The "Secretary")</h3>
<p>This is the final stop in the DNS journey.</p>
<ul>
<li><p>While the <code>.com</code> bosses know about every business, they don't know the internal details.</p>
</li>
<li><p><strong>Google</strong> has its own special servers that hold the "Master File" for <code>google.com</code>.</p>
</li>
<li><p>These servers are called <strong>Authoritative</strong> because they are the final authority. Whatever they say is the truth. If they say the IP address changed, then ip address has changed and the rest of the internet eventually follows.</p>
</li>
</ul>
<h3 id="heading-2-the-command-dig-googlecom-ns">2. The Command: <code>dig google.com NS</code></h3>
<p>When you run this, you aren't asking about the whole .com department anymore. You are asking: <strong>"Who is the specific secretary in charge of Google's records?"</strong></p>
<ul>
<li><p><code>dig</code>: Your detective tool.</p>
</li>
<li><p><code>google.com</code>: The specific "office" you are looking for.</p>
</li>
<li><p><code>NS</code>: "Show me the Name Servers (the secretaries)."</p>
</li>
</ul>
<h3 id="heading-3-the-result-meeting-the-google-team">3. The Result: Meeting the Google Team</h3>
<p>When you run this, you’ll see an <strong>ANSWER SECTION</strong> with results like:</p>
<ul>
<li><p><code>ns1.google.com</code></p>
</li>
<li><p><code>ns2.google.com</code></p>
</li>
<li><p><code>ns3.google.com</code></p>
</li>
<li><p><code>ns4.google.com</code></p>
</li>
</ul>
<p><strong>Why are there four of them?</strong> Redundancy! If ns1 is too busy or crashes, ns2 is standing right there to answer the phone. Google makes sure their "secretaries" are spread out all over the world so they never miss a call.</p>
<hr />
<h3 id="heading-summary-the-hand-off">Summary: The Hand-off</h3>
<p>To find <code>google.com</code>, the process looks like this:</p>
<ol>
<li><p><strong>The .com Boss (TLD Server)</strong> says: "I don't know the IP, but here are Google's secretaries: ns1.google.com."</p>
</li>
<li><p>You ask <code>ns1.google.com</code>: "What is the IP address?"</p>
</li>
<li><p><strong>The Secretary (Authoritative Server)</strong> says: "It's 142.250.190.46. Here you go!"</p>
</li>
</ol>
<p><img src="https://media.licdn.com/dms/image/v2/D4D22AQGDaBIiwW8NTQ/feedshare-shrink_2048_1536/B4DZvrbRlGJQAk-/0/1769181354636?e=1770854400&amp;v=beta&amp;t=gOyUBUn7Ba_g5W_KCwlXfdbSDMHVdtmJI6KX4Qp8LxY" alt="image description" /></p>
<hr />
<h3 id="heading-understanding-dig-googlecom-and-the-full-dns-resolution-flow">Understanding dig google.com and the full DNS resolution flow</h3>
<p>When you ran <code>dig google.com</code>, your computer performed a high-speed relay race. Even though you saw the answer in <strong>55 milliseconds</strong>, your request technically traveled through a hierarchy of power.</p>
<h3 id="heading-1-the-full-resolution-flow">1. The Full Resolution Flow</h3>
<p>Think of this as a chain of command. Each level is more specific than the last.</p>
<ol>
<li><p><strong>The Recursive Resolver (The Librarian)</strong>: In your output, this was your router (<code>192.168.0.1</code>). It took your request and said, "I'll go find that for you."</p>
</li>
<li><p><strong>The Root Server (The Index)</strong>: The resolver asked the Root, "Where is <code>.com</code>?" The Root pointed to the TLD servers.</p>
</li>
<li><p><strong>The TLD Server (The Department Head)</strong>: The resolver asked the .com boss, "Where is <code>google.com</code>?" The TLD pointed to Google’s Authoritative servers (the "secretaries").</p>
</li>
<li><p><strong>The Authoritative Server (The Source)</strong>: The resolver asked <code>ns1.google.com</code>, "What is your IP?" It got the final answer: <code>142.250.76.78</code>.</p>
</li>
</ol>
<hr />
<h3 id="heading-2-the-role-of-the-ttl-the-freshness-timer">2. The Role of the TTL (The "Freshness" Timer)</h3>
<p>In the output, you can see the number <code>38</code>.</p>
<pre><code class="lang-plaintext">google.com.    38    IN    A    142.250.76.78
</code></pre>
<p>This is the <strong>Time To Live (TTL)</strong>.</p>
<ul>
<li><p>It’s a countdown clock.</p>
</li>
<li><p>Because DNS information is cached (saved) to make the internet faster, your router saved Google's address.</p>
</li>
<li><p>f you run the command again right now, that number will be lower (e.g., 30, then <code>22</code>, then <code>5</code>).</p>
</li>
<li><p>Once it hits <strong>0</strong>, your router will delete the answer and perform the whole "relay race" again to make sure the IP hasn't changed.</p>
<hr />
</li>
</ul>
<h3 id="heading-3-why-this-matters-for-system-design">3. Why this matters for System Design</h3>
<p>This flow is the reason the internet is <strong>decentralized</strong>.</p>
<ul>
<li><p>If Google changes its IP address, they only have to update their own <strong>Authoritative Server</strong>.</p>
</li>
<li><p>They don't have to tell the whole world.</p>
</li>
<li><p>Instead, the world’s resolvers (like your router) will eventually see the "38" hit zero, go back to Google's "secretary," and get the new update automatically.</p>
<pre><code class="lang-mermaid">  flowchart
      A[Your Computer] --&gt;|1. dig +trace| B(Root Servers)
      B --&gt;|Points to .com| C(.com TLD Servers)
      C --&gt;|Points to Google's NS| D(Authoritative Servers)
      D --&gt;|Gives Final IP| E[A Record: 142.250.76.78]
</code></pre>
</li>
</ul>
<h3 id="heading-why-this-is-a-system-design-masterpiece">Why this is a "System Design" Masterpiece</h3>
<p>This isn't just a fun fact; it's how the internet survives. Because the work is split up among different "departments" and "secretaries," no single server has to remember every website on Earth. This makes the internet <strong>scalable, fast, and impossible to shut down easily.</strong></p>
]]></content:encoded></item></channel></rss>