2

I noticed on GCP VM instance in the same network that you can't ping one from another using their instance names (hostnames) as taught in a pluralsight tutorial. But I can ping this other VM instance using both the internal and external IP addresses as expected from VMs in the same network.

Please note I have seen this post but no luck. Perhaps there is a change in how VMs communicate.

  • 2
    1) Did you configure custom hostnames when creating the instances? 2) Edit your question and add a hostname that does not work. There are two different formats. – John Hanley Sep 22 '19 at 4:25
  • Thank you so much I never new that one can set a custom hostname as the tutor just used the name of the instance. I see that the default format is instance_name.zone.c.project_id.internal. Please post an answer so I can accept. – George Udosen Sep 22 '19 at 7:06
1

As @John Hanley replied you can configure your own hostname when creating an instance.

For example you create an instance vm1 with custom name mycustomname.xxxx.xxx. When you will be trying to ping the instance with custom name you stiull have to use vm1 or the IP. This is due to the GCP's Internal DNS behavior:

You can specify a custom hostname for a VM when you create it. Custom hostnames assigned in this way are not resolved by internal DNS. With custom hostnames, you still need to create a corresponding DNS record in the appropriate zone (for example, using Cloud DNS). See creating a VM instance with a custom hostname for more information.

You can find out even more info about custom hostnames here.

Generally internal DNS will resolve the name of the instances that are visible in the VM's list or running gcloud compute instances list. Even when you change the hostname at the OS level (sudo hostname my_new_hostname) it will only be visible to the VM's OS. No other VM will be able to ping this VM using new hostname.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.