Using external DNS

You can use your own domain name servers with Google Cloud to configure external DNS on migrated VMs.

Migrate for Compute Engine provides a way to set and control the external DNS settings of migrated VMs. To do this, configure DNS settings in the Google Cloud project using Google Cloud project metadata. These settings are applied to new VMs as they are migrated.

How DNS settings are applied

The DNS settings are applied as follows:

  • For Windows clients, the key-value pairs are applied to all NICs as follows:
    • dns-domain-name: Replaces the DNS suffix for this connection setting per NIC.
    • dns-servers: Replaces the list of DNS servers per NIC.
    • dns-domain-suffixes: Replaces the list of DNS suffixes per NIC.
  • For Linux clients, the key-value pairs are applied to all NICs as follows:
    • dns-servers: Prepends the list of DNS servers in the resolv.conf file.
    • dns-domain-suffixes: Prepends the list of DNS suffixes in the resolv.conf file.

Configuring your VMs to connect to the metadata server

Google Cloud provides metadata to VMs hosted on Compute Engine. To use external DNS without forwarding to Cloud DNS, you need to configure name resolution for your VMs manually.

To do so, add the following line to the /etc/hosts file (on Linux) or c:\Windows\System32\Drivers\etc\hosts (on Windows).

169.254.169.254 metadata.google.internal

Automating this step is possible with scripted custom adaptations.

Configuring external DNS data on VMs in GCP

To enable external DNS on migrated VMs:

  1. In the Google Cloud console, go to the Metadata page for your project.
  2. Under Metadata, click Edit.
    screenshot of enabling external DNS (click to enlarge)
    Enabling external DNS (click to enlarge)
  3. In the Metadata page, add the appropriate key-value pairs. Use one of the following sections for instructions for these deployments:

Using VMs without a region setting (default)

  1. If your VMs don't have a specific region setting, add the following key-value pairs in the Metadata page:

    Key Example Value
    default_dns-domain-name : mydomain.com
    default_dns-servers : {comma separated list of IPs}
    default_dns-domain-suffixes mydomain.com, myseconddomain.com
  2. When you're done, click Save.

Using VMs with a region setting

  1. If your VMs have a specific region setting, add the following key-value pairs in the Metadata page:

    Description Key Example Value
    Windows clients {region_name}_dns-domain-name : mydomain.com
    List of DNS servers {region_name}_dns-servers : {comma separated list of IPs}
    List of DNS suffixes to add to Windows and Linux machines {region_name}_dns-domain-suffixes mydomain.com, myseconddomain.com
  2. When you're done, click Save.