Search code examples
linuxdnsgoogle-compute-engineresolve

Why do I have some content in my resolv.conf file on GCE?


I have this content in my Google Compute Engine vm in the /etc/resolv.conf file:

domain c.company.internal.
search c.company.internal. 160467777293.google.internal. google.internal.
nameserver 169.254.169.254
nameserver 10.240.0.1

Why do I have that and what does it mean?


Solution

  • This allows resolution of DNS names within your project. For example, for one GCE VM to talk to another GCE VM, you can just use its hostname to connect to it (which you have chosen), rather than its internal IP (which is auto-assigned).

    Also, the fully-qualified domain name of a GCE VM is of the format:

    [vm-name].c.[project-name].internal

    You can see what it is on any given VM by running hostname -f.

    This also allows you to resolve special hostnames such as metadata (the GCE metadata server, FQDN: metadata.google.internal), which is actually located at 169.254.169.254.