mDNS: avahi works once and then never again

I am trying to find devices in one VLAN (br-iot) from another VLAN (br-lan).

I have configured avahi and opened port 5353 from br-iot to my router (running OpenWrt).

The device I am trying to reach is a WLED bulb and I am trying to reach it from the WLED app on my phone.

This works exactly once after a restart of avahi-daemon.

So, when I open the app and start the discovery I see this:

"Found no lights yet" stays indefinitely, unless I do a

service avahi-daemon restart

The app then can see (and control) the device:

Here is my config

root@OpenWrt:~# cat /etc/avahi/avahi-daemon.conf 
[server]
#host-name=foo
#domain-name=local
use-ipv4=yes
use-ipv6=no
check-response-ttl=no
allow-interfaces=br-lan,br-dienste,br-iot,br-lan100,br-nonet
enable-dbus=no

[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=yes
publish-domain=yes
#publish-dns-servers=192.168.1.1
#publish-resolv-conf-dns-servers=yes

[reflector]
enable-reflector=yes
reflect-ipv=no
#use-ipv6=no

[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=30
rlimit-stack=4194304
rlimit-nproc=3

And an excerpt from logread:

Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: avahi-daemon 0.8 starting up.
Mon Nov  6 23:02:35 2023 daemon.warn avahi-daemon[16768]: WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: No service file found in /etc/avahi/services.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Joining mDNS multicast group on interface br-lan.IPv4 with address 192.168.178.1.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: New relevant interface br-lan.IPv4 for mDNS.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Joining mDNS multicast group on interface br-iot.IPv4 with address 10.1.103.1.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: New relevant interface br-iot.IPv4 for mDNS.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Joining mDNS multicast group on interface br-dienste.IPv4 with address 10.1.99.1.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: New relevant interface br-dienste.IPv4 for mDNS.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Joining mDNS multicast group on interface br-nonet.IPv4 with address 10.1.104.1.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: New relevant interface br-nonet.IPv4 for mDNS.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Joining mDNS multicast group on interface br-lan100.IPv4 with address 10.1.100.1.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: New relevant interface br-lan100.IPv4 for mDNS.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Network interface enumeration completed.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering new address record for fe80::e6c3:2aff:fe47:1a7e on br-lan.*.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering new address record for 192.168.178.1 on br-lan.IPv4.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering new address record for fe80::e6c3:2aff:fe47:1a7e on br-iot.*.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering new address record for 10.1.103.1 on br-iot.IPv4.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering new address record for 10.1.99.1 on br-dienste.IPv4.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering new address record for 10.1.101.1 on br-dienste.IPv4.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering new address record for 10.1.104.1 on br-nonet.IPv4.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering new address record for 10.1.100.1 on br-lan100.IPv4.
Mon Nov  6 23:02:35 2023 daemon.info avahi-daemon[16768]: Registering HINFO record with values 'MIPS'/'LINUX'.
Mon Nov  6 23:02:36 2023 daemon.info avahi-daemon[16768]: Server startup complete. Host name is OpenWrt.local. Local service cookie is 2213841025.

Any hints or tips are more than welcome! I am also willing to try another reflector, but it seems that avahi is the only one working on OpenWrt.

Were you able to resolve the issue? I am having the exact same problem wit android TV detection (for the remote control). Chromecast detection for example works fine.

I have been messing with this for a few hours and just minutes after asking I found the solution, maybe it will help you, too:

I set the following config in my avahi config in the [server] section:
cache-entries-max=0

make sure you have only one cache-entries-max config (I had set it to 0 once already, but there were 2 different values and it took the non-0 one).

Hope it helps you too.

for me it just blocks all output from

avahi-browse --all --ignore-local --resolve --terminate

@Dermac and @chrish -- Take a look at this and see if it helps give any pointers:

Did you adjust your firewall rules to allow access to the printer? I have a similar setup using CUPS which prints on port 631. In my case the printer is on br-lan and I’m allowing access from guest. Here are the relevant bits I added to /etc/config/firewall

config rule
        option name 'Allow-Guest-mDNS'
        list proto 'udp'
        option src 'guest'
        option src_port '5353'
        list dest_ip '224.0.0.251'
        option dest_port '5353'
        option target 'ACCEPT'

config rule
        option name 'Allow-Guest-Cups'
        option src 'guest'
        option dest 'lan'
        option target 'ACCEPT'
        list dest_ip 'ip.of.printer'	
        list proto 'tcp'
        option dest_port '631'

I have a similar problem, and none of the suggested fixes for Avahi seem to work.

I installed msdn_repeater and fixed the problem. More here mDNS reflector problems - #2 by robca

I have used avahi, mdns and umdns. I never had any problems with avahi in OpenWRT, but I prefer to stay with the recommendations from OpenWRT. I followed this: https://openwrt.org/docs/guide-developer/mdns and it's working like a charm.

Sample (dummy networks, /etc/config/umdns) :

config umdns
    option jail '1'
    option network 'LAN1 VLAN1 VLAN2'

Then /etc/config/firewall

config rule
    option name 'Allow mDNS LAN'
    list proto 'udp'
    option src_port '5353'
    option dest_port '5353'
    option target 'ACCEPT'
    option src '*'
    list dest_ip '224.0.0.0/4'

config rule
    option name 'Block mDNS WAN'
    option src 'wan'
    option proto 'udp'
    option dest_port '5353'
    option target 'REJECT'

Restart the services and check with:

ubus call umdns update
ubus call umdns browse

Do you know if umdns does reflection? Everywhere I read says to use Avahi and enable reflection so that the broadcasts get proxied from one vlan to the other, but I can't find anywhere that says umdns supports that.

I'm pretty sure that when I was trying to make mdns work across vlans, I tried umdns and it did not work as a reflector. It's been a long time ago and I might be wrong, but umdns was one of the options I tried to make it work, unsuccessfully. Also umdns seems to require restarts to properly acquire new devices https://github.com/openwrt/openwrt/issues/14758

The umdns documentation seems to imply that there's no reflector functionality https://openwrt.org/docs/guide-developer/mdns#config_file

list network dmz # Provides visibility into both networks, but does not act as a repeater

Note - I am currently editing this document to bring it to current status (prior version had a note from 2016 in it...) Comments welcomed. Thanks.

1 Like

Great news, thanks for doing this!

I'm assuming this is something already on your to-do list, but clarifying if umdns provides reflector/redirector functionality between vlans is quite important for many scenarios (like media players on vlans being controlled by devices on the main lan). I could not find anything on it

I will ask the folks I requested to review the page. Thanks.

Out of curiosity, any update on this?