Skip to main content

Command Palette

Search for a command to run...

Mastering DNS Record Types

Updated
5 min read
Mastering DNS Record Types

DNS (Domain name system) is like the phonebook of internet. DNS converts website domain names into IP addresses. We as a Human it’s impossible to remember each and every IP address of a website we want to use. But it’s easy to remember domains. So we introduce DNS it is an internet system that can changes our domain into IP addresses so that browser can open that website and we can do our work.

Why do we need DNS Record Types

DNS records are the information stored in DNS which shows

  • Where the website is located

  • Where the emails would go

  • Who manages the domain

Suppose we open a company name it as “SONI Pvt Ltd” . DNS records will be like for diffrent departments of our company.

DepartmentDNS Record
Reception (website)A / AAAA
Email teamMX
Branch office aliasCNAME
Admin officeNS
Notes & rulesTXT

Why each DNS is needed

  1. A/ AAAA record

    It opens the website of the company. Without it we can’t open the website of our company.

  2. MX record

    Without it emails cannot be reached to our company

  3. CNAME record

    Without CNAME we can’t have alliance like www.soni.com we can’t use www. Or we can we that without CNAME www and non-www cannot work together.

  4. NS record

    NS is the domain controller. Without NS the domain is dead and no record of our domain will be found.

  5. TXT record

Used for Email security, Domain ownership verification, security policy . Without TXT record all the emails will go to spam and DNS services like hostinger, godaddy can’t be able to verify our domain.

DNS Record Types explained in detail:

A / AAAA Records

A records maps a domain to IPv4 address. What is IPv4? It is basically an Internet Protocol Version 4. It is a foundational system that assign unique 32bits numerical address like 132.21.22… to devices enabling them to communicate over the internet by routing data packets across networks. though its limited address pool (around 4.3 billion) led to the development of IPv6 to handle the growing number of connected devices. And that’s how AAAA got introduced. They maps domain to IPv6 address. But AAAA have 128 bits of numerical address.

Here the role of A / AAAA records is to connect the domain lets say Chaicode.com and its unique IPv4 address lets say 13.12.1 together.

CNAME Records:

CNAME means canonical name. Cname makes one domain name an alias of other. Unlike A/ AAAA record it does not points to a IP address but it always point to another Domain name.

For eg. www.chaicode.com and Chaicode.com are 2 different names but using CNAME we can redirect the user to our original website i.e Chaicode.com also they both will have same IP address bcoz of CNAME.

CNAME avoids duplication of websites .

chaicode.com A 203.0.113.25

www.chaicode.com CNAME chaicode.com

NS records:

NS records tells the browser that which DNS server are authoritative for our domain.

chaicode.com NS ns1.cloudflare.com chaicode.com NS ns2.cloudflare.com

NS records are stored at TLD server. We can check the NS by using “dig chaicode.com NS” in our terminal.What happens when you change NS?

Changing NS means:

  • You switch DNS provider

  • Old DNS stops working

  • New DNS becomes source of truth

⚠️ DNS propagation may take time (TTL).

MX Record:

MX means mail exchange record. It tells the browser that where the mails for our domain should deliver. For eg hello@chaicode.com

TXT Records:

TXT (Text) records store human readable instructions and proofs for a domain.
They’re mainly used for email security, domain verification, and policies.

Why TXT records exist?

DNS can’t just route traffic, it also needs to answer questions like:

  • “Is this server allowed to send email for this domain?”

  • “Does this domain really belong to you?”

  • “How should email receivers treat suspicious mail?”

TXT records are where these answers live.

Types of TXT records:

  1. SPF : it tells who is allowed to send emails at chaicode.com

  2. DKIM: In this Emails are cryptographically signed. Receivers can verify authenticity.

  3. DMARC: what to do if both SPF and DKIM fails ? Here comes the role of DMARC. If an email fails checks → quarantine it and send reports to Chaicode

  4. Domain verification : to check that is domain is under control or not.

How all DNS records work together for the same website?

Remember all DNS records dont do the same job. they all have different roles. Lets break it down to understand clearly.

  • NS Record: tells that who manages the domain.

  • A/AAAA Record : locates the Website and give IP address to browser

  • CNAME Record: creates the alias like www.chaicode.com

  • MX Record: Check where emails are going

  • TXT record: checks weather the email is trusted / domain verified.

Each record has a strict role todo that is why they dont clash with each other and works together for the same website. Website needs multiple DNS records to function properly.


Thank you for reading . Have a happy learning journey. I hope this article added some value for your given precious time.

More from this blog

VrajSoni.Blogs

9 posts