9

I have a CentOS 7.3 machine that is a guest running on Oracle VirtualBox. The host is a Windows machine. I can ping 8.8.8.8 from the Linux server. The Linux server can ping itself by its hostname ping coolvm. As root I recently did a yum -y update command. That is when curl stopped working. FQDNs will not resolve.

If I try this:

curl -v http://www.google.com

I get this error:

  • Could not resolve host: www.google.com; Unknown error
  • Closing connection 0 curl: (6) COuld not resolve host: www.google.com; Unknown error

The commands nslookup, dig and host have not been installed. I cannot install new Yum packages because I get an error related to host resolution ("Resolving time out").

The /etc/resolv.conf file looks like this:

# Generated by NetworkManager
search localdomain
nameserver 8.8.8.8
nameserver 8.8.4.4

I tried rebooting the host machine (and thus the guest too). But that did not help me. Browsing the internet has not changed.

The interface for the main NIC in /etc/sysconfig/network-scripts/ has DNS server stanzas that have worked in the past. The interface file is standard and complete. I have not changed it since the yum -y update command.

How can I get FQDNs to resolve? I want to use the Lynx command. My repositories rely on FQDNs to resolve. I cannot use yum to install packages.

Update. I ran this command:

cat /etc/nsswitch.conf | grep -i hosts

I saw this:

#hosts:   db files nisplus nis dns
hosts:    files dns myhostname
2
  • 1
    what does grep ^hosts /etc/nsswitch.conf show you? There should be dns as one of the options. (looks like: hosts: files dns myhostname) Mar 15, 2017 at 14:23
  • It shows hosts: files dns myhostname
    – Alex111
    Mar 15, 2017 at 15:01

2 Answers 2

5

Try running the command dhclient. I tried it and it worked for me.

2
  • After trying and failing with many other solutions, yours worked for me. Thank you! :) Now, after spinning in circles for a few hours, I can finally get back to work, ha! Apr 24, 2020 at 22:47
  • I can't install dhclient because I can't resolve any host. So I can't download anything from the package servers.
    – Fred
    Mar 1, 2022 at 14:11
1

As far as I know - this happens due to network adapter type. (Don't know why, just my experiance...) Check your machine's network settings in VirtualBox, search for adapter type. Assuming you are using NAT - select one of Intel's adapters and not other PCI, as many Linux distros doesn't hold the drivers for such adapters, but does have drivers for Intel's adapters. You can always try to bridge the network to bypass that issue. In addition check your proxy just to be sure...

4
  • 1
    Can you explain why this might fix the problem?      Please do not respond in comments; edit your answer to make it clearer and more complete. Dec 1, 2018 at 18:47
  • @G-Man thanks for the comment, I've edited my answer with more details.
    – Amitaysh
    Dec 1, 2018 at 18:57
  • Thanks for editing your answer. ISTM that it doesn't make sense that this would be a factor, given that the system was working, and all the user did was a yum -y update. But sometime inexplicable answers work, so let's leave this here and see whether it helps anybody. (Note that Alex111, the original poster, hasn't logged in for over a year, so we aren't likely to hear anything from them.) Dec 1, 2018 at 19:08
  • Great, I just had a similar issue and that solution worked for me... anyway as you can see this was my first answer ever :) so I'm learning. Thanks for the tips!
    – Amitaysh
    Dec 1, 2018 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .