Gentoo Archives: gentoo-user

From: Alexander Puchmayr <alexander.puchmayr@×××××××.at>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] systemd DNS does not resolve 'local' addresses
Date: Sun, 03 Apr 2022 08:26:00
Message-Id: 3166770.aeNJFYEL58@zeus
In Reply to: Re: [gentoo-user] systemd DNS does not resolve 'local' addresses by Rich Freeman
1 Thanks for the hint with mDNS, I wasn't aware of that. I'm using the '.local'
2 domain for all my machines for more than 15 years now, longer than mDNS
3 exists, but finally, after some research I found the problem, and actually it
4 wasn't systemd per se, it was an update of /etc/nsswitch.conf. The old version
5 had
6
7 Hosts: mymachines files myhostname dns
8
9 while the new version contains
10
11 Hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
12
13 The extra "resolve [!UNAVAIL=return]" makes the difference. It loads the
14 glibc's plugin nss-resolve [1], which then calls systemd-resolved [2], which
15 interprets '.local' as mDNS address. The mDNS is not activated on purpose, it
16 seems to be some default setting of the router which does not appear in the
17 configuration pages (or I didn't find it).
18
19 Anyway, there are some ways to solve this:
20 1) create an entry in /etc/hosts on every machine. Contradicts the idea of
21 DNS, but works
22 2) keep the old setting in nsswich.conf (without "resolve ...")
23 3) change my "own" TLD from .local to something else, like .home, as suggested
24 in [3]
25
26 I think as long term strategy option 3 would be the best.
27
28 Regards
29 Alex
30
31 [1] https://www.freedesktop.org/software/systemd/man/nss-resolve.html
32 [2] https://www.freedesktop.org/software/systemd/man/systemd-resolved.html#
33 [3] https://www.rfc-editor.org/rfc/rfc6762#appendix-G
34
35
36
37 Am Samstag, 2. April 2022, 23:48:06 CEST schrieb Rich Freeman:
38 > On Sat, Apr 2, 2022 at 5:22 PM Alexander Puchmayr
39 >
40 > <alexander.puchmayr@×××××××.at> wrote:
41 > > ## portage.local maps to 192.168.1.6
42 > > ## DNS-Server provided via DHCP is 192.168.1.1 (openwrt-router)
43 > >
44 > > buildhost-desktop ~ # ping portage.local
45 > > ping: portage.local: Temporary failure in name resolution
46 > >
47 > > Protocols: +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
48 >
49 > So, I haven't really used resolved much, but I see you have mDNS
50 > enabled. Does the portage.local host broadcast itself using mDNS? If
51 > it is running Gentoo then the answer is no unless you have it running
52 > avahi, which is usually not installed by default. Many
53 > desktop-oriented linux distros provide avahi by default.
54 >
55 > A resolver that supports mDNS will not use DNS to resolve the .local
56 > TLD, in accordance with RFC 6762.
57 >
58 > If you intend to use .local for DNS and not mDNS then you probably do
59 > not want mDNS enabled. You can either disable it for resolved
60 > globally by setting MulticastDNS=no in the [Resolve] section of
61 > /etc/systemd/resolved.conf, or by disabling it for a specific network
62 > in your network manager (the setting has the same name for
63 > systemd-networkd).
64 >
65 > This is one of those reasons why it is best to not use the .local TLD
66 > for DNS on your home network. You can disable it on systemd-resolved,
67 > but some IoT device in your home might have it permanently enabled.
68 > It allows a form of name resolution to work without any DNS server as
69 > devices discover and broadcast on their own.

Replies