Skip to content
inetGeek

CNAME record

CNAME

A CNAME record points one name at another name rather than at an address. The lookup then continues from the target.

Check this on a domain with DNS Lookup →

01.

What a CNAME does

A CNAME — canonical name — declares that a name is an alias for another name. A resolver that finds a CNAME restarts the lookup against the target and returns whatever it finds there.

This is why a CNAME is the usual way to point a subdomain at a hosting provider: the provider can change the underlying addresses without you touching your zone.

02.

A CNAME excludes everything else

RFC 1034 is explicit that a name with a CNAME may not have other record data. The CNAME replaces the whole name, so it cannot sit alongside an MX, TXT or A record at the same label.

This is the single most common source of CNAME errors. Adding a TXT record for domain verification to a name that already has a CNAME produces a zone that is invalid, and providers will usually refuse it.

03.

Why not at the apex

The apex of a zone must carry NS and SOA records. Since a CNAME excludes other records, the apex cannot be a CNAME, and an A or AAAA record is needed instead.

Several DNS providers work around this with a proprietary flattening feature that resolves the target and serves the result as address records at the apex. It behaves like a CNAME to the outside world but is not one.

04.

Chains

A CNAME may point at another CNAME. Each step is an extra lookup, so long chains add latency, and resolvers impose their own limits on how many they will follow before giving up.

A chain that loops back on itself never resolves. Resolvers detect this and return a failure rather than looping forever.

Following a chainwww.example.com
Hops2

Illustrative names. Every CNAME hop is one more lookup before the client has an address; a hop that points back into the chain never resolves.

Related records