DNS Explained: The Internet’s Phonebook (And How It Actually Works)
Introduction: How does the browser know?
When you open your browser and type in google.com, a page loads almost right away. But have you ever thought about how my computer knew where to find Google?
Computers don't talk in English; they talk in numbers. They don't know what "https://www.google.com/url?sa=E&source=gmail&q=google.com" means. They only know what IP addresses are, like 142.250.193.206.
So, how do we connect the name that people can read with the address that machines can read? The answer is DNS.
What is DNS?
Domain Name System is what DNS stands for.
The internet is like a huge contact list on your phone.
You (The Human) want to call your friend "Pramati." You don't remember her phone number, just her name.
Your phone (the computer) searches for "Pramati" in the contacts app and finds the number +91-98765xxxxx.
The Connection happens using the number, not the name.
The whole internet uses DNS as a contact list. It changes domain names (like hashnode.com) into IP addresses (like 104.22.x.x) so that your browser can access the site.
The Records: The Lines in the Phonebook
There is more to a DNS "Zone" than just one list. There are different kinds of records in it, and each one solves a different problem. Let's take them apart.
The NS Record (Name Server)
The Problem: "Who is in charge of this area?" We need to know who owns the list for that domain before we can look up a specific address.
The Answer: The NS Record. It tells the server that it can answer questions about your domain.
For Example, You walk into a huge office building. The NS record is the sign that tells you to go to the reception desk on the first floor for more information.
The A Record (Address)
The issue is, "Where does this website live?" This is the most common record. You have a name, and you need the IPv4 address.
The Answer: The A Record. It connects a domain name to an IPv4 address directly.
For example, if you look up "Pizza Hut" in the phone book, you will find the address "123 Main St."
For example, myapp.com points to 192.0.2.1.
The AAAA Record (Quad A)
The Problem: "We ran out of old addresses." The world is running out of IPv4 addresses (the short numbers). We are moving to IPv6, which are much longer, more complex addresses.
The Solution: The AAAA Record. It works exactly like the A record, but for IPv6.
Analogy: Your city ran out of 7-digit phone numbers, so now they issue 12-digit numbers. The AAAA record holds these new, longer numbers.
The CNAME Record (Canonical Name)
The issue is that "I have a nickname, but I want it to go to my real name." You might want www.mysite.com and blog.mysite.com to take you to the same place as mysite.com. You don't want to have to deal with three different IP addresses.
The CNAME Record is the answer. It directs one domain name to another domain name, not an IP address.
As an example, you want to connect to "The Rock" . The operator says, "Hold on a second while I connect you to Dwayne Johnson."
A vs. CNAME: Common Confusion
A Record: Points to a certain IP address. "Go to 123 Main St."
CNAME: Points to a different name. "Go to the place where John lives." You don't need to change the CNAME if John moves; you just need to change John's address.
The MX Record (Mail Exchange)
The issue is, "Where should the mailman leave the letters?" Your web server gets web traffic, but emails need to go to a mail server, like Gmail or Outlook.
The MX Record is the answer. It sends email sent to @yourdomain.com to the right mail server.
For example, Your house is like an A Record, and your mailbox is like an MX Record. The postman (email sender) brings the letter back if you don't have a mailbox.
The TXT Record (Text)
The Problem: "I need to leave a sticky note for verification." Services like Google or verification tools need to know you actually own the domain.
The Solution: The TXT Record. It allows you to store text information in your DNS settings. It doesn't affect where the website loads; it's just for reading.
Think of it like a sign on your door that says, "Leave packages with neighbor" or "Verified Home Owner."
Conclusion
With all of its acronyms, DNS can seem scary, but it's really just a way to organize things. It makes sure that when you ask for a file, an email, or a website, the internet knows exactly where to go.

