Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Google Compute instances have a stable public DNS name?

This is a question in two parts:

  • Do GCE instances have a stable public DNS name? The default DNS name for instance with public IP a.b.c.d seems to be d.c.b.a.bc.googleusercontent.com
  • If yes, what's the best way to obtain this information? Here's the hack I've been using thus far:

    EXTERNAL_IP=$(curl -s http://bot.whatismyipaddress.com/)
    EXTERNAL_DNS=$(dig +short -x ${EXTERNAL_IP})
    
like image 972
Diwaker Avatar asked Jul 17 '13 00:07

Diwaker


People also ask

What is a Google Compute Engine instance?

This page provides an overview of Compute Engine instances. An instance is a virtual machine (VM) hosted on Google's infrastructure. You can create an instance or create a group of managed instances by using the Google Cloud console, the Google Cloud CLI, or the Compute Engine API.

What is FQDN in GCP?

GCP has internal FQDN for Compute Engine VMs for communicating between instances in the same VPC network, that can be used to send packets to an instance by specifying the fully-qualified DNS name (FQDN) of the target instance. The VPC network automatically resolves the name to the internal IP address of the instance.

What is Google static IP?

For IPv4: 8.8.8.8 and/or 8.8.4.4 . For IPv6: 2001:4860:4860::8888 and/or 2001:4860:4860::8844 . For IPv6-only: you can use Google Public DNS64 instead of the IPv6 addresses in the previous point.

Which of the following is the DNS resolver for a VM instance?

The metadata server is also the name server resolver for DNS queries issued by the VM.


1 Answers

reverse lookup is okay to do, for IP address you would probably prefer using gcutil https://developers.google.com/compute/docs/gcutil/tips

EXTERNAL_IP=$(gcutil getinstance --format=csv --zone=[your_zone] [your_instance] | grep external-ip | cut -d "," -f 2)

like image 56
Feczo Avatar answered Oct 19 '22 00:10

Feczo