<?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[Beginner's Guide to Understanding DNS]]></title><description><![CDATA[Beginner's Guide to Understanding DNS]]></description><link>https://beginners-guide-to-understanding-dns.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 09:37:32 GMT</lastBuildDate><atom:link href="https://beginners-guide-to-understanding-dns.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[The Beginner's Guide to Understanding DNS]]></title><description><![CDATA[Before we understand DNS, let’s quickly see what actually happens when you type a website name in the browser.
What Happens when you type hitesh.ai on Browser and hit ENTER?

As you can see in above image after you type hitesh.ai and hit enter and it...]]></description><link>https://beginners-guide-to-understanding-dns.hashnode.dev/the-beginners-guide-to-understanding-dns</link><guid isPermaLink="true">https://beginners-guide-to-understanding-dns.hashnode.dev/the-beginners-guide-to-understanding-dns</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><category><![CDATA[dns]]></category><category><![CDATA[networking]]></category><category><![CDATA[internet]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Domain Name System]]></category><category><![CDATA[beginnersguide]]></category><category><![CDATA[software development]]></category><category><![CDATA[computer networks]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Pritesh Kittur]]></dc:creator><pubDate>Thu, 22 Jan 2026 13:46:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769077799898/1d3074f3-170f-44ef-bed9-fbffc29c0935.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Before we understand DNS, let’s quickly see what actually happens when you type a website name in the browser.</p>
<h2 id="heading-what-happens-when-you-type-hiteshai-on-browser-and-hit-enter">What Happens when you type <em>hitesh.ai</em> on Browser and hit ENTER?</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769078905559/9d3df712-1025-4187-962a-0d06f0a35fa5.png" alt class="image--center mx-auto" /></p>
<p>As you can see in above image after you type <code>hitesh.ai</code> and hit enter and it opens right? Partially Correct, Because when you press Enter, your computer first tries to find the <strong>IP address</strong> of <a target="_blank" href="http://hitesh.ai"><code>hitesh.ai</code></a>.<br />Computers don’t really understand domain names like <a target="_blank" href="http://hitesh.ai"><code>hitesh.ai</code></a>, they only understand <strong>IP addresses</strong>, because an IP address tells where the website is actually located on the internet.</p>
<p>So this is what happens step-by-step:</p>
<ol>
<li><p>First, your browser checks if the IP address of <a target="_blank" href="http://hitesh.ai"><code>hitesh.ai</code></a> is already saved in the <strong>cache</strong>.</p>
</li>
<li><p>If it’s not found in cache, the request goes to a <strong>recursive DNS server</strong> (usually your ISP / WiFi DNS).</p>
</li>
<li><p>The recursive DNS server follows a proper process and finds the correct <strong>IP address</strong> of <a target="_blank" href="http://hitesh.ai"><code>hitesh.ai</code></a>.</p>
</li>
<li><p>Once the browser gets the IP address, it sends a request to the <strong>web server</strong> where that website is hosted.</p>
</li>
<li><p>If the website needs data, the server queries the <strong>database server</strong>.</p>
</li>
<li><p>Finally, the response is sent back to the browser and it gets displayed on your screen.</p>
</li>
</ol>
<p><strong>DNS is basically the internet’s phonebook</strong> — it converts domain names into IP addresses.<br />Think of DNS as saving a contact name (<code>hitesh.ai</code>) and dialing its number (<strong>IP address</strong>).</p>
<h2 id="heading-why-do-we-need-dns-records">Why do we need DNS Records?</h2>
<p>Simple, Because DNS records act as Internet’s Phonebook and Translate easy to remember names like <em>google.com</em> to complex IP Addresses like <strong>216.58.216.164</strong> which all Humans tend to forget even if we remember some websites IP Addresses then we may not be able to access other websites on the internet if we do not have DNS records of that website. This is where DNS Records comes into picture which makes the Internet Surfing so easy by giving IP Addresses of the websites when we give URL to it.</p>
<h2 id="heading-types-of-dns-records">Types of DNS Records</h2>
<p>So you must have noticed i have repeatedly said DNS Records in above lines <strong><em>“So apart from IP Address which other Records are stored in DNS Server?”</em></strong> So let us see one by one about types of DNS Records.</p>
<h2 id="heading-ns-records"><strong>NS Records</strong></h2>
<p>NS Records are short for Name Server Records. They tell us which authoritative DNS servers control the DNS records for a domain</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769079609361/720bf8fe-bfc7-4da1-b58f-be2d60eb1147.png" alt class="image--center mx-auto" /></p>
<p>Look at the above image carefully it shows us NS Record which Authoritative DNS Server contains Records of <mark>.com</mark> domain which is in image as <em>example.com</em> DNS to which NS Records points.</p>
<h2 id="heading-a-record-address-record">A Record (Address Record)</h2>
<p>The first and most important record is the <strong>A Record</strong>.</p>
<p>When you type <a target="_blank" href="http://hitesh.ai"><code>hitesh.ai</code></a> in your browser, the browser needs the actual <strong>IP address</strong> of the server where the website is hosted.<br />This is exactly what an <strong>A record</strong> gives.</p>
<p>A record basically means: <a target="_blank" href="http://hitesh.ai"><code>hitesh.ai</code></a> <code>→ 123.45.67.89</code></p>
<h3 id="heading-real-life-example-house-address">Real-life example (House Address)</h3>
<p>Think of it like this:</p>
<ol>
<li><p><a target="_blank" href="http://hitesh.ai"><code>hitesh.ai</code></a> is the <strong>house name</strong></p>
</li>
<li><p><code>123.45.67.89</code> is the <strong>house address</strong></p>
</li>
</ol>
<p>You can’t reach the house by just knowing the name. You need the proper address, right?<br />Same thing happens on the internet. Without the A record, the browser has no idea where the website lives.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769081975054/09601120-62d8-413a-af44-6686bd5ffb48.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-aaaaa-records-domain-ipv4ipv6">A/AAAA Records (Domain → IPV4/IPV6)</h3>
<p>Look at the diagram where you can see:</p>
<ol>
<li><p>Client types <code>hitesh.ai</code></p>
</li>
<li><p>DNS server checks A/AAAA records</p>
</li>
<li><p>DNS returns IP like <code>192.168.2.2</code></p>
</li>
<li><p>Now client uses that IP to connect to the server</p>
</li>
</ol>
<p>So technically <strong>A Record = Domain name → IPv4 Address</strong></p>
<p>Example: <code>hitesh.ai</code> → <code>123.456.7.8</code></p>
<h2 id="heading-aaaa-record-ipv6-record">AAAA Record (IPv6 Record)</h2>
<h3 id="heading-what-problem-does-it-solve">What problem does it solve?</h3>
<p>AAAA record is also used to give IP address, but it gives the <strong>IPv6 address</strong>.</p>
<p>IPv6 is like the new version of IP addresses.</p>
<h3 id="heading-real-life-example-new-phone-number-format">Real life example (New phone number format)</h3>
<p>Old phone numbers were shorter (IPv4)<br />New phone numbers are longer (IPv6)</p>
<p>So basically,</p>
<ol>
<li><p>A record = old style address (IPv4)</p>
</li>
<li><p>AAAA record = new style address (IPv6)</p>
</li>
</ol>
<p>Example: <code>hitesh.ai</code> → <code>2606:2800:220:1d:2ab:1794:9712:733a</code></p>
<p>So, AAAA Record = Domain name → IPv6 Address</p>
<h2 id="heading-cname-record-nickname-record">CNAME Record (Nickname Record)</h2>
<h3 id="heading-what-problem-does-it-solve-1">What problem does it solve?</h3>
<p>Many websites work with both:</p>
<ul>
<li><p><code>hitesh.ai</code></p>
</li>
<li><p><code>www.hitesh.ai</code></p>
</li>
</ul>
<p>But both should open the same website, right?</p>
<p>Instead of writing IP twice, we use <strong>CNAME record</strong>.</p>
<h3 id="heading-real-life-example-nickname">Real life example (Nickname):</h3>
<ol>
<li><p>My real name is Pritesh, but my friends call me “Prit” sometimes.</p>
</li>
<li><p>Both names mean the same person.</p>
</li>
</ol>
<p>Same way:<br /><code>www.hitesh.ai</code> is like a nickname of <code>hitesh.ai</code></p>
<p>So CNAME record simply says:</p>
<p>“<a target="_blank" href="http://www.hitesh.ai">www.hitesh.ai</a> points to hitesh.ai”</p>
<p>A lot of beginners have confusion that links like <a target="_blank" href="http://hitesh.ai/cohort">hitesh.ai/cohort</a> can be redirected to <a target="_blank" href="http://chaicode.com/cohorts/webdev">chaicode.com/cohorts/webdev</a>. DNS cannot redirect paths like <code>/cohort</code>. That redirection is handled by the website server, not by DNS.</p>
<h2 id="heading-beginners-confusion-on-a-record-vs-cname-record">Beginners Confusion on A Record vs CNAME Record</h2>
<p>So to clear this confusion Think of A record like:<br /><strong>Contact name → phone number</strong><br />You type the name, you directly get the number (IP).</p>
<p>Whereas <strong><mark>CNAME record does NOT give an IP</mark>.</strong><br />It points one domain name to another domain name.</p>
<p>CNAME Record works like Nickname <strong>→</strong> Name. Just like “Prit” is not my phone number, it just points to “Pritesh”. <strong>I hope this clears the confusion.</strong></p>
<h2 id="heading-mx-record-mail-exchange-record">MX Record (Mail Exchange Record)</h2>
<p>Now let’s talk about emails.</p>
<p>If someone sends a mail to: <a target="_blank" href="mailto:support@hitesh.ai"><code>support@hitesh.ai</code></a></p>
<p><em>How does the internet know where to deliver it?</em> That is what <strong>MX record</strong> solves.</p>
<p>MX record tells the world:</p>
<p>“If you want to send email to this domain, deliver it to this mail server.”</p>
<p>Example:</p>
<p><a target="_blank" href="http://hitesh.ai"><code>hitesh.ai</code></a> <code>→</code> <a target="_blank" href="http://mail.hitesh.ai"><code>mail.hitesh.ai</code></a></p>
<h3 id="heading-real-life-example-post-office">Real-life example (Post office):</h3>
<ol>
<li><p>Websites are like houses.</p>
</li>
<li><p>Emails are like letters.</p>
</li>
</ol>
<p>When you send a letter, it doesn’t directly come to your home.<br />It goes through the post office system first.</p>
<p>Similarly, MX record is like the “post office address” for your domain email.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769085244182/3e6095d3-1097-4825-9e31-a9e7e7bcce1e.png" alt class="image--center mx-auto" /></p>
<p>In above MX diagram:</p>
<ol>
<li><p>Sending Mail Server sends the email</p>
</li>
<li><p>DNS checks MX record</p>
</li>
<li><p>MX record points to <a target="_blank" href="http://mail.example.com"><code>mail.example.com</code></a></p>
</li>
<li><p>Then Mail Server receives the email</p>
</li>
</ol>
<p>So MX record is mainly used for email routing.</p>
<h3 id="heading-beginners-confusion-on-ns-record-vs-mx-record">Beginners Confusion on NS Record vs MX Record</h3>
<p><strong><mark>NS record</mark></strong> tells us <strong>Which DNS servers control your domain?</strong></p>
<p>Example: <a target="_blank" href="http://piyushgarg.dev">piyushgarg.dev</a> → ns1.cloudflare.com</p>
<p>It is like <strong><em>“Which office holds the records of this area?”</em></strong> so NS Record tells us that Cloudflare manages DNS for <a target="_blank" href="http://piyushgarg.dev">piyushgarg.dev</a>.</p>
<p>Whereas <strong><mark>MX record</mark></strong> tells us <strong>Where emails for this domain should be delivered</strong></p>
<p>Example: <a target="_blank" href="http://hitesh.ai">hitesh.ai</a> → mail.hitesh.ai</p>
<p>This is “Where should letters (emails) be delivered?”</p>
<p>MX record answers: “Emails of <a target="_blank" href="http://hitesh.ai">hitesh.ai</a> should go to this mail server”</p>
<p>So i hope the difference between mail server and DNS Server clears this confusion.</p>
<h2 id="heading-txt-record">TXT Record</h2>
<p>So when everyone hears about TXT Records most of people think “What is a TXT record and why does everyone keep talking about it?”</p>
<p>It’s very simple a TXT record is just a record that stores plain text inside DNS. This text is mainly used for verification and security purposes.</p>
<p>Now <strong><em>“Why TXT Records even Exist? and why do we have to store plain text in DNS?”</em></strong> because without TXT records Anyone could pretend to send emails from your domain and services wouldn’t know if you actually own a domain also without TXT Records Spam and fake emails would be much easier.</p>
<p>TXT records solve these problems by adding verification rules inside DNS. TXT records work silently in the background but it’s importance cannot be underestimated.</p>
<h2 id="heading-how-all-dns-records-work-together-for-one-website-hiteshaihttphiteshai">How All DNS Records Work Together for One Website (<a target="_blank" href="http://hitesh.ai">hitesh.ai</a>)</h2>
<p>Till now we understood DNS records one by one, but the real magic happens when <strong>all of them work together</strong> for a single domain.</p>
<p>So let’s take the example of <a target="_blank" href="http://hitesh.ai"><strong>hitesh.ai</strong></a> and understand how everything connects using the diagrams.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769087167325/6e25107c-8a55-4fb9-91b2-84d8f77888e6.png" alt /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769087532371/27a17f0b-2a5b-4c30-ab8e-b31de4bce705.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-low-level-detailed-approach-of-what-these-diagrams-are-showing">Low Level (detailed) approach of - What these diagrams are showing</h3>
<p>Both diagrams together are showing just one thing:</p>
<p><strong>How a single domain like</strong> <code>hitesh.ai</code> uses multiple DNS records to:</p>
<ol>
<li><p>open a website</p>
</li>
<li><p>handle world wide web (<code>www</code>)</p>
</li>
<li><p>receive emails</p>
</li>
<li><p>and decide which DNS provider manages everything</p>
</li>
</ol>
<p>You can think of DNS like a <strong>well-organized address system</strong> instead of just one record.</p>
<h2 id="heading-step-by-step-what-happens-for-hiteshai">Step-by-Step: What Happens for hitesh.ai</h2>
<h3 id="heading-step-1-who-controls-dns-for-hiteshai-ns-record"><strong>Step 1: Who controls DNS for hitesh.ai? (NS Record)</strong></h3>
<p>From the diagrams, we can see entries like:</p>
<ol>
<li><p><code>hitesh.ai → ns1.cloudflare.com</code></p>
</li>
<li><p><code>hitesh.ai → ns2.cloudflare.com</code></p>
</li>
</ol>
<p>This is done using <strong>NS Records</strong>.</p>
<p><strong>NS records tell the internet which DNS servers are responsible for a domain.</strong></p>
<p><strong>Real-life analogy:</strong> <mark>NS record is like saying “For all information about this house, talk to this local post office.”</mark></p>
<p>So first Root DNS → points to <code>.ai</code> TLD (Top Level Domain) then <code>.ai</code> TLD → points to Cloudflare DNS after which Cloudflare → stores actual records of <code>hitesh.ai</code></p>
<p>Without NS records, <strong>no other DNS record would matter</strong>.</p>
<h3 id="heading-step-2-how-does-the-website-open-a-aaaa-record"><strong>Step 2: How does the website open? (A / AAAA Record)</strong></h3>
<p>From the diagram:</p>
<ul>
<li><p><code>hitesh.ai → 123.45.67.89</code> (A Record)</p>
</li>
<li><p><code>hitesh.ai → IPv6 address</code> (AAAA Record)</p>
</li>
</ul>
<p>This means <mark>when you type</mark> <a target="_blank" href="http://hitesh.ai">hitesh.ai</a> <mark>, the DNS converts it into an IP address after which Browser connects to that server and the Website loads.</mark></p>
<p><strong>Real-life analogy:</strong> <mark>A record can be said, “This house name is located at this exact street address.”</mark></p>
<p>So <strong>A Record Provides IPv4 address</strong> and <strong>AAAA Record provides IPv6 address</strong></p>
<p>Both do the same job, just for different IP versions.</p>
<h3 id="heading-step-3-what-about-wwwhiteshaihttpwwwhiteshai-cname-record"><strong>Step 3: What about</strong> <a target="_blank" href="http://www.hitesh.ai"><strong>www.hitesh.ai</strong></a><strong>? (CNAME Record)</strong></h3>
<p>In the diagram, we see <code>www.hitesh.ai → hitesh.ai</code></p>
<p>This is done using a <strong>CNAME Record</strong>.</p>
<p>It means <code>www.hitesh.ai</code> is just another name for the same website.</p>
<p><strong>Real-life analogy:</strong> <mark>CNAME is like saving “Mom” and “Mother” for the same phone number</mark></p>
<p>So browser first resolves <code>www.hitesh.ai</code> then DNS says: “Go to hitesh.ai” and only then A/AAAA record is used and finally Website opens.</p>
<p><strong><mark>Important beginner note:</mark></strong><br />CNAME never points directly to an IP. It always points to another domain name.</p>
<h3 id="heading-step-4-how-emails-work-for-hiteshai-mx-record"><strong>Step 4: How emails work for hitesh.ai? (MX Record)</strong></h3>
<p>From the diagram, <code>hitesh.ai → mail.hitesh.ai</code></p>
<p>This is done using <strong>MX Records</strong>.</p>
<p>MX records tell <strong>where emails should be delivered</strong>.</p>
<p>So when someone sends: hello@hitesh.ai</p>
<p>DNS checks MX record and says: “Deliver this email to mail.hitesh.ai”</p>
<p><strong>Real-life analogy:</strong> <mark>MX record is like saying, “All letters for this house should go to this mailbox building.”</mark></p>
<p>Without MX records Emails will fail even if your website works perfectly</p>
<h2 id="heading-how-all-records-work-together-high-level-approach">How All Records Work Together (High Level approach)</h2>
<p>For a single domain like <strong>hitesh.ai</strong>, DNS records work like this:</p>
<ul>
<li><p><strong>NS Record</strong> → Who manages DNS?</p>
</li>
<li><p><strong>A / AAAA Record</strong> → Where is the website hosted?</p>
</li>
<li><p><strong>CNAME Record</strong> → Are there alternate names like <code>www</code>?</p>
</li>
<li><p><strong>MX Record</strong> → Where should emails go?</p>
</li>
</ul>
<p>Each record solves a <strong>different problem</strong>, but together they make the website fully functional.</p>
<h2 id="heading-key-takeaways">Key Takeaway’s:</h2>
<ol>
<li><p><strong>A / AAAA</strong> → opens your website</p>
</li>
<li><p><strong>CNAME</strong> → alias / nickname</p>
</li>
<li><p><strong>MX</strong> → email delivery</p>
</li>
<li><p><strong>NS</strong> → DNS manager</p>
</li>
<li><p><strong>TXT</strong> → proof, security, trust</p>
</li>
</ol>
<p>DNS is not just about opening websites. It’s a complete system that connects domain names, servers, emails, and DNS providers together.</p>
]]></content:encoded></item></channel></rss>