Simplify your DNS with intelligent aliases.
The CNAME (Canonical Name) record creates an alias from one domain name to another. Instead of pointing directly to an IP like an A record, a CNAME points to another domain name that itself resolves to an IP. It's a powerful tool for simplifying DNS management.
CNAMEs are particularly useful for subdomains that need to point to third-party services (CDN, SaaS, hosting) or to centralize IP management. By changing the IP of the canonical domain, all CNAME aliases are automatically updated.
However, CNAMEs have important limitations: they cannot coexist with other records at the same level, and the root domain (apex) cannot have a CNAME. Understanding these rules is essential to avoid configuration errors.
CNAME creates an indirection in DNS resolution:
CNAMEs are used in many scenarios:
Follow these steps to create a CNAME:
Here are common CNAME configurations:
; www as alias for root domain
www.example.com. IN CNAME example.com.
; Subdomain to third-party service
blog.example.com. IN CNAME example.ghost.io.
shop.example.com. IN CNAME shops.myshopify.com.
mail.example.com. IN CNAME ghs.googlehosted.com.
; CDN Cloudflare (example)
cdn.example.com. IN CNAME example.com.cdn.cloudflare.net.
; SSL certificate validation
_acme-challenge.example.com. IN CNAME example.com.xxxxx.acme.zerossl.com.
; Verification with dig
$ dig www.example.com CNAME +short
example.com.
$ dig www.example.com +short
93.184.216.34
The CNAME points to another domain name (not an IP). Resolution follows the chain until reaching an A record. Note the mandatory trailing dot in zone files.
Avoid common CNAME pitfalls:
The DNS RFC states that a CNAME cannot coexist with other records. However, the apex always has at least SOA and NS. Some DNS providers offer ALIAS or ANAME as an alternative.
Slightly. A CNAME adds one DNS resolution step. In practice, with DNS caches, the impact is generally negligible (a few milliseconds).
No. If you have a CNAME for a name, you cannot have MX (or A, TXT, etc.) for that same name. This is why CNAMEs are used for subdomains, not the main domain.
That's the advantage! Your alias follows automatically. If cdn.provider.com changes IP, your cdn.example.com CNAME to them follows without modification on your side.
Use A if you directly control the IP and it's stable. Use CNAME if you're pointing to a third-party service or want to centralize IP management.
MoniTao can monitor CNAME records and alert you if the target changes. You can also monitor the final resolution (the IP after following the CNAME chain).
CNAME records are powerful tools for simplifying your DNS infrastructure. They allow delegating IP management to third-party services and centralizing your configurations. But they have strict rules that must be followed.
Use CNAMEs wisely, document your configurations, and monitor them with MoniTao to detect any unexpected changes in your DNS infrastructure.
Start free, no credit card required.