Domain IP Lookup

A CNAME aliases a name, not an address

www.example.com

CNAME record

cdn.provider.net

target hostname

192.0.2.10

A record, final answer

DNS Fundamentals

CNAME Chains Explained: How DNS Aliases Resolve

7 min readBy Domain IP Lookup Team

A CNAME record makes one name an alias of another: the alias holds no address of its own, so resolving it means resolving its target instead. A chain forms when that target is itself an alias. The name you asked about becomes the start of a trail, and the resolver has to follow every link before it can hand back an address. Chains appear most often where services stack: your hostname points at a hosting platform's name, which points at that platform's edge network, which finally publishes the address records.

One chain, hop by hop

Take a three-link trail: www.example.com is a CNAME for host.provider.example, that name is a CNAME for edge.example.net, and only edge.example.net publishes address records. A browser asks a resolver for the A record of www.example.com. The authoritative server answers with the CNAME instead of an address, so the resolver starts over: it asks for the A record of host.provider.example, gets a second CNAME, and starts over again at edge.example.net. There it finally finds an A record, 203.0.113.10, and the trail ends. The AAAA trail is walked the same way, and it can end differently: a chain that reaches an address for IPv4 may find no AAAA at the final name.

The resolver does not keep the trail to itself. Its answer to the browser normally contains the whole chain: both CNAME records and the final address, in order. That is why a single lookup result can show a hostname first and an IP address last. The resolver also caches each link separately, each under its own TTL. While those cached copies last, the next lookup for www.example.com is answered straight from cache and nobody walks the trail again. The walking cost is paid only when a cache is cold or a link has expired.

One chain, written as the records that form it
www.example.com         CNAME  host.provider.example
host.provider.example   CNAME  edge.example.net
edge.example.net        A      203.0.113.10
edge.example.net        AAAA   2001:db8::10

What each extra hop costs

  • Cold-cache lookups: every hop is a separate question to a separate authoritative server, so a three-link chain can mean three rounds of queries before the first byte of an answer exists.
  • Change speed: each link is cached under its own TTL, and the chain as a whole changes only as fast as its slowest-expiring link lets go of the old trail.
  • Ownership: each link belongs to whoever runs that zone, and a link you do not control can be changed, renamed, or deleted without any notice reaching you.
  • Blast radius: a failure at any link breaks the whole trail, including links that are perfectly healthy, so the number of things that must all work grows with every hop.

The change-speed cost is the one that surprises people. Suppose you repoint www.example.com from one provider to another. Resolvers that already walked the old trail hold each old link until its TTL runs out, so some visitors keep following the old chain while others get the new one. Shortening one link's TTL does not fix this on its own: the effective wait is set by whichever cached link expires last. The TTL record guide covers how those lifetimes work; in a chain, they stack.

Most chains include at least one link in a zone you do not run, and that link is a dependency you cannot see change. Provider migrations make this concrete: a platform renames its customer hostnames, retires an old edge name, or moves accounts to a new target. Your first CNAME still looks correct in your own panel, because nothing in your zone changed. The trail behind it did. The failure often arrives late, when the provider finally shuts the old name down, and it arrives without warning because the provider's notice, if any, went to whoever owned the retired name. Keep chains as short as practical, write down which party controls each target, and check the full trail periodically instead of trusting the first link. Before closing an account or leaving a vendor, search your zone for aliases pointing at that vendor's hostnames, and repoint or remove them while the old service is still alive to test against.

How chains fail

PatternWhat you seeFix
Two aliases point at each otherResolution fails with an error and no address is returned; the resolver detects the loop and gives upPoint one of the names at a real target or publish an address record, so the trail has an end
The final target no longer existsYour first lookup looks healthy, but the trail ends in NXDOMAIN and the site stays downRestore the target name, or repoint your alias to a target that exists and serves the site
A middle target is mid-moveAnswers flip between old and new results, or fail for some visitors and not othersWait for the target's own change to finish, and keep its old service alive until the cached links expire
The chain grows hop by hop over yearsFirst lookups get slower, and some resolvers stop early because resolver hop limits varyRemove links that no longer earn their place, and point your name at the final target where you can

One place a chain cannot start is the zone apex. A CNAME at the apex would sit next to the SOA and NS records that every zone is required to hold there, and a name carrying a CNAME cannot hold other record types, so a standards-based zone cannot publish one. Providers that offer flattening or ALIAS records work around this by resolving the target themselves and answering with plain A and AAAA records. That is a provider feature with provider-specific behaviour, not a CNAME on the wire. The comparison of CNAME and A records covers the single-record choice in full.

Trace the chain before you change it

  1. Start at your own name

    Run your hostname through the CNAME lookup. If it returns a target, that target is the second link in the trail. Write it down.

  2. Repeat at each target

    Run the CNAME lookup again on the target, and keep going. Each name that answers with another CNAME adds a link; stop when a name returns no CNAME.

  3. Finish at the address records

    Run the final name through the DNS lookup and check its A and AAAA records. The trail is healthy only if the address at the end is the service you expect.

  4. Record the trail and its TTLs

    Before changing anything, write down every link in order with the TTL shown beside it. The longest TTL in the list is the minimum time the old trail can keep answering after your change.

What chains mean for mail and verification records

Some records are not allowed to point at an alias at all. The target of an MX record must be a host with address records of its own; RFC 2181 states that an MX target must not be an alias, and the same rule applies to the hostnames in NS records. In practice, pointing mail at a CNAME usually still works because the sending server quietly follows the alias, but it costs extra lookups, and strict or older software can treat the setup as broken. The failure is intermittent and confusing, which is worse than a clean error. A delegated zone whose NS hostnames are aliases can even fail resolution entirely at resolvers that refuse to chase them. If you inherit a zone, check that every MX and NS target resolves straight to A or AAAA records with no CNAME in between.

The mirror-image problem sits at the alias name itself. A name carrying a CNAME can hold no other record type, so nothing else can be published at that exact name. This bites during service onboarding: a platform asks you to prove ownership by adding a TXT record at www.example.com, but www is an alias, so the TXT record cannot exist there. The options are to put the token at a different name the platform accepts, use a file-based or meta-tag verification method instead, or move the alias. Teams lose hours to this because the record they add quietly lands at the apex or at a subdomain instead of the exact name that was requested.

  • Every MX target resolves directly to A or AAAA records, with no CNAME hop.
  • Nameserver hostnames in NS records are not aliases.
  • No service expects a TXT record at a name that is an alias.

When to keep a chain, and when to shorten it

A short chain into a provider you chose on purpose is usually fine. One or two hops is the normal shape of hosted services: the provider can renumber or move its edge addresses without asking you to edit your zone, and the costs stay small. Shorten the chain when the hops stop earning their keep: a middle link belongs to a vendor you left, links have stacked up across successive migrations, or your changes keep colliding with stacked TTLs during incidents. Point your name straight at the final target, or at an address you control where the provider allows it, then trace the new trail end to end to confirm it resolves. The general resolution walk shows where this chain-following sits inside a full lookup.

Key takeaway

A CNAME chain trades control for convenience: each hop is one more lookup when caches are cold, one more TTL to expire during a change, and one more owner who can break your site by editing their zone. Trace the whole trail, keep it short, and know who controls every link.

Need to check a domain's public DNS addresses? Use the Domain IP Lookup tool.

Free tools for this topic

CNAME chainDNS lookupDNS records

Frequently asked questions