CNAME chasing

CNAME chasing refers to performing multiple DNS queries following one or more CNAME record answers from an initial query. A completely chased CNAME record answer includes at least one CNAME record answer and a final non-CNAME record answer.

Authoritative and recursive DNS resolvers perform CNAME chasing as part of their operation. Cloud DNS has its own CNAME chasing behavior rules which are described on this page. The Cloud DNS CNAME chasing behavior applies to VMs that use the metadata server IP address (169.254.169.254) as their name server, except when an alternative name server is defined in an outbound server policy.

Throughout this page, the term private zone means one of the following types of zones: a private zone with records, a forwarding zone, or a peering zone.

CNAME chasing behavior before January 5, 2027

The following tables describe the current Cloud DNS CNAME chasing behavior, in effect before January 5, 2027.

Chasing single CNAME record answers

Source of single CNAME record answer Cloud DNS resolver behavior
Cloud DNS response policy rule with a single CNAME record

Cloud DNS response policy rules that contain CNAME information in their local data can only contain a single CNAME record.

Cloud DNS doesn't chase the CNAME record by performing any subsequent queries.

Single CNAME record from a private zone with records

Cloud DNS tries to chase the CNAME record by performing subsequent queries in this order:

  • If the record matches a private zone authorized in that VPC network, Cloud DNS returns a record in that zone or NXDOMAIN.
  • If the record matches that VPC network's Compute Engine internal zone, Cloud DNS returns a Compute Engine internal DNS record or NXDOMAIN.
Single CNAME record from a private forwarding zone

Cloud DNS doesn't chase the CNAME record by performing any subsequent queries.

Single CNAME record from a peering zone

Cloud DNS tries to chase the CNAME record by performing subsequent queries in this order:

  • If the record matches a private zone authorized in the VPC network that's the target of the peering zone, Cloud DNS returns a record in that zone or NXDOMAIN.
  • If the record doesn't match a private zone authorized in the peering zone's target VPC network, Cloud DNS tries to chase the CNAME record by performing subsequent queries in this order in the VPC network for which the peering zone is authorized:
    • If the record matches a private zone authorized in that VPC network, Cloud DNS returns a record in that zone or NXDOMAIN.
    • If the record matches that VPC network's Compute Engine internal zone, Cloud DNS returns a Compute Engine internal DNS record or NXDOMAIN.
Single CNAME record from a public zone

Cloud DNS tries to chase the CNAME record by performing subsequent queries in this order:

  • If the record matches the VPC network's Compute Engine internal zone, Cloud DNS returns a Compute Engine internal DNS record or NXDOMAIN.
  • If the record matches a public zone, Cloud DNS returns a record in that matched public zone or NXDOMAIN.

Handling completely chased CNAME record answers

Source of completely chased CNAME record answer Cloud DNS resolver behavior
Completely chased CNAME record from a private zone with records, forwarding zone, or peering zone Cloud DNS returns the completely chased CNAME record.
Completely chased CNAME record from a public zone Cloud DNS returns the completely chased CNAME record.

CNAME chasing behavior starting January 5, 2027

The following tables describe the Cloud DNS CNAME chasing behavior starting January 5, 2027. For more information about those changes, see the announcement.

Chasing single CNAME record answers

Source of single CNAME record answer Cloud DNS resolver behavior
Cloud DNS response policy rule with a single CNAME record

Cloud DNS response policy rules that contain CNAME information in their local data can only contain a single CNAME record.

Cloud DNS tries to chase the CNAME record by performing subsequent queries according to the VPC name resolution order of the VPC network.

Single CNAME record from a private zone with records or a forwarding zone

Cloud DNS tries to chase the CNAME record by performing subsequent queries according to the VPC name resolution order of the VPC network.

Single CNAME record from a peering zone

Cloud DNS tries to chase the CNAME record by performing subsequent queries in this order:

  • If the record matches a private zone authorized in the peering zone's target VPC network, Cloud DNS returns a record in that zone or NXDOMAIN.
  • If the record doesn't match a private zone authorized in the peering zone's target VPC network, Cloud DNS tries to chase the CNAME record by performing subsequent queries according to the VPC name resolution order of the VPC network for which the peering zone is authorized.
Single CNAME record from a public zone

Cloud DNS tries to chase the CNAME record by performing subsequent queries according to the VPC name resolution order of the VPC network.

Handling completely chased CNAME record answers

Source of completely chased CNAME record answer Cloud DNS resolver behavior
Completely chased CNAME record from a private zone with records, forwarding zone, or peering zone Cloud DNS returns the completely chased CNAME record.
Completely chased CNAME record from a public zone

Cloud DNS tries to chase the first CNAME record in the chain by performing subsequent queries according to the VPC name resolution order of the VPC network.

If chasing the first CNAME record in the chain doesn't produce a record or NXDOMAIN answer, Cloud DNS continues to the next CNAME record in the chain, chasing it by following the VPC name resolution order. If no record or NXDOMAIN answer is returned by chasing all of the CNAME records in the chain, Cloud DNS returns the completely chased CNAME record answer that it obtained from the public zone.

For example, suppose Cloud DNS receives the following completely chased CNAME record answer from a public zone:

;; ANSWER SECTION:
www.example.com.           227   IN CNAME   cdn-provider.com.
cdn-provider.com.          136   IN CNAME   cdn-edge.com.
cdn-edge.com.               77   IN CNAME   customer.edge-provider.com.
customer.edge-provider.com. 10   IN A       203.0.113.47

Cloud DNS does the following:

  • Cloud DNS tries to chase the cdn-provider.com CNAME record by following the VPC name resolution order of the VPC network. If cdn-provider.com matches a response policy rule or private zone, Cloud DNS returns a record or NXDOMAIN. Otherwise, Cloud DNS continues to the next step.
  • Cloud DNS tries to chase the cdn-edge.com CNAME record by following the VPC name resolution order. If cdn-edge.com matches a response policy rule or private zone, Cloud DNS returns a record or NXDOMAIN. Otherwise, Cloud DNS continues to the next step.
  • Cloud DNS tries to chase the customer.edge-provider.com CNAME record by following the VPC name resolution order. If customer.edge-provider.com matches a response policy rule or private zone, Cloud DNS returns a record or NXDOMAIN. Otherwise, Cloud DNS returns the completely chased CNAME record answer that it received from the public zone.

What's next

  • To find solutions for common issues that you might encounter when using Cloud DNS, see Troubleshooting.