Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Updated
4 min read

What Is DNS Record And Why Is It Needed

When you type a website name in a browser, the browser does not know where that site lives. Humans use domain names like google.com and computers use server IP addresses to locate the respective servers and all the operations like accessing the domain and serving back to us. The process of resolving domain name with IP address is done with DNS. DNS is the phonebook of the internet.

DNS is responsible for figuring out IP address of the server where the domain is pointing to.

DNS records store information about a domain. Each record has a specific job like pointing a website to a server or telling email where to move the traffic towards or where to go to find the IP address of that domain. It is one of the most important part of internet. Without DNS, we would have very hard time to navigate through websites this easily.

DNS In Real Life?

Let’s understand the separation of concerns about each layer by following real life example considering I’m sending a parcel to my friend from Bangalore to Delhi. (Each step in the process below is concerned and knows about the next stage and nothing beyond that and that is how DNS works too)

  1. I’ll go to local courier office nearby from my home with address delivery indicated in the package.

  2. The courier office will send the package to the cargo hub of my city which will to send the package to cargo hub in Delhi. The cargo operator doesn’t know where my package will be delivered to precisely. He only knows that he has to deliver it to cargo hub in Delhi.

  3. Once the package is received in cargo hub in Delhi, it will be then forwarded to the respective courier office of the specific region where it is supposed to be delivered to. The hub only concerns about in which region of the Delhi it has to be sent and in which branch my package should be sent to for delivery.

  4. Once the package is received in the responsible courier office branch, a delivery agent will then check which part of the area (based on pin code mostly) is my package is supposed to be delivered to and contact my friend that he is coming to deliver it and ask for his actual precise location.

  5. Once delivery agent gets precise location, he will then deliver the package to my friends place.

If you want to know more about how dns works, check out my in-depth article on it here.


What Are NS Records ?

NS stands for ‘nameserver’ and the nameserver record indicates which DNS server is authoritative for that domain (server containing the actual DNS records for that domain).

These authoritative servers have the final answers about that domain name resolution. The final answer includes different DNS records like A record, AAAA record, MX record and so on…

If you want to know more about DNS records, check this article from cloudflare

Common DNS Records

Following is the list of the most commonly used record types

DNS Record TypeUsage
AThe record that holds the IP address of a domain
AAAAThe record that contains the IPv6 address for a domain
CNAMEForwards one domain or subdomain to another domain, does NOT provide an IP address
MXDirects mail to an email server
TXTLets an admin store text notes in the record. These records are often used for email security
NSStores the name server for a DNS entry

Comparing Common DNS Records

Let’s cover a bit more of some of the common DNS records which are slightly confusing and may appear as similar to someone who doesn’t have much hands on with the DNS.

A Record vs CNAME

A record is always the final source of truth of DNS lookup. It holds the IPV4 of the server from where the domain is being served where as CNAME record is like a another name we have given to the actual domain name. It will always comes and resolve back as the actual domain name.

CNAME record does not have to be in the same DNS zone as the domain it points to. It is a global pointer that can link an alias to any valid domain name on the internet.

For example: If I’ve hosted a pet project on netlify, it will give me a hosted domain in format of <somename>.netflity.app I can instead add a CNAME record and use somename.pank.cloud to point it from my own subdomain.

NS vs MX

MX records tell email where to go. It tell email servers where to deliver emails for a domain. They point to mail servers, not website servers. example: writing a special delivery office on a letter instead of a house address. On the other side, NS records say who controls the domain.

MX records say where emails should be delivered while NS controls the domain. MX controls email and receives. NS answers questions about authoritative servers.

CC26

Part 20 of 21

All the technical writings related to cohort for cohort 2026 from ChaiCode bootcamp are listed here.

Up next

Why Version Control Exists: The Pendrive Problem

content is being updated…