0

Update (6 Dec 2021):
It seems like there is a bug somewhere in avahi or libnss_mdns, see https://github.com/lathiat/nss-mdns/issues/81
Bad timing.

I have 2 single board computers running Debian 11, none of which is able to resolve any host in .local domain using mDNS out of the box. Here is the ping's output running on junk.local:

brain@junk:~$ ping atom.local    
ping: atom.local: Name or service not known

Pinging atom.local from my PC running Ubuntu, works okay:

brain@home:~$ ping atom.local
PING atom.local (192.168.0.135) 56(84) bytes of data.
64 bytes from atomic (192.168.0.135): icmp_seq=1 ttl=64 time=0.394 ms

Both of them are accessible by their names, "atom.local" and "junk.local" using Ubuntu 21.10, Windows and iOS. The hardware are same, both machines get their network settings through DHCP service on my router. On the atom.local network is managed by networking (basic server installation), on the junk.local - by NetworkManager (desktop + KDE installation). I tried a lot of guides, configuring avahi, nsswitch, systemd-resolved, NetworkManager, non of which working for me. Tinkering with /etc/resolv.conf I was able to get some results

  1. nameserver 192.168.0.1 That is default DNS server (my router), .local hosts can't be resolved. Same result ifI use my ISP's DNS servers.
  2. nameserver 127.0.0.1 .local names are resolved, and nothing else for obvious reasons.
  3. nameserver 127.0.0.53 I copied it from my Ubuntu PC and everything works fine! Also, I get same result using Google's 8.8.8.8

Now I have a question: How do I properly configure this mDNS thing? Why it is working fine with Google DNS server? I'm a bit confused after reading a ton of howtos and answers on this site.

In my nsswitch.conf I have this line:

hosts:          files mdns4_minimal [NOTFOUND=return] dns

avahi-resolve and avahi-browse works fine on these machines.

If I use 127.0.0.53 or 8.8.8.8 as a nameserver, I get IPV6 address

brain@junk:~$ getent hosts atom.local
fe80::207:32ff:fe4e:7d17 atom.local

So this mdns4_minimal does nothing at all? Now I'm totally confused.

2
  • mDNS and DNS are two different protocols; also IPv4 and IPv6 are too different network stacks. The ideas seem to be a bit mixed up Commented Dec 6, 2021 at 18:16
  • @Rui F Ribeiro Yes, I know. Very helpful, thank you very much Commented Dec 6, 2021 at 18:42

1 Answer 1

2

For minimal server install it is enough use combo systemd-networkd + systemd-resolved.

sudo nano /etc/systemd/resolved.conf Uncomment MulticastDNS=yes

sudo nano /etc/systemd/network/10-lan.network I used simple configuration:

[Match]
Name=enp1s0 #Put your interface here

[Network]
DHCP=ipv4
MulticastDNS=yes

Enable networkd and resolved services, start them up:

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

Disable/mask default networking service:

sudo systemctl disable networking

Rename or remove old networking stuff, this step is crucial to keep /etc/resolv.conf controlled by resolved service:

sudo mv /etc/network/interfaces /etc/network/interfaces.save

Finally it works, yay!

You must log in to answer this question.

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