What are DNS records?
A brief overview of some DNS records and what they are used for.
What are DNS records?
If you have read my previous article, you will know that in order to translate a human-readable address like davidalex.ca
to a machine-readable address (IPv4 or IPv6), we need a DNS to resolve it for us. I can barely remember a phone number, so can you imagine trying to memorize an IPv4 address?
DNS records (a.k.a zone files) contain information that is stored on the Authoritative Name servers. They contain important information about the domain such as the admin contact information, the IPv4 address for that specific domain etc.
This information can be categorized in a format called DNS record. Each records lists specific information about the domain that is required to resolve queries to the authoritative name servers. In this article, I will explain a few common DNS records that are important and commonly used.
Types of DNS records
Before we get started, here is some information about DNS records. All records include a Time to Live (TTL) field, which defines how long the record is cached by DNS resolvers before they check for updates. The default TTL value is often 14,400 seconds (4 hours), but it can be adjusted based on the desired balance between faster updates and reduced DNS queries
A
An A record holds the IPv4 (not IPv6) address of the specified domain name. It also contains a field - Time to Live (TTL) that defaults to 14400. This value signifies the amount of time (in seconds) of how long the records will take to update any change to this records.
AAAA
An AAAA record (also known as a Quad-A record) maps a domain name to an IPv6 address. Unlike an A record, which holds an IPv4 address, an AAAA record stores a 128-bit alphanumeric IPv6 address, enabling support for the modern internet addressing system.
CNAME
A CNAME (Canonical Name) record maps one domain or subdomain to another domain, rather than to an IPv4 or IPv6 address. It is used when a domain or subdomain serves as an alias for another domain.
For example, blog.your-website.com
can point to your-website.com
. This means that when a DNS lookup is performed for blog.your-website.com
, the DNS server retrieves the address of your-website.com
instead.
Common Misconception: A CNAME record does not point to a specific webpage (e.g., your-website.com/blog
). Instead, it only maps one domain to another. Once the DNS resolves the alias, the web server must correctly handle requests to the subdomain, ensuring that users reach the intended content.
Fun fact -
www
is a common subdomain which is why often times, you can enterwww.your-website.com
and it will resolve toyour-website.com
. Go try it out…
MX
The MX (Mail Exchange) record indicates the mail server dedicated to the domain name. MX records usually have two entries - a primary and secondary mail server. Each record has a priority field indicating - like you guessed, the primary server.
TXT
The TXT (Text) record contains miscellaneous information about the domain. Today, they are primarily used from domain ownership verification and email spam prevention.
NS
The NS (Name Server) record is usually stored in two places and vary in information - TLD servers and Authoritative Name servers (in zone files).
The NS record identify which name servers are authoritative for the domain. In simpler terms, it indicates which name severs contain the DNS records for that domain.
The NS record in TLD is used for routing and delegation whereas in the Authoritative Name Servers, they are used for informative purposes.
SRV
The SRV (Service) record contains the location of servers for specified services. These service could include VoIP, instant messaging etc.
SOA
The SOA (Start of Authority) record contains administrative information about a DNS zone or a domain. SOA records list information such as the administrator’s email, zone serial number, the primary name server etc.
PTR
The PTR (pointer) record maps domain names for IP addresses. It is the exact opposite of what A and AAAA records. These records are often used for reverse DNS lookups, more specifically in email servers. They are used to verify if an email is sent from a trusted server. If they are not, they are flagged as spam.
Further reading…
If you are interested in learning more about DNS records and digging deep, here are some great articles and videos