In my network I have set up two Lenovo ThinkCentres (Fedora Server OS), all my devices on same LAN. I’ve set up mDNS on all of them (I’ve followed the tutorial linked below), and I’m able to use it in communication between both of them. I’m also able to use hostnames from my Android device (via WiFi, for example in Termux and Firefox).
I’m unable, however, to use/resolve these mDNS hostnames from my two other devices:
After some even more digging, I’ve found this discussion, and after checking again it turned out I can’t ping these machines from each other.
I’ve added rules for mDNS on each Server’s firewall, added mDNS to resolved.conf (seems the tutorial may be missing those two steps if it comes to Server Edition) and for now everything appears to be working.
You do not add mDNS to resolved.conf if you install and enable avahi and nss-mdns. They will conflict on the mDNS protocol. If you do enable mDNS in resolved.conf, then you must disable nss-mdns with authselect and disable avahi.
You should not need to create /etc/mdns.allow if you plan to use systemd-resolved. That does not use that file at all. That file is used by nss-mdns package plugins, which depends on avahi-daemon.service only. That should not be active if systemd-resolved is active with MulticastDNS set to resolve or yes at the same time.
Have you noticed that link you shared did not say anything about systemd-resolved?
Can you share what do you have configured in grep hosts: /etc/nsswitch.conf? Do you have some mdns plugin there? Which one? Enable it by sudo authselect enable-feature with-mdns4 and ensure sudo dnf install nss-mdns says already installed.
Anyway, the best tool for troubleshooting your resolution problems might be some.
getent ahosts -s mdns_minimal $HOSTNAME.local.
getent ahosts -s mdns $HOSTNAME.local.
getent ahosts -s resolve $HOSTNAME.local.
getent ahosts $HOSTNAME.local.
resolvectl query $HOSTNAME.local – especially if you enabled mdns resolution in systemd-resolved. Might give you some more verbose error description
avahi-resolve -n $HOSTNAME.local – this should work if only avahi-daemon is used, which is the default on Fedora. Needs avahi-tools package installed.
Getent resolves the name the same way as the ping command does and how common application should use it. Parameter -s allows you to specify plugin name from /etc/nsswitch.conf hosts: line. The first plugin returning the result terminates the search.
Note avahi might choose to announce a different hostname than specified, if it detects conflict. Sometimes it is a bug. You will find the correct name in square brackets for example in systemctl status avahi-daemon output.
Side note: systemd-resolved synthetizes own record “$HOSTNAME.local” even when mDNS resolution is disabled. Without ever trying it on the network.
Thank you for your input; I think it all came down to two problems/issues on my part:
trying to diagnose wrong point in the process
(as @vekruse mentioned) I’ve been treating avahi and resolved as two parts of same process, not two different providers for the same protocol.
You’re right that systemd-resolved was not mentioned at all in the guide - although as I’ve mentioned above it didn’t occur to me that this is a different (possibly conflicting?) provider - although when the guide turned out to be somewhat lacking when applied to a Fedora Server installation (may need firewall whitelisting?) I’ve been trying some very mixed methods - which I understand will require some cleaning.
My current nsswitch.conf hosts entry:
hosts: files myhostname mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns
So I understand I should disable (a part of) systemd-resolved to prevent conflicts with avahi and ncc-mdns?
well, not unless you have disabled systemd-resolved altogether. resolve plugin is used also for normal DNS queries, which should be cached by systemd-resolved. It is capable of using the following dns plugin as well, but keep the resolve plugin in place. It is skipped fast enough even if systemd-resolved is disabled. That is a reason why authselect does not offer its removal.
Just keep MulticastDNS=no in resolved.conf or keep disabled avahi-daemon.service and mdns* in authselect.
I read that it’s better to create a drop-in file, when I needed to disable mdns I created /etc/systemd/resolved.conf.d/60-resolved.conf with MulticastDNS=no uncommented.
I did this on my CachyOS following the instructions: here and here, but I believe it should operate the same way here on fedora.