0

I was actually doing some quick labs exercise when I noticed this issue where is ping to an internal IP works but if I ping with machine name it does not work. Here is what I did:

a.) Create a GCP project. Leave all the default firewall rules in place

b.) Create a VM in us-central-1 (any region) call it - mynet-us-vm

c.) Create a VM in eu-west-1 (any region) - call it - mynet-eu-vm

d.) SSH to mynet-us-vm from the console

e.) Run this commands : ping -c 3 <Enter mynet-eu-vm's internal IP here>- It works

f.) Run this command: ping -c 3 mynet-eu-vm - Does not work! Getting below error

Getting Error:

"ping: mynet-eu-vm: Name or service not known"

Long Luong
  • 764
  • 2
  • 14
  • 28

1 Answers1

0

For Internal DNS resolution to work there are multiple factors that affect this:

On the client Instance running ping the resolv.conf file must have the metadata server (169.254.169.254) as it’s nameserver and the search domains must be set similarly to the example on the documentation, if using a Google provided image this configuration should already be set correctly.

Additionally, verify the hostname registered for the Instance “mynet-eu-vm” this can be done by running curl against the metadata server, the output to this will be the full FQDN which will confirm whether the resolv.conf file should be set to Zonal DNS or Global DNS and if the hostname for the Instance is the same as the one being used with ping.

If running “dig FQDN @169.254.169.254” works but ping still fails this would mean that the Instance is trying to resolve against a different nameserver, or that the search list on resolv.conf is incorrect.

If the above steps fail I suggest raising a support case with Google Cloud Platform or opening a new Public Issue Tracker since following the steps provided does not result in the same behavior and likely it’s something specific to your setup.

paumanel
  • 126
  • 4