Internal DNS

Google Cloud Platform (GCP) Virtual Private Cloud (VPC) networks have an internal DNS service that allows you to use instance names instead of instance IP addresses to refer to Compute Engine virtual machine (VM) instances.

Each instance has a metadata server that also acts as a DNS resolver for that instance. DNS lookups are performed for instance names. The metadata server itself stores all DNS information for the local network and queries Google's public DNS servers for any addresses outside of the local network.

An instance is not aware of any external IP address assigned to it. Instead, the network stores a lookup table that matches external IP addresses with the internal IP addresses of the relevant instances.

Instance fully qualified domain names

An internal fully qualified domain name (FQDN) for an instance looks like this:


You can always connect from one instance to another using this FQDN. If you want to connect to an instance using, for example, just hostName, you need information from the internal DNS resolver that is provided as part of Compute Engine. Compute Engine instances receive internal DNS resolution information as part of their DHCP leases. You can use any DNS resolver on your instances, as long as it supports the Local Subnet Routes feature documented in RFC3442.

Internal DNS and resolv.conf

By default, many flavors of Linux store DHCP information in resolv.conf, so this section assumes that's where your instance stores it. Compute Engine instances are configured to renew DHCP leases every 24 hours. DHCP renewal will overwrite this file, undoing any changes you might have made.

Sample resolv.conf with explanation

# Local domain name. Computed from your project name.
domain c.[PROJECT_ID].internal
# Search list for hostname lookup. Starting with entries that represent
# your project and ending with google.internal to facilitate metadata server requests.
# Note: Older projects might have a
# (eg.
# Note: Compute Engine provides up to a maximum of 3 entries for the search path.
search c.[PROJECT_ID].internal google.internal.
# Address of the DNS server to resolve project specific, and global domain names.

Sample with explanation

lease {
  # What interface we are using for the network
 interface "eth0";
 option subnet-mask;
 option routers;
 # Lease timeout, older VM instances will have this value set to infinite.
 option dhcp-lease-time 86400;
 option dhcp-message-type 5;
 option domain-name-servers,;
 option dhcp-server-identifier;
 option interface-mtu 1430;
 # Search path options that are copied into the resolv.conf
 option domain-search "c.[PROJECT_ID].internal.", "google.internal.";
 option ntp-servers;
 option rfc3442-classless-static-routes 32,10,128,0,1,0,0,0,0,0,10,128,0,1;
 option host-name "vm1.c.[PROJECT_ID].internal";
 option domain-name "c.[PROJECT_ID].internal.";
 renew 4 2016/02/25 04:38:57;
 rebind 4 2016/02/25 16:00:08;
 expire 4 2016/02/25 19:00:08;

If you need to modify this file please note the following:

  • Search path can only handle 6 records, 3 of which are provided by default by Compute Engine. If you add entries to the search path such that the total number of entries is greater than 6, search rules after the 6th one will not be applied by your OS. This can cause Compute Engine functionality like accessing instances via their instance names to stop working.
  • Manually editing resolv.conf will result in it being reverted to the default DHCP every time your instance's 24-hour DHCP lease expires. To make static modifications in your instance's resolv.conf, many flavors of Linux allow items to be prepended or appended to the DHCP policy.

What's next

  • See the VPC Overview for information on GCP VPC networks.
  • See Using VPC for instructions on creating and modifying VPC networks.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Compute Engine Documentation