Does google cloud have internal dns service

red888 picture red888 · Jan 25, 2018 · Viewed 7.9k times · Source

Does GCP support an internal DNS service? I don't need my zone to be public but I want my gce instances to use it for resolving internal services.

Answer

Prashant Bhate picture Prashant Bhate · Apr 18, 2018

I am not very clear on your requirements, but if you just want two vm instances in a project VPC to communicate with each other then you can use internal dns, instead of using internal IP address which might change when a vm instance gets recreated.

GCP provides internal dns that can be used by two VM instances in the same VPC to communicate.

Note that vm instances in two different VPC can not communicate with each other across VPCs using this method (unless a VPN or other mechanism is configured to connect VPCs)

There are two ways to access/configure Internal DNS

  • Global DNS
  • Zonal DNS (Default for all organizations or standalone projects that have enabled the Compute Engine API after September 06, 2018.)

An internal fully qualified domain name (FQDN) for an instance has the following formats:

Instances using the default global DNS : [HOST_NAME]       .c.[PROJECT_ID].internal
Instances enabled for Zonal DNS        : [HOST_NAME].[ZONE].c.[PROJECT_ID].internal

You can address instances over the internal VPC network using this FQDN.

For example, if your instances are enabled for Zonal DNS, you can ping from one instance to another instance over the internal VPC network using the zonal fully qualified domain name:

ping example-instance.us-west1-c.c.example-project.internal -c 1