Score:0

.local domain resolving problem in 20.04

im flag

I have DNS server with domains in .local zone. After changing priorities in /etc/nsswitch.conf and adding subconfig with my domains to /etc/systemd/resolved.conf.d/ i have servfail error (local cache server can't find my domain) when trying to resolve this domain name. In resolvectl output my domain available in Global section, but don't apply to interfaces. In other systems (18.04 and 20.04) all working good. Suspect it has to do with systemd changes but can't figure out how to fix it. Replacing the /etc/resolv.conf link with /run/systemd/resolve/resolv.conf doesn't suit me. Parts of my configs: /etc/systemd/resolved.conf

[Resolve]
Domains=mydomain.com ~local ~mydomain.local ~myseconddomain.local

/etc/nsswitch.conf

hosts: files dns mdns4_minimal

Part of resolvectl output

   Global
          Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
   resolv.conf mode: stub
         DNS Domain: mydomain.com
                     ~local ~mydomain.local ~myseconddomain.local
   
   Link 2 (enp0s3)
       Current Scopes: DNS
            Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
   Current DNS Server: 10.0.2.3
          DNS Servers: 10.0.2.3
           DNS Domain: mydomain.com
Terrance avatar
id flag
If you are going to continue to use `/run/systemd/resolve/stub-resolv.conf` as your resolver, you can specify what DNS servers and search Domain you want in the `/etc/systemd/resolved.conf` file. It can give you more control over your settings. Once you make any changes to that file you should restart the `resolved` service. `sudo systemctl restart systemd-resolved.service`
Volodymyr avatar
im flag
So, my domains specisied in **/etc/systemd/resolved.conf** and are shown in resolvectl output, but only in **Global** section. Resolving of .local domain don't working
Terrance avatar
id flag
"/run/systemd/resolve/resolv.conf doesn't suit me" what does that mean? If you change to that file then you will see whatever your DHCP is handing down like your domain name. If you stick with the `stub-resolv.conf` then it does its own thing.
Volodymyr avatar
im flag
I meant that changing the link, as is often advised, does not work for me.
Terrance avatar
id flag
You only have to change it once unless you reinstall. How often is someone advising it?
Volodymyr avatar
im flag
For some reason, this is often recommended for a case like mine
Score:0
mc flag

I faced exactly the same issue on Linux Mint 21 while trying to set up my network printer. After a few hours of searching, I came across this blog post which confirmed what the manpages hinted at.

Essentially, you have to enable MulticastDNS (a.k.a. mDNS) for the interface that connects to your router, which is usually your wlan.

So first modify /etc/systemd/resolved.conf

[Resolve]
# Uncomment and set these values
DNS=192.168.1.1
Domains=local
MulticastDNS=yes
LLMNR=no

You have correctly identified that modifying this file only affects the Global section of the resolvectl status output. In order to change the configuration of the other links you have to create a separate .network entry for every link (in my case, the wlan link had the name wlp2s0; use your own name in the steps below).

Now create a new file

sudo touch /etc/systemd/network/wlp2s0.network

In that file, specify the configuration for the wlp2s0 link

[Match]
Name=wlp2s0

[Network]
DHCP=yes
MulticastDNS=yes
LLMNR=no

After that, enable and start systemd-networkd if it isn't enabled by default

sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd

Then check if the wlp2s0.network configuration got loaded

networkctl list

Which should print

IDX LINK      TYPE     OPERATIONAL SETUP     
  1 lo        loopback carrier     unmanaged 
  2 enp1s0    ether    no-carrier  unmanaged 
  3 wlp2s0    wlan     routable    configured

Lastly restart sytstemd-resolved

sudo systemctl restart systemd-resolved

and check the status

systemctl status

It should say

Global
         Protocols: -LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: foreign
Current DNS Server: 192.168.1.1
       DNS Servers: 192.168.1.1
        DNS Domain: local

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

Link 3 (wlp2s0)
    Current Scopes: DNS mDNS/IPv4 mDNS/IPv6
         Protocols: +DefaultRoute -LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.1.1
       DNS Servers: 192.168.1.1 xxxx:xxx:xxxx:xxxx::x
        DNS Domain: Home

Now you can try and ping your .local domain

ping myprinter.local
Score:0
in flag

I had the same problem and found it easier to use avahi rather than systemd-resolved. All it took to solve get mDNS up and running on Ubuntu was

sudo apt-get install avahi-daemon

That's it.

Disclaimer: I don't know what the downsides of this solution may be, so please do leave a comment if I missed something.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.