Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Updated
6 min read
DNS Record Types Explained

Before understading the DNS, we need to understand what is the Problem which solve by the DNS.

To start our discusson please follow this topic first

  1. Internet & Network Devices

In actuall world, when a user searches for something on a browser suppose google.com then Google has a server set up on the internet that obviously has a ip, but the browser doesn’t know that ip. So, as we can see, it is a problem. if browser doesn’t know the ip we can’t see the page or server response.

DNS ( Domain Name System ):

In the old days, we had a phonebook or a directory. What does this phonebook acutally did, when we want to call someone, we search the name of that person in the phonebook to get his/her number so that we can make a call.

DNS is also act like a phonebook, but for the server and the ip. where In the place of Name we store the domain name ex. google.com, and it’s corresponding ip.

But actually, DNS is much more than just ip only. To know more about the DNS, please follow this article:

  • DNS resolution

In this article, we are going to understand all the DNS record types descriptively.

DNS Record Types

There are multiple record but the most used are these on

  1. NS record

  2. A record

  3. CNAME record

  4. AAAA record

  5. MX record

  6. TXT record

Let’s make proper understanding of each one.

NS Record

To understand the NS record, we need to understand its need of it.
Assume you buy a domain from a particular domain provide,r assume in my case that is Hostinger. but web server is hosted on Vercel or Netlify.
So here is the problem comes i purcase the domain from hostinger and I want that the domain should be managed by netlify or vercel or any other service like Cloudflare. In that case a need for some entry that tells that this domain is mange my some other service.

Now, we understand the need, so here is what the NS record does
Each DNS service provider has its own NS
example
For Hostinger, it is like this

  • ns1.dns-parking.com

  • ns2.dns-parking.com

and same Cloudflare also have there own Nameserver

  • evangeline.ns.cloudflare.com

  • olof.ns.cloudflare.com

Now, in the DNS record, we store this record like this

google.comrecord type:value:TTL
@NSevangeline.ns.cloudflare.com14000

What does it mean that when a user searches for google.com, it first fetches the NS record, which is the authoritative domain of that requested domain? Then the browser goes to that DNS server for further requests until it gets an IP.

A Record

The record browser actually wants to see that the record is an A record. A record is the actual record that carries the requested domain's original IP address, where the server is located.

example.comrecord type:value:TTL
@A192.0.2.114400

The vast majority of websites only have one A record, but it is possible to have several. Some higher-profile websites will have several different A records as part of a technique called round robin load balancing, which can distribute request traffic to one of several IP addresses, each hosting identical content.

AAAA Record

DNS AAAA records match a domain name to an IPv6 address. DNS AAAA records are exactly like DNS A records, except that they store a domain's IPv6 address instead of its IPv4 address.

example.comrecord type:value:TTL
@AAAA2001:0db8:85a3:0000:

0000:8a2e:0370:7334 | 14400 |

CNAME Record

CNAME stands for Canonical Name. To understand this, try to understand the example first.
Suppose you have hosted a server on vercel and the version give you an ip. now due to some reasone may be vercel need some kind of relocation, then in that case, we need to change the ip because our server location has changed. So if in a particular region Vercel needs to chnage the server and vercel has a 1 million user base, then what Vercel does, vercel send email or some notification to all user that we change our ip you also need to change that from your end.
This is a problem. To solve that, what version does version give you some kind of app.vercel.com type domain, which is unique? You set a CNAME record that points to that domain, and Vercel internally sets the original server ip in the A record form on app.vercel.com

blog.example.comrecord type:value:TTL
@CNAMEis an alias of example.com32600

If a user sent a request to the browser for google.com, that request is sent to the authoritative server, and if there is no A record exist but a CNAME requred exist, it again makes a recursive call for that new domain until it finds the A record. Mean A record is the final destination.

MX record

A DNS MX (Mail Exchange) record tells which mail server will receive emails for a domain. It also helps decide how emails should be sent and routed, following SMTP, which is the standard rule/protocol used for sending email.

Example of an MX record:

example.comrecord type:priority:value:TTL
@MX10mailhost1.example.com45000
@MX20mailhost2.example.com45000

The email service could also configure this MX record so that both servers have equal priority and receive an equal amount of mail:

example.comrecord type:priority:value:TTL
@MX10mailhost1.example.com45000
@MX10mailhost2.example.com45000

This configuration enables the email provider to equally balance the load between the two servers.

A CNAME record is used to give a domain an alias name (like a shortcut) instead of using the real domain name. Usually, a CNAME points to an A record (IPv4) or AAAA record (IPv6).

But MX records cannot point to a CNAME. An MX record must directly point to the mail server’s A or AAAA record. According to official DNS/email rules (RFC), MX → CNAME is not allowed.

TXT Record

It allows domain owners to store custom text data in DNS.

SPF/DKIM/DMARC need to publish things like:

  • rules (policy text)

  • authorized mail servers list

  • public cryptographic key

  • Instructions for mail receivers

These are not IP addresses, so they can’t go in A/AAAA records.
They are not mail server hostnames, so they can’t go in MX records.
So they are stored as TXT records.

Meaning:

When someone receives an email from studyhex.in, the receiver mail server checks your DNS TXT records to verify:

  • SPF: Is this sender server allowed?

  • DKIM: Does the signature match the public key in DNS?

  • DMARC: What action should be taken if SPF/DKIM fails?

How do all these work together