Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Updated
4 min read
DNS Record Types Explained

How does a browser know where a website lives? If you know about “How DNS resolution works,” you may tell that the DNS resolver will get the IP of the server from the authoritative name server. Well, that’s ok, but how does the authoritative name server know the IP address of the server where the website is hosted? The answer is through DNS records, which are defined at the DNS zone on the authoritative name server. In this article we’ll learn about DNS records and will know about what problem each record solves.

Before jumping to the DNS records, let me explain briefly what DNS is. DNS (Domain Name System) is a system that converts human-readable domain names into IP addresses, which makes it possible to serve a website and do other things on the internet. Think of it like a phone book; the browser tells the DNS server, "Hey, what’s the IP of example.com?" The DNS server replies, “192.0.0.1 is the IP address of example.com,” and then a browser is able to request something from the actual web server. Now you have a basic or good understanding of DNS, let’s understand what DNS records.

DNS Record Types

The common DNS records are:

  1. A record.

  2. AAAA record.

  3. CNAME record.

  4. NS record.

  5. MX record.

  6. TXT record.

NOTE: There are more DNS records that are not used so much. If you want to read about those as well, you can read here.

Let’s understand each DNS record in detail.

A record

A stand for “address”; it is the main record used to store the IPv4 address of the server, which is then sent to the browser for accessing the resource.

AAAA record

Similar to the A record, but it stores the IPv6 record of the server. The IPv6 address solves the problem of the IPv4 address limit.

CNAME record

CNAME stands for “Canonical Name.” It does not point to an IP; it always points to another domain name. It acts as an alias to another domain. It simplifies management by allowing multiple subdomains or services to use the same underlying server. For instance blog.mursaleennisar.commursaleennisar.com217.21.87.95.

NS record

NS stands for “Name Server.” It defines the server that is responsible for DNS zones, which, in simple terms, holds the DNS records. It doesn’t store the IP address of the authoritative server, but it stores the URL of that, which is then converted into an IP address to reach that server.

MX record

MX stands for “Mail Exchange.” It tells other servers where to send the email of a specific domain. We can insert multiple MX records; each record has a priority value. A lower number means a higher priority, and the higher priority server handles it; if it’s unavailable, then the next server handles it.

TXT record

TXT stands for “Text.” It is a flexible type that stores the human-readable or machine-readable values. It is primarily used for domain ownership and verification purposes.

DNS Records Explained with a Practical Example

Let’s say we have a domain name, example.com, which is pointing to the hosting server through an A record. When we enter this domain name in the browser, the website will load. Now we’ve purchased an email like user@example.com on Google Workspace; this will be configured through the MX record, which will point to the Google Workspace mail server. Now we’ve set up the blog.example.com subdomain, which we want to connect to a different server like wordpressblog.com. We’ll add a CNAME in the DNS record to point it to that. For setting email security records like SPF, DKIM, and DMARK, we’ll add them via TXT record.

Conclusion

DNS records are stored inside the DNS zone of the authoritative server, which stores different DNS records for different purposes, like A for the IPv4 address of the server, AAAA for the IPv6 address of the server, MX for the mail server, TXT for verifications and domain ownership purposes, CNAME for pointing to another domain, and NS, which defines the authoritative server. A single domain uses multiple records together to connect various services on one single domain.

More from this blog

M

Mursaleen's Blog

13 posts