Use it when an alias does not resolve, or points to an unexpected target.
CNAME
A CNAME record makes one name an alias for another (canonical) name; the resolver follows the chain and returns the target's A/AAAA records. A name with a CNAME cannot have other record types.
1. A CNAME aliases one name to another.
2. Cannot coexist with other records at the same name.
3. Not allowed at zone apex.
4. Chains add lookups.
5. Target must resolve.
query alias → CNAME → target → A/AAAA
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
dig www.example.com +noall +answerVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Checking CNAMEs Verify boundary
dig www.example.com +noall +answer
dig www.example.com CNAME +short
nslookup -type=CNAME www.example.com
Follow the chain to the final A/AAAA record. Dangling CNAMEs pointing at deleted cloud resources can be taken over by attackers (subdomain takeover) — remove them.
Step 2 Verification & troubleshooting Narrow the fault
1. Record queried name/type and resolver.
2. Test reachability and UDP/TCP 53.
3. Query the recursive resolver.
4. Trace delegation/authority when needed.
Step 3 Common mistakes Narrow the fault
- CNAME at the zone apex.
- CNAME chains (several hops) slowing resolution.
- Other record types on the same name as a CNAME.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- A/AAAA map names to IPv4/IPv6; CNAME aliases one name; PTR is reverse lookup
- Recursive and authoritative roles answer different questions
- UDP 53 is common, while TCP 53 is required for some large replies and zone operations
- NXDOMAIN, NODATA, SERVFAIL and timeout indicate different boundaries; TTL controls cache lifetime.
dig <alias> CNAME— targetdig <alias> +short— resolved chain
ReferenceWhat it is1 section · depth on demand
Rules
- A CNAME cannot exist at the zone apex (example.com) alongside SOA/NS; use ALIAS/ANAME or flattening from the DNS provider.
- A name with a CNAME cannot have other records.
- Each extra CNAME in a chain adds a lookup.
Common use: www CNAME example.azurewebsites.net. to follow a provider's changing addresses.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
CNAME records
A CNAME makes a name an alias for another, canonical name. RFC 1034 describes the rules: the CNAME's data is the canonical name; if a CNAME is present at a node, no other data should be present there; and a resolver that finds a CNAME restarts its query at the canonical name, except when the query asked for the CNAME record itself.
Format
shop.example.net. 300 IN CNAME shop-prod.cdn.example.com.
shop-prod.cdn.example.com. 60 IN A 198.51.100.20
Resolution steps
| Step | Action |
|---|---|
| 1 | Client asks for shop.example.net A |
| 2 | Server finds a CNAME to shop-prod.cdn.example.com |
| 3 | Resolution restarts at the canonical name |
| 4 | The A record is returned along with the CNAME |
host$ dig shop.example.net A +noall +answer
shop.example.net. 300 IN CNAME shop-prod.cdn.example.com.
shop-prod.cdn.example.com. 60 IN A 198.51.100.20
host$ dig shop.example.net CNAME +short
shop-prod.cdn.example.com.
Rules and consequences
| Rule (RFC 1034) | Consequence |
|---|---|
| No other data at a CNAME node | A zone apex (example.net itself) can't be a CNAME, because it needs SOA and NS |
| Restart at the canonical name | Each alias adds a lookup |
| Long chains should be avoided | Slower, more fragile resolution |
| Loops and aliases to missing names are errors | Resolution fails |
Typical uses
| Use | Example |
|---|---|
| Pointing to a provider's host name | SaaS or CDN endpoints |
| Several service names on one host | www, app → web01 |
| Moving services | Change one target instead of many records |
Alternatives at the apex
Many DNS providers offer ALIAS/ANAME-style records that resolve the target server-side and return A/AAAA records, since a CNAME isn't allowed at the zone apex.
Documented example, not captured output.
Quick reference
A CNAME makes one name an alias of another, so several names can follow a single canonical record — useful when a service moves between servers or to a cloud provider. The resolver follows the alias and returns the final address. CNAMEs have restrictions that surprise people: they cannot share a name with other records, and authentication protocols and TLS certificates must recognise the alias name as well.
CNAME records alias one name to another canonical name; resolvers follow the chain.
intranet IN CNAME web01.corp.example.com.
dig intranet.corp.example.com +noall +answer
Rules: a CNAME cannot coexist with other records at the same name (so not at the zone apex — use ALIAS/ANAME/flattening where providers support it), chains add lookups, and services relying on Kerberos/TLS need SPNs/certificates for the alias name too.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in IP Services → DNS → CNAME. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc1034.html · confidence 94%