DNS Record Types Explained
MERN Stack Developer
Search for a command to run...
MERN Stack Developer
No comments yet. Be the first to comment.
What HTML is and why we use it HTML stands for HyperText Markup Language. It's not a programming language—it's a markup language used to structure content on the web. Why HTML Matters: Structures content: It tells browsers how to display text, image...
Introduction: The Problem of Styling Imagine you're designing a website with hundreds of paragraphs, dozens of buttons, and multiple navigation menus. You want to: Make all buttons blue Style the main heading differently from subheadings Change th...
Introduction: The HTML Writing Struggle Picture this: You are building a website, and you need to create a navigation menu with five links. Using traditional HTML, you'd type something like this: <nav> <ul> <li><a href=""></a></li> <li><a h...
When you type git commit, have you ever wondered what actually happens behind the scenes? Most developers use Git daily without understanding its internal machinery. This article pulls back the curtain to reveal how Git works at a fundamental level, ...
The Dark Ages of Software Development Picture this: It's 2005. You're a developer working on a critical project with three teammates. Your code lives on a pendrive that gets passed around like a hot potato. Sound familiar? If you've ever named a file...
DNS (Domain Name System) is like the phonebook of the internet.
When you type a website name (like example.com DNS), it translates that friendly name into a numeric address (like 192.0.2.1) that computers can understand.
A single website needs more than just one piece of information to work properly. It needs to know.
DNS records are individual entries in the DNS system that store different types of information about a domain. Each record type solves a specific problem
Where the website files are stored
Where to send emails
Who is in charge of managing the domain
How to handle different services (like mobile versions or subdomains)
NS stands for Name Server. Think of it like the property manager for an apartment building. When someone needs information about the building, they go to the property manager, who has all the details.
An NS record :- If you want to know anything about this domain ask these specific DNS servers—they're the official source.
Example:
example.com NS ns1.hostingcompany.com
example.com NS ns2.hostingcompany.com
Problem it solves: The internet is running out of IPv4 addresses! IPv6 is the newer, larger address system.
AAAA (pronounced "quad A") does exactly the same thing as an A record, but for IPv6 addresses instead. IPv6 addresses look like this.
Example:
example.com AAAA 2001:0db8:85a3::8a2e:0370:7334
Real-world: Some people still use landlines (IPv4), while others only have cell phones (IPv6). You might list both numbers so anyone can reach you.
Most modern websites have both A and AAAA records pointing to the same service.
CNAME stands for Canonical Name. It's like giving something a nickname. Instead of pointing directly to an IP address, a CNAME points to another domain name.
Example:
www.example.com CNAME example.com
shop.example.com CNAME shopify.mystore.com
The first line means "www.example.com is just another name for example.com—look up example.com instead."
Real-world : Your friend Rohit goes by "Bob." When someone asks for Bob, you say, "That's Rohit—look him up." You don't need to remember two separate addresses because Bob and Rohitt are the same person.
MX stands for Mail Exchange. This record tells the internet which server handles email for your domain.
Example:
example.com MX 10 mail.example.com
example.com MX 20 backup-mail.example.com
The number (10, 20) is the priority—lower numbers are tried first. If the first mail server is down, email gets sent to the backup.
Real-world: It's like telling people, "If you need to send me mail, send it to the Oak Street Post Office. If they're closed, try the Elm Street location."
NS record: Says, "Ask this DNS server for information about my domain."
MX record: Says "send emails to this mail server"
Both delegate responsibility, but for completely different jobs! NS is about DNS management; MX is about email delivery.
Why not just use A records for email? Because you might want your website hosted at one company and your email hosted at another (like Google Workspace or Microsoft 365).
TXT stands for Text. It's a flexible record type that can hold any text information. It's like the notes section of a contact card.
Common uses:
Proving you own the domain (for Google, Microsoft, etc.)
Email security (SPF, DKIM, DMARC)
Example:
example.com TXT "v=spf1 include:_spf.google.com ~all"
example.com TXT "google-site-verification=abc123xyz"
The first one tells email servers, "Only trust emails from Google's servers for this domain." The second one proves to Google that you own this domain.
Real-world : Like notes on a business card: "Preferred contact method: email" or "Member since 2026"
TXT records are also used for things like domain ownership verification when setting up services. A company might say, "Add this specific text to your DNS to prove you control this domain."
Let's see how a complete website uses multiple DNS records working in harmony. Imagine you run a small online store called shopexample.com.
; Name servers (who manages DNS)
shopexample.com NS ns1.cloudflare.com
shopexample.com NS ns2.cloudflare.com
; Website addresses
shopexample.com A 203.0.113.10
shopexample.com AAAA 2001:db8::10
www.shopexample.com CNAME shopexample.com
; Additional services
blog.shopexample.com A 203.0.113.50
api.shopexample.com CNAME api-gateway.cloud-provider.com
; Email routing
shopexample.com MX 10 mail.google.com
shopexample.com MX 20 backup-mail.google.com
; Verification and security
shopexample.com TXT "v=spf1 include:_spf.google.com ~all"
shopexample.com TXT "google-site-verification=xyz789"
The browser asks, "Where is shopexample.com?"
The DNS system checks the NS records: "The authoritative DNS servers are at Cloudflare; let me ask them."
Cloudflare's DNS responds with the A record: "shopexample.com is at 203.0.113.10."
Browser connects: Your browser now knows the IP address and loads the website!
The email server asks, "Where do emails for shopexample.com go?"
DNS returns the MX records: "Try mail.google.com first (priority 10), or backup-mail.google.com if that fails (priority 20)."
Email gets delivered to Google's servers, which handle your email.
The browser asks, "Where is www.shopexample.com?"
DNS returns the CNAME: "www.shopexample.com is an alias for shopexample.com."
DNS then returns the A record for shopexample.com: "That's at 203.0.113.10."
The browser connects to the same place as the main domain.
All these records work together like a well-organized filing system, each solving a specific problem and making the internet work seamlessly.