Back to Blog

A, AAAA, CNAME, MX, TXT & SRV Records Explained

A, AAAA, CNAME, MX, TXT & SRV Records Explained
Command of the Day
dig any yourdomain.com

What it does: Queries authoritative DNS nameservers to retrieve all available DNS record types configured for a specified domain.

The Domain Name System (DNS) is often described as the phonebook of the Internet. Just as a contact list stores phone numbers, email addresses, and street locations for a person, DNS uses different record types to instruct browsers, mail servers, and game clients where to find specific services for a domain.

In this guide, we break down the most essential DNS record types used on Linux servers and RivinCloud VPS hosting.


1. Quick Reference Table

Record Type Purpose Example Value
A Maps hostname to an IPv4 address 192.0.2.1
AAAA Maps hostname to an IPv6 address 2001:0db8::1
CNAME Canonical Name / Alias pointing to another domain cdn.example.com
MX Mail Exchange server for receiving email 10 mail.example.com
TXT Arbitrary text (Domain verification, SPF, DKIM, DMARC) v=spf1 include:_spf.google.com ~all
SRV Service locator specifying custom ports and priorities 0 5 25565 mc.example.com
NS Nameserver record designating authoritative DNS servers ns1.rivincloud.in
PTR Reverse DNS mapping IP back to hostname vps01.rivincloud.in

2. Deep Dive into Record Types

1. A Record (Address)

The fundamental building block of the web. It translates a human-readable domain name directly into a 32-bit IPv4 address:

example.com.    300    IN    A    192.0.2.50

2. AAAA Record (Quad-A)

Identical in function to the A record, but maps to a 128-bit IPv6 address:

example.com.    300    IN    AAAA    2606:4700:4700::1111

3. CNAME Record (Canonical Name)

Acts as an alias pointing one domain name to another domain name (never directly to an IP).

blog.example.com.    300    IN    CNAME    myhostedblog.hashnode.network.

[!WARNING] According to RFC standards, a CNAME cannot coexist with other records on the root zone apex (@). Use CNAME Flattening or ALIAS records if your provider supports it.

4. MX Record (Mail Exchange)

Tells email servers around the world where to deliver incoming emails addressed to @yourdomain.com. Includes a Priority number (lower number = higher priority):

example.com.    300    IN    MX    10    aspmx.l.google.com.
example.com.    300    IN    MX    20    alt1.aspmx.l.google.com.

5. TXT Record (Text)

Stores human and machine-readable text data. Heavily used for:

  • Google / SSL Verification: Proving domain ownership.
  • SPF (Sender Policy Framework): Preventing email spoofing.
  • DKIM & DMARC: Cryptographic email authentication.
example.com.    300    IN    TXT    "v=spf1 mx include:_spf.google.com ~all"

6. SRV Record (Service Locator)

Allows protocols (like Minecraft, TeamSpeak, SIP, XMPP) to specify custom target ports and priorities without forcing users to type :25565:

_minecraft._tcp.play.example.com.    300    IN    SRV    0 5 25565 mc.example.com.

3. Querying DNS Records from Linux Terminal

Inspect specific record types using dig:

# Query A record
dig +short A example.com

# Query MX record
dig +short MX example.com

# Query TXT records
dig +short TXT example.com

# Query SRV record
dig +short SRV _minecraft._tcp.play.example.com

Common Mistakes

  • Pointing CNAME to an IP address: CNAME targets must be domain names (e.g., ghs.googlehosted.com), not raw IP addresses.
  • Missing trailing dot in BIND/Zone files: In raw zone files, example.com without a trailing dot becomes example.com.yourdomain.com.

Troubleshooting

  • Email marked as spam? Check your TXT records for missing SPF and DMARC configurations using dig TXT yourdomain.com.

Best Practices

  • Keep TTL values low (300 seconds) during server migrations so changes take effect rapidly.
  • Always use SPF, DKIM, and DMARC TXT records to ensure high email deliverability.

Frequently Asked Questions

What is the difference between an A record and a CNAME record?

An A record points a hostname directly to an IP address (192.0.2.1). A CNAME points a hostname to another hostname (alias.com -> target.com).


Conclusion

Understanding DNS record types allows you to route websites, configure business emails, and set up gaming servers effortlessly on your RivinCloud VPS!