Skip to content
Cloudflare Docs

Get started

Follow this guide to get started with Internal DNS.

Before you begin

API token configuration

Permissions

  • Account - DNS Views - Edit
  • Zone - DNS - Edit
  • Account - Account Settings - Edit
  • Zone - DNS Settings - Edit
  • Zone - Zone - Edit

Account Resources

  • Include - (Your account)

Zone Resources

  • Include - All zones

1. Set up your internal DNS zone

  1. Log in to the Cloudflare dashboard and select your account.
  2. Go to Internal DNS and select Create an internal zone.
  3. Give your internal zone a name.

Internal zone configuration conditions

  • Internal zones can contain the same DNS record types that Cloudflare supports for public zones.
  • An internal zone can have the same name as a public zone in the same account.
  • Each internal zone can be linked to multiple views1.
  • There can be several internal zones with the same name in one account. However, two internal zones with the same name cannot be linked to the same view.
  • Internal zones are not subject to any top-level domain (TLD) restrictions. This means that an internal zone can be created if its TLD is not registered publicly (for example, xyz.local), if it is created on the TLD itself (local), or even if on the root (.).

Footnotes

  1. Logical groupings of internal DNS zones that are referenced by Gateway resolver policies to define how a specific query should be resolved.

  1. Add DNS records to your internal zone using your preferred option:
  • Import a formatted BIND file.
  • Select Add a record and choose Create under the record type you want to add. Refer to DNS record types for details.
  1. Repeat this process for each internal zone you wish to add.

(Optional) Reference a zone from another zone

During an internal DNS query resolution, if no internal record is found within a matching internal zone, Cloudflare will check if the matching internal zone is referencing another internal zone. Successive references can be followed with a maximum of five references in a chain.

For details, refer to reference zones.

  1. Go to Internal DNS and select a zone.
  2. Within the selected zone, go to Reference zone.
  3. Select Add reference zone.
  4. Find the zone you want to use as reference and choose Select in the respective row.

Since the resolver policy will require a DNS view, you must have at least one view to be able to route requests to internal zones.

  1. Log in to the Cloudflare dashboard and select your account.
  2. Go to Internal DNS > Views.
  3. Select Create a view.
  4. Give your view a descriptive name.

DNS view configuration conditions

  • DNS views can be empty, with no internal zones linked to them.
  • A DNS view cannot contain public DNS zones 1.
  • Each internal DNS zone name must be unique within a given DNS view.
  • Each DNS view name must be unique within a given Cloudflare account.

Footnotes

  1. DNS zones that contain public DNS records and are accessible by public resolvers.

  1. Select Manage zones to add zones to your view. Select the internal zones that should be used to resolve queries sent by Gateway resolver to this view.
  2. Choose Save to confirm.

3. Configure Gateway policies

Besides selecting an internal DNS view when setting up your resolver policies, you can also enable the fallback through public DNS option.

  1. In Zero Trust, go to Gateway > Resolver policies.
  2. Select Add a policy and enter a name and description.
  3. Create an expression for the traffic you wish to route. For guidance about selectors, operators, and values, refer to Gateway.
  4. Select Use Internal DNS. Choose the view that queries matching the expression should be sent to.
  5. (Optional) Adjust the option to fallback through public DNS according to your use case.
  • Off: Gateway DNS resolver returns the response as-is to the client.
  • On: In case the response from the internal zone is REFUSED, NXDOMAIN, or a response with a CNAME type, Gateway DNS resolver sends the query to Cloudflare 1.1.1.1 public resolver and tries to resolve the query via public DNS.
  1. Select Create policy to confirm.

Once you add the Gateway resolver policy, it will be listed in the respective internal view under Resolver policies referencing this view.