DNS Record Types
DNS uses different record types to map domain names to various services. Here's what each type does and when you would use it.
A Record
An A record maps a domain name to an IPv4 address (e.g., 192.0.2.1). This is the most fundamental DNS record and is what tells browsers which server to connect to when someone visits your website.
When to use it:
- Pointing your domain or subdomain to your hosting server's IP address.
- Pointing a subdomain to a different server (e.g.,
app.yourdomain.comto a VPS).
Example:
yourdomain.com. 14400 IN A 203.0.113.50
AAAA Record
An AAAA record is the IPv6 version of an A record. It maps a domain name to an IPv6 address (e.g., 2001:db8::1).
When to use it:
- When your server supports IPv6 and you want your site to be accessible over IPv6 connections.
- When a service provider gives you an IPv6 address to point your domain to.
Example:
yourdomain.com. 14400 IN AAAA 2001:db8::1
CNAME Record
A CNAME (Canonical Name) record creates an alias that points one domain name to another domain name. Instead of pointing to an IP address, it says "look up this other domain name instead."
When to use it:
- Pointing
www.yourdomain.comtoyourdomain.com. - Pointing a subdomain to a third-party service (e.g.,
blog.yourdomain.comtoyoursite.wordpress.com). - When a service gives you a hostname to point to instead of an IP address.
Example:
www.yourdomain.com. 14400 IN CNAME yourdomain.com.
yourdomain.com without www). It can only be used on subdomains. The root domain must use an A or AAAA record.
MX Record
MX (Mail Exchange) records specify which mail servers handle email for your domain. Each MX record has a priority value — lower numbers mean higher priority.
When to use it:
- Directing email to your hosting server's built-in mail service (configured automatically by cPanel).
- Routing email to an external provider like Google Workspace, Microsoft 365, or Zoho Mail.
Example (cPanel default):
yourdomain.com. 14400 IN MX 0 yourdomain.com.
Example (Google Workspace):
yourdomain.com. 14400 IN MX 1 aspmx.l.google.com.
yourdomain.com. 14400 IN MX 5 alt1.aspmx.l.google.com.
yourdomain.com. 14400 IN MX 5 alt2.aspmx.l.google.com.
TXT Record
TXT records store text data associated with your domain. They are used for a variety of purposes, most commonly domain verification and email authentication.
When to use it:
- SPF (Sender Policy Framework): Tells receiving mail servers which servers are allowed to send email from your domain. Helps prevent spoofing.
- DKIM (DomainKeys Identified Mail): Adds a cryptographic signature to outgoing email to prove it came from your domain.
- DMARC: Defines a policy for how receiving servers should handle email that fails SPF/DKIM checks.
- Domain verification: Proving ownership of your domain to services like Google, Microsoft, Facebook, or SSL providers.
Example (SPF record):
yourdomain.com. 14400 IN TXT "v=spf1 +a +mx +ip4:203.0.113.50 ~all"
Example (domain verification):
yourdomain.com. 14400 IN TXT "google-site-verification=abc123xyz"
SRV Record
SRV (Service) records define the location of specific services, including the hostname, port, priority, and weight. They are less common than other record types.
When to use it:
- Configuring Microsoft 365 (Skype for Business, Teams).
- Setting up XMPP/Jabber chat services.
- Pointing to game servers or other services that require specific port information.
Example (Microsoft 365 SIP):
_sip._tls.yourdomain.com. 14400 IN SRV 100 1 443 sipdir.online.lync.com.
SRV records follow the format: _service._protocol.name TTL IN SRV priority weight port target.
CAA Record
CAA (Certificate Authority Authorization) records specify which certificate authorities are allowed to issue SSL certificates for your domain.
When to use it:
- Restricting which CAs can issue certificates, adding an extra layer of security.
- If your organization requires specific SSL certificate vendors.
Example:
yourdomain.com. 14400 IN CAA 0 issue "letsencrypt.org"
Quick Reference
| Record Type | Points To | Common Use |
|---|---|---|
| A | IPv4 address | Website hosting |
| AAAA | IPv6 address | Website hosting (IPv6) |
| CNAME | Another domain name | Aliases and third-party services |
| MX | Mail server hostname | Email delivery |
| TXT | Text data | SPF, DKIM, DMARC, verification |
| SRV | Service location + port | Microsoft 365, VoIP, game servers |
| CAA | CA authorization | SSL certificate control |