0

After a restart I face serious issues with resolving dns on my Ubuntu 20.04. As written,

  1. host, dig and nslookup can resolve domain names to IPs e.g. dig @8.8.8.8 google.com dig @8.8.8.8 google.com +tcp
  2. I can ping the outside world using the IP
  3. other devices on same wifi work fine However, the browser (ERR_NAME_NOT_RESOLVED), services such as curl (Could not resolve host: www.google.com) or ping an domain do not work.

I changed from local router DNS to 8.8.8.8 (did not change anything) and tried out some other things I found here but without any success for 8+ hours. I had VPNs installed (no nordvpn, just uni), deleted everything I could find with no change...

What is the difference between DNS request from browsers and these tools? The A, AAAA, NX from dig all seems fine. It makes absolutely no sense to me.

11
  • "Does not work" is not a sufficient problem description. Please provide actual commands and results.
    – Tilman
    Mar 28, 2022 at 10:19
  • Thanks for your generic answer. Usually I agree. In this case it does not make the problem more specific. It is known how a ping command looks like. Does work = looks up an IP for an address. not= it does not, e.g. browser shows ERR_NAME_NOT_RESOLVED.
    – Lukas
    Mar 28, 2022 at 11:27
  • In the topic you're writing ping won't work. In the text you're writing you are able 'to ping the world' ... It is important, because some services are running via UDP, others via TCP. And I think haven't removed your VPN complete. try dig @8.8.8.8 google.com vs. dig @8.8.8.8 google.com +tcp, I'll expect the second won't work, as you may found out, because it is using TCP instead of UDP. (ping is ICMP, something different).
    – LupusE
    Mar 28, 2022 at 11:31
  • Precise commands and exact error messages matter. Without them it is too tedious for me to guess what is going on.
    – Tilman
    Mar 28, 2022 at 11:45
  • Ping IP works. Ping to domain shows name or service not known. Thanks for the idea @LupusE. Both of the dig give back an IP! I would love to copy the output but I have to write from my phone which takes forever. Happy to do so if important. Are there other ways to check/fix icmp?
    – Lukas
    Mar 28, 2022 at 11:50

1 Answer 1

0

After the discussion, I'll try to come with an explanation. Main Point: There was a VPN Client installed, and removed. Name resolving stopped working.

dig @8.8.8.8 google.com asks the server 8.8.8.8 what IP is assigned to google.com.
dig google.com shouldn't have worked.

Linux does look into the file /etc/nsswitch.conf how to resolve names to IP.
hosts: files means it will look into the /etc/hosts, done.
hosts: files dns means it will look into the /etc/hosts, then resolve via resolveconf (or more network-manager, today).

It could be a little more complex:
hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname

In case you've installed the VPN via dpkg (a .deb package with dpkg -i or using apt), there is a good chance the original /etc/nsswitch.conf is still in /etc, named something like /etc/nsswitch.dpkg-old.

If you need the original file, you'll always can download it by searching on https://packages.ubuntu.com/ for content: https://packages.ubuntu.com/search?suite=focal&arch=any&mode=exactfilename&searchon=contents&keywords=nsswitch.conf

  • Download the .deb file (in this case libc-bin or glibc-source should be nearly the same)
  • extract it (it's just an archive, ar -x <filename>.deb)
  • compare the original with yours
  • fix the needed lines

I am intentionally left out network-manager in depth or netplan.io.

You must log in to answer this question.

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