Applying Cloud DNS Server Policies | Cloud DNS Documentation
Total Page:16
File Type:pdf, Size:1020Kb
8/23/2020 Applying Cloud DNS server policies | Cloud DNS Documentation Applying Cloud DNS server policies This page describes how to congure Cloud DNS server policies and use them with Virtual Private Cloud (VPC) networks. Before you use this page, familiarize yourself with Cloud DNS concepts (/dns/docs/overview#dns-server-policy). Before you begin The Cloud DNS API requires that you create a Google Cloud project and enable the Cloud DNS API. If you are creating an application that uses the REST API, you must also create an OAuth 2.0 client ID. 1. If you don't already have one, sign up for a Google account (https://accounts.google.com/SignUp). 2. Enable the Cloud DNS API in the Cloud Console (https://console.cloud.google.com/start/api?id=dns&credential=client_key). You can choose an existing Compute Engine or App Engine project, or you can create a new project. 3. If you need to make requests to the REST API, you will need to create an OAuth 2.0 ID: Setting up OAuth 2.0 (https://support.google.com/cloud/answer/6158849). 4. Note the following information in the project that you will need to input in later steps: The client ID (xxxxxx.apps.googleusercontent.com). The project ID that you wish to use. You can nd the ID at the top of the Overview page in the Cloud Console. You could also ask your user to provide the project name that they want to use in your app. If you have not run the gcloud command-line tool previously, you must run the following command to specify the project name and authenticate with the Cloud Console: d auth login https://cloud.google.com/dns/docs/policies/ 1/10 8/23/2020 Applying Cloud DNS server policies | Cloud DNS Documentation To choose a different project than one you have chosen previously, specify the --project option at the command line. Creating DNS server policies Each DNS server policy object can dene any of the following server policies: An inbound server policy (/dns/docs/overview#dns-server-policy-in), enabling inbound forwarding An outbound server policy (/dns/docs/overview#dns-server-policy-out), specifying one or more alternative name servers Both an inbound and an outbound server policy Each VPC network can reference no more than one DNS server policy. If you need to dene both inbound and outbound forwarding for a VPC network, create one policy that denes both an inbound and an outbound policy. For more information on DNS server policies, see DNS server policies (/dns/docs/overview#dns-server-policy). Creating an inbound server policy To create an inbound server policy, follow these instructions. Cloud DNS creates a set of inbound forwarder IP addresses in each VPC network where the policy applies. After you've created your policy, you can list the entry points (#list-in-entrypoints) that Cloud DNS creates. gcloud To create a new inbound server policy, use the dns policies create (/sdk/gcloud/reference/dns/policies/create) command: gcloud dns policies create name \ --description=description \ --networks=vpc-network-list \ --enable-inbound-forwarding https://cloud.google.com/dns/docs/policies/ 2/10 8/23/2020 Applying Cloud DNS server policies | Cloud DNS Documentation Replace the following command options: name: A name for the policy description: A description for the policy vpc-network-list: A comma-delimited list of VPC networks where inbound forwarding addresses must be created Creating an outbound server policy You can create an outbound server policy to modify the name resolution order (/dns/docs/overview#vpc-name-resolution-order) of a VPC network by directing all DNS queries to an alternative name server. To do so, follow these instructions. Before you begin, ensure that you understand the differences between standard and private routing (/dns/docs/overview#altns-targets) and the network requirements (#rewall-rules) for alternative name servers. gcloud To create a new outbound server policy, use the dns policies create (/sdk/gcloud/reference/dns/policies/create) command: gcloud dns policies create name \ --description=description \ --networks=vpc-network-list \ --alternative-name-servers=alternative-nameserver-list \ --private-alternative-name-servers=private-alternative-nameserver-list Replace the following command options: name: A name for the policy description: A description for the policy vpc-network-list: A comma-delimited list of VPC networks that query the alternative name servers alternative-nameserver-list: A comma-delimited list of IP addresses to be used as alternative name servers. Private routing is only used for alternative name servers that have RFC 1918 addresses. https://cloud.google.com/dns/docs/policies/ 3/10 8/23/2020 Applying Cloud DNS server policies | Cloud DNS Documentation private-alternative-nameserver-list: A comma-delimited list of IP addresses to be used as alternative name servers, accessed using private routing. For more information, see Alternative name servers and routing methods (/dns/docs/overview#altns-targets). Creating a server policy for both gcloud To create a new DNS server policy for both inbound and outbound forwarding, use the dns policies create (/sdk/gcloud/reference/dns/policies/create) command: gcloud dns policies create name \ --description=description \ --networks=vpc-network-list \ --alternative-name-servers=alternative-nameserver-list \ --private-alternative-name-servers=private-alternative-nameserver-list \ --enable-inbound-forwarding Replace the following command options: name: A name for the policy description: A description for the policy vpc-network-list: A comma-delimited list of VPC networks where inbound forwarding addresses must be created and that must query the alternative name servers alternative-nameserver-list: A comma-delimited list of IP addresses to be used as alternative name servers. Private routing is only used for alternative name servers that have RFC 1918 addresses. private-alternative-nameserver-list: A comma-delimited list of IP addresses to be used as alternative name servers, accessed using private routing. For more information, see Alternative name servers and routing methods (/dns/docs/overview#altns-targets). Listing inbound forwarder entry points When an inbound server policy applies to a VPC network, Cloud DNS creates a set of regional internal IP addresses that serve as destinations to which your on-premises systems or name https://cloud.google.com/dns/docs/policies/ 4/10 8/23/2020 Applying Cloud DNS server policies | Cloud DNS Documentation resolvers can send DNS requests. These addresses serve as entry points to the name resolution order (/dns/docs/overview#vpc-name-resolution-order) of your VPC network. Google Cloud rewall rules do not apply to the regional internal addresses that act as entry points for inbound forwarders. Cloud DNS accepts TCP and UDP trac on port 53 automatically. Each inbound forwarder accepts and receives queries from Cloud VPN tunnels or Cloud Interconnect attachments (VLANs) in the same region as the regional internal IP address. gcloud To list the set of regional internal IP addresses that serve as entry points for inbound forwarding, use the compute addresses list (/sdk/gcloud/reference/compute/addresses/list) command: gcloud compute addresses list \ --filter='purpose = "DNS_RESOLVER"' \ --format='csv(address, region, subnetwork)' Updating DNS policies Changing VPC networks When you change the list of VPC networks to which a DNS policy applies: If the policy species an inbound policy, entry points for inbound forwarders are created in VPC networks as needed If the policy species an outbound policy, the name resolution order (/dns/docs/overview#vpc-name-resolution-order) of each VPC network is updated to direct all requests to an alternative name server gcloud To modify the list of networks to which a DNS server policy applies, use the dns policies update (/sdk/gcloud/reference/dns/policies/update) command: https://cloud.google.com/dns/docs/policies/ 5/10 8/23/2020 Applying Cloud DNS server policies | Cloud DNS Documentation gcloud dns policies update name \ --networks=vpc-network-list Replace the following command options: name: A name for the policy vpc-network-list: A comma-delimited list of VPC networks to which the policy applies. The list of VPC networks that you specify replaces the previous list. Enabling or disabling inbound forwarding You can enable inbound forwarding for a DNS server policy that denes only an outbound policy (alternative name server). You can also disable inbound forwarding for an existing DNS policy. gcloud To enable inbound forwarding for a DNS server policy, use the dns policies update (/sdk/gcloud/reference/dns/policies/update) command: gcloud dns policies update name \ --enable-inbound-forwarding To disable inbound forwarding for a DNS server policy, use the dns policies update (/sdk/gcloud/reference/dns/policies/update) command: gcloud dns policies update name \ --no-enable-inbound-forwarding Replace the following command options: name: The name of the policy https://cloud.google.com/dns/docs/policies/ 6/10 8/23/2020 Applying Cloud DNS server policies | Cloud DNS Documentation Listing DNS policies gcloud To list DNS server policies in your project, use the dns policies list (/sdk/gcloud/reference/dns/policies/list) command: gcloud dns policies list Deleting a DNS policy gcloud To create a server policy, use the dns policies delete (/sdk/gcloud/reference/dns/policies/delete) command: gcloud dns policies delete name Replace the following command options: name: The name of the policy to remove Alternative name server network requirements When Cloud DNS sends requests to alternative name servers, it sends packets with the source ranges listed in the following table. For additional background information about the different types of name servers, see alternative name servers and routing methods (/dns/docs/overview#altns-targets). Alternative name server type Source ranges https://cloud.google.com/dns/docs/policies/ 7/10 8/23/2020 Applying Cloud DNS server policies | Cloud DNS Documentation Type 1 name servers 35.199.192.0/19 (VMs in a VPC network with the outbound policy) Cloud DNS uses the 35.199.192.0/19 source range for all customers.