CNAME Lookup: Follow an Alias to Where It Ends Up
A CNAME makes one name an alias for another, and chains of them are where odd DNS problems hide. Enter a hostname to follow its aliases to the end, see the address it finally resolves to, and check for the two classic faults: a loop, and an alias pointing at a name that no longer exists.
Reading the results on this page
The result lists the name you typed, then each alias it passes through, one per line with an arrow between them, then the addresses of the last name. If the name isn't an alias, the page says so and shows its own addresses. The trace asks for one CNAME at a time and follows the first target it gets, up to eight hops. For the final name it lists the A and AAAA addresses, at most six, and leaves out private or reserved ones without a notice.
- Loop: a link points back at a name the chain already passed through, so the name can't resolve and visitors get an error.
- Cut off after eight hops: the chain is longer than the page follows. Treat that as a finding, because long chains are slow and fragile, then trace the last name shown to continue.
- Dangling: a later link points at a name that doesn't exist (NXDOMAIN), so no addresses are listed.
- An empty address list with no warning: the final name exists but has no public A or AAAA record, or every answer was private. Look the final name up with the DNS Lookup.
- An NXDOMAIN error on the first name means the name you typed isn't in DNS. That's a typo or a missing record, not a dangling alias.
How a CNAME works
Instead of repeating an IP address, a CNAME says “this name is the same as that one.” A resolver looks up the target and returns its answer. Companies use this to point www or shop at a hosting platform or CDN, so when the provider changes servers, nothing on your side has to change.
Chains are allowed: a can point to b, and b to c. Every extra hop costs a lookup, so keep them short. This tool follows up to eight.
Rules a CNAME has to follow
- A name with a CNAME can't have any other record type. No MX, no TXT, nothing.
- The root of a domain must hold SOA and NS records, so it can't be a CNAME. Some providers offer an ALIAS or “CNAME flattening” at the root, which resolves the target on their side and publishes plain A records.
- The target must be a host name: not an IP address and not a URL.
- A CNAME applies to every record type, so a lookup for MX or TXT on that name is answered from the target instead. Keep mail and text records on a name that has no alias.
- The target of an MX or NS record can't be an alias (RFC 2181, section 10.3), so a CNAME can't serve as a mail host or nameserver name.
Dangling CNAMEs: the quiet security hole
Say blog.example.com is an alias for example.hosting-platform.com. You cancel the hosting plan but forget the DNS record. The alias now points at a name that no longer exists, and on some platforms anyone can register that name and serve their own content on your subdomain. That's a subdomain takeover, and it's one of the most common DNS security findings.
Run your subdomains through the trace now and then. A chain that ends in “this name does not exist” is the one to delete.
The same trace on the command line
Documentation names again, so this is an illustration of the output shapes. A recursive resolver returns the whole chain in one answer, which is why dig shows all three lines. Asking for only the CNAME type returns just the first hop.
$ dig +noall +answer www.example.com www.example.com. 300 IN CNAME shop.example.net. shop.example.net. 60 IN CNAME edge.example.org. edge.example.org. 60 IN A 203.0.113.45 $ dig +short CNAME www.example.com shop.example.net. $ nslookup www.example.com Non-authoritative answer: www.example.com canonical name = shop.example.net. shop.example.net canonical name = edge.example.org. Name: edge.example.org Address: 203.0.113.45 PS> Resolve-DnsName www.example.com Name Type TTL Section NameHost ---- ---- --- ------- -------- www.example.com CNAME 300 Answer shop.example.net shop.example.net CNAME 60 Answer edge.example.org Name Type TTL Section IPAddress ---- ---- --- ------- --------- edge.example.org A 60 Answer 203.0.113.45
Look at the TTL column. Each link carries its own value, 300 and 60 here. Resolvers cache every link separately, so a change at the end of the chain reaches visitors on the end's schedule, not yours. If the provider moves the address behind edge.example.org, caches keep the old one for up to 60 seconds whatever TTL your own CNAME has. If you repoint your alias at a new target, caches keep the old target for up to 300 seconds. You only control the links in your own zone.
Problems the trace shows and what to do about them
| Trace shows | Likely cause | What to do |
|---|---|---|
| Loop warning | Two records alias each other, for example www pointing at the root while the root is set to alias back to www | Make one of them an address record, or point it at the real target, then trace again |
| Dangling warning | The target was deleted, expired or mistyped | If the service is gone, delete the record. If it's live, correct the target's spelling in the zone |
| Stops at eight hops | Aliases stacked by several services or by old migrations | Ask each provider for its final target and point your record straight at it |
| 'Not an alias' for a name you set up as a CNAME | The record is on a different name, your DNS host flattens it into address records, or the nameservers belong to another provider | Check the exact host name in the zone, then look up the domain's NS records |
| Addresses differ from what your browser reaches | The target answers differently by location or load, or a hosts file, VPN or proxy changes what your computer sees | Trace the name from more than one network and compare |
| An empty address list with no warning | The final name has no public address records yet, or only private ones | Wait for the provider to finish setup, or ask them for the address records to use |
Auditing your subdomains for dangling aliases
- Export the zone, or list every CNAME record your DNS host shows.
- Trace each one here. Anything flagged as dangling is a candidate for deletion.
- For every alias to an outside platform, confirm the account or resource still exists on that platform and is still yours.
- From now on, remove the DNS record in the same change that cancels a service, and don't leave it for later.
The trace only catches targets that no longer exist in DNS. In many takeover cases the target name still resolves, because a platform keeps answering for every name under its domain, and the unclaimed resource only shows up as an error page when you open the site. A clean trace is not proof that an alias is safe, so check the service side as well.
What a CNAME trace can't prove
- It reads public resolver caches, so a record you edited a few minutes ago may not appear yet.
- It can't see inside your DNS provider. A flattened or proxied record publishes plain address records, and the trace then calls the name 'not an alias'.
- A name should hold only one CNAME. If a misconfigured zone lists several, the trace follows the first target it receives.
- It doesn't open the site. A target can resolve and still refuse your host name, or serve a certificate for a different one.