0

I have a computer and a laptop, both have 127.0.0.53 running as their DNS servers. One computer runs fine with the current DNS server, but the laptop gets a "Temporary failure in domain name resolution" error message. When I change the DNS server in /etc/resolv.conf to 8.8.8.8 it starts working again.

Why does the DNS server not work on one computer only?

Edit: I have confirmed that libnss_dns.so.2 is installed (I am using ubuntu).

I have followed this guide https://manpages.debian.org/bullseye/libnss-resolve/libnss_resolve.so.2.8.en.html and modified my nsswitch.conf from (without the comments)

passwd:         files systemd
group:          files systemd
shadow:         files
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

I have changed changed the hosts line to

passwd:         files systemd
group:          files systemd
shadow:         files
gshadow:        files

hosts:          mymachines resolve [!UNAVAIL=return] files
myhostname dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

but I get the error when I ping google.com ping: google.com: Name or service not known

Edit2: I ran resolvectl on the laptop and got

Global
       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

Link 2 (wlo1)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

Link 3 (ipv6leakintrf0)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: ::1
       DNS Servers: ::1
        DNS Domain: ~.

Edit3: it's working fine automagically after some updates.

2 Answers 2

3

As was already pointed, if you are running newish systemdized linux on your machines systemd-resolved is yet another crapware from "the bright future" (understand dark) likely causing your problems.

It relies on several piles of hacks to hijack DNS resolution, which cannot really be solved, because that is halting problem level problem.

It also (un)intentionally confuses and collapses several network resolution namespaces into new one, which may or may not have business being merged together.

You have to options:

  • You'll learn systemd-resolved to properly configure it, and become it's beta version bug-testing workforce hunt and pecking every bug...
  • You'll disable it forever and will use /etc/resolv.conf the old grumpy admin way as it was forever intended.
8
  • 2
    Why do they do this kind of crap? It adds no value and just makes Linux that much more cumbersome and non-standard in the process.
    – mikem
    Commented Jul 7, 2022 at 5:51
  • Linux ecosystem is by now controlled solely by corporations (big and small). All major Linux developers are employed by corporations to work on Linux. Many work on kernel only, which de facto Linux, but as GNU/Linux schism teaches you, sole kernel is near useless: you also need userland to form fully working "OS" from. Userland is not as uniform as kernel. In the past most of the critical pices of userland were provided by GNU. These days major system control tools provider is systemd stack group.
    – etosan
    Commented Jul 7, 2022 at 8:05
  • systemd technological stack is brainchild of redhat corporation, it was major backer of that project. There are other alternative stacks to systemd, which are not as broad, expansive and invasive as systemd. Unfortunately, as is common in linux world, "crappiest" solution wins. Redhat spent incredible amount of marketing on systemd. Thus it became default OS base for almost all corporate Linux OSes. Now, don't get me wrong innovation is needed, the question is, how much of innovation is still good innovation, and how much is innovation for sake of innovation.
    – etosan
    Commented Jul 7, 2022 at 8:12
  • You could say systemd is disruptive style of innovation. Whether that is good or bad depends on your worldview.
    – etosan
    Commented Jul 7, 2022 at 8:12
  • 1
    @mikem They do it because it is a way to make Linux harder to use for individual users, who are then force to give up and use proprietary OSes like Windows. The main developer of systemd is now employed at Microsoft, a company notorious for "embrace, extend, extinguish".
    – Bagalaw
    Commented Nov 8, 2023 at 2:04
3

127.0.0.53 is not a real DNS server; it is the backwards compatibility interface of systemd-resolved, a new DNS resolver (= client) implementation for Linux systems.

The intended way to use it is via the libnss_resolve.so.2 library, i.e. by putting resolve instead of dns on the hosts: line of your /etc/nsswitch.conf file. If you do that, most programs will completely ignore /etc/resolv.conf and will instead contact systemd-resolved directly using the Unix socket at /run/systemd/resolve/io.systemd.Resolve.

Some programs that have been specifically coded to not rely on the standard name resolution services of the C library will read /etc/resolv.conf themselves, to find the DNS server(s) to use. To catch even these programs, systemd-resolved will normally act as a DNS resolver server/proxy in 127.0.0.53, and will automatically place a nameserver 127.0.0.53 line in /etc/resolv.conf while doing so. However, you can turn this feature off if you don't want it.

If you (or your distribution) has missed the step of installing/using libnss_resolve.so.2, and your /etc/nsswitch.conf still has the classic dns on the hosts: line, then all the DNS access goes through the 127.0.0.53 backwards compatibility interface, which is not as efficient as it could be.

When using systemd-resolved, use the resolvectl command to see the actual DNS server(s) used by your system.

I'm guessing that the actual DNS server settings are different between your two computers, and you have only looked at /etc/resolv.conf which is no longer the place to look at when using systemd-resolved.


A very late edit, but anyway: The resolvectl output indicates you are using a VPN client of some sort, which is attempting to prevent DNS leaks, or in other words, prevent your internet service provider from seeing the DNS requests related to anything you do over the VPN. Instead, the VPN provider's DNS servers should be handling those DNS requests.

The VPN client achieves the DNS leak prevention by setting up a DNS proxy at IPv6 address ::1, i.e. the IPv6 localhost. With the special DNS Domain: ~. setting, it attempts to handle all DNS traffic which is not specifically routed to a different DNS server(s).

Apparently, this DNS proxy was not working as it should, and the updates fixed it.

3
  • ping: google.com: Name or service not known
    – Progamer
    Commented Jul 6, 2022 at 21:21
  • Now, run resolvectl on both systems, and add the outputs to your question.
    – telcoM
    Commented Jul 6, 2022 at 22:29
  • I ran it on the laptop but not the desktop cause it's a bit out of order at the moment.
    – Progamer
    Commented Jul 8, 2022 at 1:49

You must log in to answer this question.

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