Skip to content
CNAME Chasing
step 1/5

Reading — step 1 of 5

Read

~1 min readRecord Types & Lookups

CNAME Chasing

A CNAME record says "this name is just an alias for another name". When a resolver gets a CNAME, it should follow the alias and try again.

www.example.com  CNAME  cdn.fastly.net
cdn.fastly.net   A      151.101.0.5

Query for www.example.com A:

  1. Server sees the CNAME at www.example.com.
  2. Adds the CNAME to the answer.
  3. Looks up cdn.fastly.net A — finds the A record.
  4. Adds the A record to the answer.
  5. Returns BOTH records.
;; ANSWER SECTION:
www.example.com.  300 IN  CNAME  cdn.fastly.net.
cdn.fastly.net.   60  IN  A      151.101.0.5

The client uses the A record but logs both for traceability.

CNAME rules:

  • A name with a CNAME cannot have other record types (RFC 1034 strictness; sometimes relaxed).
  • CNAMEs can chain: a -> b -> c. Most resolvers cap at 8-16 hops.
  • The zone apex (example.com) cannot be a CNAME (RFC 1034 again). Workarounds: ALIAS records (Cloudflare), ANAME (some providers), or just use A records pointing to the same IP as the CNAME target.

For this lesson: chase CNAMEs through the zone.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…