Yesterday I had to revert to a recent snapshot of my vm. This vm was working flawlessly at the time I took it.

But now I can no longer resolve any url from this host. All git pull commands, all curl requests, host lookups, etc.. are failing. For instance:

host www.google.com ; connection timed out; no servers could be reached

Yet this host is reachable from the outside world, as I can ssh to it, and http requests coming in are being serviced.

What am I forgetting?


Turns out the file /etc/resolv.conf has been automagically populated roughly 18 hours after spinning up the instance.

Not super convenient, but glad it is resolved.

Had I known at the time, I think I would have been able to resolve the issue by adding this to /etc/resolve.conf:

domain c.[Project ID].internal 
search c.[Project ID].internal.google.internal. 

Indeed, you need to have both /etc/resolv.conf and /etc/hosts files suitably configured in order to resolve right the DNS request to specific hosts; otherwise, your request will be routed directly to your default DNS servers and you won't be able to reach those host that should be declared in the files aforementioned. This is an example of the configuration of the file /etc/hosts: localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters

At the end of the file, you can add the following line: metadata.google.internal

Being said that, no matter how your resolv.conf file is modified by third instances, you should be able to resolve properly hosts declared in the file /etc/hosts.

For further information about the internal DNS and the file resolv.conf, take a look to this link.

New contributor
Carlos Cuevas is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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