mDNS stops working after a while on a qemu/kvm guest
1 vote c/questions Posted by zPlus — 1 votes, 1 commentsSource

I have a weird issue with local DNS. I’m not running a DNS server in my LAN; instead I rely on mDNS (multicast DNS) for resolving my hostnames using the .local TLD. I’ve installed AVAHI everywhere and it’s working fine, except on my virtual machines. I have some kvm virtual machines, all hosted on the same PC. All my virtual machines have been created with virt-manager and are using a virtual network interface configured like this:

source: macvtap device
device name: eno1 (this is the name of the network interface on the host)
device model: virtio

When I start the virtual machines, mDNS seems to work fine since I can ping them, for example ping vm1.local. But after a while, which could be seconds or a couple of minutes, I cannot ping them anymore with their hostname. Pinging the IPs work, just not the hostnames. And from inside the virtual machines, I cannot ping by hostname either.

This is clearly not a problem with mDNS since it’s working anywhere else on my LAN. It’s got to be some problem with the kvm network interface but I cannot figure out what it is. I’ve tried changing the device from virtio to rtl8139 and e1000, but it didn’t fix it.

Does anybody have an idea of what could be the issue?

I’ve found a working solution. Apparently macvtap is blocking multicast traffic to/from the guest OS, and this is why mDNS is not working. Adding trustGuestRxFilters="yes" to the network interface configuration did the trick for me.

This is what my network configuration looks like:

<interface type="direct" trustGuestRxFilters="yes">
  <mac address="xx:xx:xx:xx:xx:xx"/>
  <source dev="eno1" mode="bridge"/>
  <target dev="macvtap10"/>
  <model type="virtio"/>
  <alias name="net0"/>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
</interface>