DNS Magic and Internals

DNS Magic and Internals

·

3 min read

Your Web Browser Is Like a Dumb!

When you type a web address like chaicode.com, it doesn’t know how to get there. To actually visit a website, you need the IP address of the machine where the website is hosted.hink of an IP address as the website’s “phone number” — and without it, your browser is lost.

But somehow, every time you enter a web address, your browser figures it out.

How does it work? 🤔 Let’s break it down!

Imagine You Want to Call a Friend 🤝

One day, you want to call your best friend, Ashi Sharma. But there’s a problem: you don’t know their phone number. What do you do?

You grab your phone, open your contact book, and search for Ashi’s name. Once you find the number, you make the call. 📞

The internet works just like this:

  • Websites have IP addresses (the phone numbers of the web).

  • The internet uses a DNS (Domain Name System) as its contact book to look up these IP addresses. 🌐

NameDomainPhone NumberIP Address
Your Friend's Namechaicode.comTheir Phone Number2606:4700:3037::ac43:d5ac

The Browser’s Adventure Begins! 🗺

When you type a web address like chaicode.com, your browser goes on a journey to find the IP address. Here’s what happens step by step:

1. Checking Its Memory 🧠

First, your browser asks itself, “Have I been to this website before?” If the answer is yes, it remembers the IP address and takes you there immediately. If not, it says, “Hmm, I need help!” 🤷‍♂️

2. Asking a Helper

The browser reaches out to a big helper called a DNS resolver — like a librarian for the internet. The resolver knows exactly where to start looking.

3. Talking to the Root Server

The resolver’s first stop is a root server, which acts as the boss of all website names. The root server says, “Ah, you’re looking for a website that ends in .com. Let me guide you to the right place.” 👍

4. Visiting the .com Manager 🔎

Next, the resolver visits a server that manages all the .com websites. It asks, “Do you know where chaicode.com is?” The .com server replies, “Yes, I do! Go talk to the person in charge of chaicode.com.”

5. Finding the Right Address 🔐

Finally, the resolver talks to the Authoritative Name Server (ANS) for chaicode.com. The ANS, like the website’s caretaker, says, “Here’s the IP address you need: 123.456.789.10. Now you can visit chaicode.com!”

6. Bringing the Answer Back 🚗

The DNS resolver delivers the IP address to your browser. With this information, the browser connects to the server and displays the website. Magic!

Fun Fact About Subdomains 📖

Ever noticed something like course.chaicode.com? That’s a subdomain, like a separate room in a big house. Each subdomain serves a specific purpose. For example:

They’re part of the same house but serve different functions. Cool, right? 😎

Conclusion: From "Dumb" to "Smart" in Seconds! 🎉

Every time you use the internet, this amazing process happens behind the scenes in just a few seconds. Even though your browser starts off clueless, it becomes incredibly smart with help from DNS resolvers, root servers, and other helpers.

So, while your browser may seem “dumb” at first, it’s actually quite brilliant with a little help from its friends. 😄

The next time you visit a website, take a moment to appreciate the fascinating journey your browser takes to get you there. It’s like an epic treasure hunt, happening at lightning speed. ⚡