Assaf Katz
Assaf Katz

Reputation: 65

Cloud shell cannot find Windows instance

I created Windows 2012 instance on GCP and I am trying to access it from cloud shell. But I got the error:

ping: instance.zone.c.project.internal: Name or service not known

Running ping on internal IP also doesn't response.

I already ensure that the server name is correct according to guideline by:

curl "http://metadata.google.internal/computeMetadata/v1/instance/hostname" -H "Metadata-Flavor: Google"

I allow HTTP & HTTPs but except it use default firewall configuration (and anyway, it wouldn't impact the server discovery). The computer is accessible through RDP, it is running, and response to ping to its ephemeral external IP but not the internal. I already ensure that the cloud shell is on same project and reset it (didn't help).

Thanks,

Assaf

Edit: I created Linux machine that I can ping from it with name, so it seems to be problem with Cloud shell

Upvotes: 0

Views: 379

Answers (1)

mebius99
mebius99

Reputation: 2605

The Google documentation Compute Engine > Doc > Internal DNS contains answers to this question.

Virtual Private Cloud networks on Google Cloud have an internal DNS service that lets instances in the same network access each other by using internal DNS names.
Internal DNS names cannot be used to connect to the external IP addresses of an instance.
Internal DNS names can only be resolved from other VMs that are in the same project and that use the same VPC or legacy network. You cannot use internal DNS to contact instances that are in other networks, even if they are in the same project.

A Cloud Shell instance is sitting in a separate network. You can make sure that by entering ip -4 addr show in the Cloud Shell command prompt. Hence it connects to VM instances via their External IP.

That is why Cloud Shell instance can't access an instance by its internal DNS name instance.zone.c.project.internal as well as ping the instance's Internal IP address.

A Linux VM that you've created is located in the same network as the Windows VM. Therefore they can ping each other via Internal IP and internal DNS name.

Upvotes: 1

Related Questions