I’m running NixOS 24.11 as a VM guest within a Fedora host, using a bridged network interface (no virtual NAT). Some relevant NixOS config:
networking.networkmanager.enable = true;
services.avahi.enable = false;
services.resolved.enable = true;
mDNS is reported as enabled for systemd-resolved and for the network interface:
$ resolvectl status
Global
Protocols: +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Fallback DNS Servers: [...]
Link 2 (enp1s0)
Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 mDNS/IPv4 mDNS/IPv6
Protocols: +DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: [...]
DNS Servers: [...]
DNS Domain: home
But when I try to query another local machine by its hostname, the request times out after a few seconds of waiting:
$ resolvectl query foo.local
foo.local: resolve call failed: All attempts to contact name servers or networks failed
I can ping the host by its IPv4 and IPV6 address just fine, and the name can also be resolved on the host system.
If I switch my configuration to enable Avahi and disable systemd-resolved, then I can resolve the name just fine with avahi-resolve -n foo.local
. So mDNS queries can get out of the VM guest and work properly, it’s just systemd-resolved that’s having trouble.
Any idea why Avahi’s mDNS works, but systemd-resolved’s doesn’t?