Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Published
•5 min read•View as Markdown
DNS Record Types Explained
M
I am currently pursuing a Bachelor of Technology in Computer Science and Engineering at Maharishi Markandeshwar (Deemed to be University), India. I have completed my Diploma in Computer Science & Engineering from Government Polytechnic, Purnea.

1. What DNS is (very simple)

  • DNS = Domain Name System.

  • It is like a phonebook for the internet.

  • You remember names like google.com, but computers need number addresses like 142.250.183.206 (an IP address).

  • DNS changes a domain name (like a contact name) into an IP address (like a house address).

Example:
You type example.com in your browser → browser asks DNS → DNS replies with a number address → browser goes to that server.


2. Why DNS records are needed

DNS is not just one big answer.
It has many small pieces of information called records.

  • Each record type answers a different question.

  • Example questions:

    • “Which server shows the website?”

    • “Which server gets emails?”

    • “Who manages this domain’s DNS?”

    • “Is this email really from this domain?”

These answers are stored as DNS records under your domain, like different entries under one contact in your phone.


3. NS record – who is responsible

NS Record = Name Server record.

  • It tells: “These servers are responsible for DNS of this domain.”

  • They are like the office where the main phonebook for your domain lives.

  • When the internet wants any DNS info for yourdomain.com, it first finds the NS records to know which DNS server to ask.

Example:
yourdomain.com → NS records say:

So the world knows: “Ask these name servers for all other records (A, MX, etc.) of this domain.”

Common confusion:

  • NS is about “who holds and answers the DNS records.”

  • MX is about “who receives emails.” (More on MX later.)


4. A record – domain → IPv4 address

A Record (Address record) connects a domain name to an IPv4 address (a normal-looking IP like 192.168.1.10).

  • Question it answers: “Where is the website server (IPv4)?”

  • It is like saying: “The house of example.com is at street number 93.184.216.34.”

Example:
example.com → A record → 93.184.216.34
So when someone visits example.com, the browser goes to that IPv4 address.

Common confusion (A vs CNAME):

  • A = points to a number address (IP).

  • CNAME = points to another name, not directly to an IP.


5. AAAA record – domain → IPv6 address

AAAA Record connects a domain name to an IPv6 address (a newer, longer IP like 2001:0db8::1).

  • Question it answers: “Where is the website server (IPv6)?”

  • It is like a second type of house address, but for IPv6.

  • You can have both A and AAAA records for the same domain, so it works on both IPv4 and IPv6 networks.

Example:
example.com → AAAA record → 2001:db8::1234


6. CNAME record – one name to another name

CNAME Record (Canonical Name) points one domain name to another domain name, not to an IP.

  • Question it answers: “If someone asks for this name, which other name should they use?”

  • It is like a contact in your phone: “Call ‘My Work Site’ → actually call ‘maincompany.com’.”

  • The final IP will come from the A/AAAA record of the target name.

Example:

So the flow is:

www.example.com → (CNAME) → example.com → (A) → 93.184.216.34

Common confusion (A vs CNAME):

  • Use A when you want to point directly to an IP address.

  • Use CNAME when you want this name to follow another name (and use its IPs).


7. MX record – how email finds your mail server

MX Record (Mail eXchanger) tells which server handles email for a domain.

  • Question it answers: “Where should emails for this domain be delivered?”

  • It is like telling the post office: “For letters to this domain, send them to this mail center.”

  • MX records usually point to a name, not a raw IP, and that name will have its own A/AAAA record.

Example:
For mycompany.com:

When someone sends an email to hello@mycompany.com:

  1. Email server checks MX for mycompany.com.

  2. Finds mail.mycompany.com.

  3. Looks up A/AAAA for mail.mycompany.com.

  4. Sends the email to that IP address.

Common confusion (NS vs MX):

  • NS = “Who answers DNS questions for this domain?”

  • MX = “Who receives emails for this domain?”


8. TXT record – extra info and verification

TXT Record stores text information under your domain.

  • Question it answers: “What extra info does this domain want to share?”

  • Often used for:

    • Email security (SPF, DKIM, DMARC).

    • Domain ownership verification (Google, Microsoft, etc.).

    • Other small notes for machines to read.

Example uses:

  • SPF (which servers can send mail for your domain)

  • Verification:

    • google-site-verification=some-random-code

These look scary, but think of TXT as sticky notes attached to your domain for other services to read.


9. How all DNS records work together for one website

Imagine you have a small website: mycoolsite.com with a blog and email.
Here is how records might work together:

High-level flow (simple story):

  1. Browser: “I want www.mycoolsite.com.”

  2. DNS:

  3. Browser goes to that IP and loads the website.

  4. When someone sends mail to hello@mycoolsite.com:


10. Gentle recap in simple words

  • DNS is the phonebook of the internet.

  • NS: who keeps the phonebook for your domain.

  • A: name → IPv4 address (house number).

  • AAAA: name → IPv6 address (newer house number style).

  • CNAME: name → another name (like a nickname).

  • MX: where emails should be delivered.

  • TXT: extra notes for security and verification.