0

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?

ChrisF
  • 3
  • 2

3 Answers3

0

you don't have to add the manual entries in /etc/resolv.conf rather you can just run the following command to refresh the file. Had the same issue and resolved it by doing this.

systemd-resolve --status
0

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. 
nameserver 169.254.169.254
ChrisF
  • 3
  • 2
0

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:

127.0.0.1 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:

169.254.169.254 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.

Daniele Santi
  • 2,529
  • 1
  • 25
  • 22