Image by https://unsplash.com/@jannerboy62
A Guide to DNS and Its Common Record Types
Last updated: July 3, 2025
Introduction
Have you ever wondered how typing a domain name into your browser brings you to the right website? Or how an email sent to you@example.com
finds its way to your inbox? The answer lies in a global directory service called the Domain Name System (DNS).
The DNS is often called the "phonebook of the internet," and at its heart are DNS records. Think of them as individual entries in this massive address book. Each record has a specific job, telling servers where to direct traffic for websites, email, and other internet services. Before we look at each record type, let's understand how the DNS uses them to find what you're looking for.
How the DNS Finds an Answer: The Resolution Path
When you type a domain name into your browser, it doesn't instantly know the IP address of the server it needs to connect to. Instead, it starts step-by-step process called DNS resolution.
Here's the journey:
-
The Query Begins: You type
www.example.com
into your browser and hit Enter. Your computer first checks its own local memory (cache) to see if it has visited recently. If not, it asks its designated Recursive Resolver. This is usually a server run by your Internet Service Provider (ISP) or a public service like Google's (8.8.8.8
) or Cloudflare's (1.1.1.1
). The recursive resolver is like the main switchboard operator for the entire company; its job is to go and find the answer on your behalf. -
The Resolver Asks the Root Server: If the recursive resolver doesn't know the answer either, it starts at the top of the hierarchy of the domain name system by asking one of the world's Root Nameservers where it can find information for
www.example.com
. The Root nameservers does not know that information specifically, but it does know where to find the Top Level Domain (TLD) server for.com
, so it returns that address as a response instead. (This is like the global HQ telling the operator which regional office to call). -
The Resolver Asks the TLD Server: The resolver then asks one of the TLD Nameservers for
.com
where it can find information forexample.com.
The.com
server does not track that information, but it does know what the authoritative nameservers that hold all the records is. It returns those addresses as a response to the resolver, which will will callns1.dns-provider.com
andns2.dns-provider.com
. (This is like the regional office giving the operator the direct number for the specific branch office). -
The Final Answer from the Authoritative Server: Finally, the recursive resolver asks
ns1.dns-provider.com
(the Authoritative Nameserver) for theA
record ofwww.example.com
. Because this server holds the actual zone file (the master list of records) forexample.com
, it knows the definitive answer and replies with the IP address, for example,127.0.0.1
. -
Caching and Response: The recursive resolver now has the IP address. It passes this answer back to your computer's web browser, which can now establish a direct connection to the server at that IP. Crucially, the resolver also caches (remembers) this answer for a period of time (defined by the record's time-to-live, or TTL). The next time someone on the same network asks for
www.example.com
, the resolver can provide the answer immediately from its memory without going through all those steps again. (Bonus points if you now realized that this why you might see warnings that records may take 24-48 hours to propagate across the DNS.)
Incredibly, this entire process, from your keyboard to the final answer, typically happens in milliseconds.
For visual learners, DNSMadeEasy did a great job illustrating this in the following video (though it does have a slightly dated SOPA/PIPA angle for a few moments).
Common DNS Record Types Explained
Now that you understand how the system finds the answers, let's look at the different types of common answers (records) it can provide.
A (Address) Record
- What it is: The most fundamental DNS record. It maps a hostname (like
www.example.com
) to an IPv4 address (like127.0.0.1
). - Common use case: Directing your web browser to the correct server when you visit a website.
AAAA (Quad-A) Record
- What it is: The IPv6 equivalent of an A record. It maps a hostname to a 128-bit IPv6 address (like
fe80:0:0:0:0:0:0:0
). - Common use case: Same as an A record, but for networks and clients that use the modern IPv6 protocol, which provides a vastly larger pool of addresses.
CNAME (Canonical Name) Record
- What it is: A CNAME record forwards one hostname to another hostname (the "canonical" or true name). It acts as an alias. For example,
ftp.example.com
could have a CNAME record pointing towww.example.com
. - Common use case: Pointing multiple services (like
www
andftp
) to the same server without having to update multiple A records if the server's IP changes. It's heavily used by platform services like GitHub Pages or Heroku to point your custom domain to their infrastructure.
MX (Mail Exchange) Record
- What it is: Specifies the mail server(s) responsible for accepting email on behalf of a domain. It includes a priority number; mail servers with lower numbers are tried first.
- Common use case: Directing an email sent to
you@example.com
to the correct mail server (like Google Workspace or Microsoft 365) for processing.
NS (Name Server) Record
- What it is: An NS record delegates a DNS zone to a specific set of authoritative nameservers. Every domain must have at least two for redundancy.
- Common use case: When you query the
.com
TLD nameservers forexample.com
, they respond with the NS records (e.g.,ns1.dns-provider.com
andns2.dns-provider.com
), telling your resolver, "Go ask those servers for the real answer."
SOA (Start of Authority) Record
- What it is: One of the most important, yet often overlooked, records. It contains administrative information about the zone, including the primary nameserver, the email of the domain administrator, the zone's serial number, and various timers that control how the zone is replicated.
- Common use case: Managing the replication of zone data between a primary and secondary nameserver to ensure they stay in sync by way of an updated serial number.
TXT (Text) Record
- What it is: Allows a domain administrator to store arbitrary text in the DNS. Originally for human-readable notes, it's now primarily used for machine-readable data.
- Common use case:
- SPF (Sender Policy Framework): A type of TXT record that declares which IP addresses are authorized to send email for the domain.
- DKIM (DomainKeys Identified Mail): Provides a public key used to verify that emails are authentic and have not been tampered with.
- Site Verification: Proving ownership of a domain to services like Google Search Console or Microsoft 365 by placing a unique token in a TXT record.
SRV (Service) Record
- What it is: A more detailed record that specifies the hostname and port number for specific services, not just the server's IP. It is used heavily for service discovery.
- Common use case: Used by modern protocols like SIP (for VoIP phones), XMPP (for instant messaging), and in Microsoft environments for locating domain controllers (
_ldap._tcp.dc._msdcs.example.com
).
A Note on the ANY Record
- What it is: An
ANY
query was a special type of DNS query that asked a nameserver to return all available records it had for a given hostname. - Why It's Discouraged: In practice, the
ANY
query was found to be inefficient and could be exploited for DNS amplification attacks (a type of DDoS attack). As a result, most modern public-facing DNS servers are configured to ignore or refuse to answerANY
queries. While it still exists in DNS specifications, it is no longer a reliable tool for public use.
Conclusion
Every time you browse the web, send an email, or use an online service, you are relying on this intricate system of DNS records working correctly behind the scenes. While you may only ever need to edit a few of these directly, understanding the role of each and the path a query takes to find them is a fundamental part of managing your own piece of the internet.