Understanding DNS Record Types: A, AAAA, MX, TXT, and More
DNS (Domain Name System) records are essential components that tell the internet how to handle your domain and its services. Different types of DNS records serve different purposes. Here’s a detailed explanation of the most common DNS record types to help you understand their functions and uses.
1. A Record (Address Record)
The A record maps a domain name to an IPv4 address (a 32-bit IP address). It tells browsers where to find your website on the internet.
Example: example.com → 192.0.2.1
This is the most fundamental DNS record for hosting websites.
2. AAAA Record (IPv6 Address Record)
The AAAA record maps a domain name to an IPv6 address (a 128-bit IP address). IPv6 is the newer internet protocol designed to replace IPv4 due to address exhaustion.
Example: example.com → 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Use AAAA records if your server supports IPv6.
3. MX Record (Mail Exchange Record)
The MX record specifies the mail servers responsible for receiving email on behalf of your domain. It includes a priority value to determine the order of servers to try.
Example: Priority 10 → mail1.example.com
MX records are essential for email delivery and must be correctly configured for your email to work.
4. TXT Record (Text Record)
The TXT record allows domain owners to insert arbitrary text into the DNS. It is commonly used for:
- Verifying domain ownership (e.g., for Google Search Console)
- SPF (Sender Policy Framework) records to prevent email spoofing
- DKIM (DomainKeys Identified Mail) for email authentication
- DMARC policies to protect against phishing
Example: v=spf1 include:_spf.google.com ~all
5. CNAME Record (Canonical Name Record)
The CNAME record aliases one domain name to another. It is useful for pointing subdomains to the main domain or other domains.
Example: www.example.com → example.com
Note: CNAME records cannot be used on the root domain.
6. NS Record (Name Server Record)
The NS record specifies the authoritative DNS servers for your domain. These servers hold the DNS records for your domain and respond to DNS queries.
Example: ns1.exampledns.com
7. SRV Record (Service Record)
The SRV record defines the location (hostname and port) of servers for specified services, such as SIP, XMPP, or Microsoft services.
Example: _sip._tcp.example.com → sipserver.example.com:5060
8. PTR Record (Pointer Record)
The PTR record is used for reverse DNS lookups, mapping an IP address back to a domain name. It is often used for email server verification.
Summary Table
Record Type | Purpose | Example |
---|---|---|
A | Maps domain to IPv4 address | example.com → 192.0.2.1 |
AAAA | Maps domain to IPv6 address | example.com → 2001:db8::1 |
MX | Specifies mail servers for email delivery | Priority 10 → mail.example.com |
TXT | Stores text data for verification, SPF, DKIM, etc. | v=spf1 include:_spf.google.com ~all |
CNAME | Aliases one domain to another | www.example.com → example.com |
NS | Specifies authoritative DNS servers | ns1.exampledns.com |
SRV | Defines location of services | _sip._tcp.example.com → sipserver.example.com:5060 |
PTR | Reverse DNS lookup (IP to domain) | 1.2.0.192.in-addr.arpa → example.com |
Understanding these DNS record types helps you manage your domain effectively, ensuring your website, email, and other services work correctly and securely.