Avahi sending mDNS traffic on WAN despite interface exclusions
-
I think I may have run into a bug with the Avahi package on pfSense CE 2.9.0.
I use Avahi to reflect mDNS between a few internal VLANs. I have two WANs,
WAN_ISP1(ix1 - primary WAN as seen by pfsense) andWAN_ISP2(re0).What I noticed was a huge amount of firewall log spam on
WAN_ISP1IP for antispoof protection, all involving mDNS traffic to:
224.0.0.251:5353When Avahi is disabled, the firewall log spam stops.
The strange part is that the source address was my actual
WAN_ISP1IP.Example packet capture from WAN_ISP1 / ix1:
<ISP1 IP>.5353 > 224.0.0.251.5353
<ISP1 IP>.11566 > 224.0.0.251.5353There were tons of these, continuously.
A couple things I tested:- If I disable Avahi, the traffic stops immediately.
- If I re-enable Avahi, it comes back immediately.
- WAN_ISP1 is not selected as an interface I want Avahi to use.
- I also tried switching Avahi to deny mode.
- WAN_ISP1 does not show up in the Avahi GUI interface list, which I believe is because it is the primary pfSense wan interface.
- I manually added ix1 to deny-interfaces= in /usr/local/etc/avahi/avahi-daemon.conf and restarted Avahi.
- The mDNS traffic still continued on ix1.
sockstat shows Avahi listening on all IPv4 interfaces:
avahi avahi-daem 36204 13 udp4 *:5353 *:*
I also confirmed with a packet capture directly on ix1 that the traffic is actually present there.
For now I added a firewall block for UDP to 224.0.0.251:5353 on the WAN interface. That stopped the firewall log spam. In a little bit over 12 hours i've blocked 200 MB of traffic, so this was not just an occasional packet.
One other odd detail: a normal block rule on the WAN_ISP1 interface tab is catching the traffic and the byte counter increases. A floating outbound rule for the same traffic does not appear to match at all. So at this point it looks like Avahi is somehow emitting or reflecting mDNS traffic onto the WAN interface even when the interface is supposed to be excluded.
Has anyone else seen this on multi-WAN setups, or is there another place Avahi is getting its interface list from that I’m missing?
If useful I can post the generated avahi-daemon.conf, packet captures, and screenshots of the firewall counters.
-
Can you say a little more about how your multi-WAN is configured?
Also, outbound NAT configuration?
-
Years ago I followed some guide for a dual-WAN setup, both have their own gateways.
System > Routing...
Default IPv4 Gateway: <Gateway Group>
Gateway Group -- WAN_ISP1 (Tier 1) - WAN_ISP2 (Tier 2)
Trigger is High Packetloss or LatencyWAN_ISP1 (ix1) & WAN_ISP2 (re0) (On both interface, IPv4 DHCP, Reversed Networks > both things blocked)
Firewall > NAT > Outbound > Set to Hybrid Outbound NAT
pfSense is auto-generating outbound NAT rules for both WANs. I don’t have any custom outbound NAT rule specifically for mDNS or 224.0.0.251.On each vlan I have mDNS refected I have rules like this... and "Powers_Combined" is my Gateway group

-
@CCNewb said in Avahi sending mDNS traffic on WAN despite interface exclusions:
What I noticed was a huge amount of firewall log spam on WAN_ISP1 IP for antispoof protection, all involving mDNS traffic to:
224.0.0.251:5353This is a (not new) bug in Avahi. I recommend switching to mdns-bridge which is intended to replace Avahi.
-
@dennypage so my only gripe with mdns-bridge is that the OpenVPN interface is omitted... I'm one of those weird people who need mDNS across the VPN as I need to occassional log into a security camera and do something on the apple tv w/ the iOS remote (which needs mDNS for discovery).
I guess I can poke around and see if there's a hackery way to add the OpenVPN interface
-
@CCNewb said in Avahi sending mDNS traffic on WAN despite interface exclusions:
so my only gripe with mdns-bridge is that the OpenVPN interface is omitted...
There are two reasons that an interface may be omitted.
The First, and most obvious reason, is that the interface does not support multicast. You can check this by looking for the MULTICAST flag with ifconfig. The requirement that multicast be supported is inherent in mcast-bridge itself.
The second reason, is that the interface has a gateway attached. In pfSense, if an interface has a gateway attached it is classified as a WAN interface rather than a LAN interface. You can check this in
System / Routing / Gateways. This limitation is part of the pfSense package for mcast-bridge.Which of these applies to your use case?
-
This post is deleted! -
@dennypage Alright if this is an ancient Avahi bug that won't be fixed, that's okay... I switched over to mDNS bridge and that behavior is not happening over here (byte count on blocking rule is not growing).
And you're right OpenVPN interface in mdns-bridge is omitted b/c it's has a gateway. I used mDNS w/ Avahi on this interface for years so it's not an interface limitation.
So simply modifying mdns-bridge php to allow selecting the OpenVPN interface is what I needed.
in /usr/local/www/mdns-bridge.php
replace:
$available_interfaces = get_configured_interface_with_descr(); foreach ($available_interfaces as $interface => $name) { if (interface_has_gateway($interface) || interface_has_gatewayv6($interface)) { unset($available_interfaces[$interface]); } }with this:
$available_interfaces = get_configured_interface_with_descr(); foreach ($available_interfaces as $interface => $name) { $real_interface = get_real_interface($interface); // Allow OpenVPN $is_openvpn = preg_match('/^ovpn[sc][0-9]+$/', $real_interface); if (!$is_openvpn && (interface_has_gateway($interface) || interface_has_gatewayv6($interface))) { unset($available_interfaces[$interface]); } }tested over cellular + VPN and mDNS discovery is working as expected.
-
@CCNewb I'll take another look at this and see if I can come up with something.
The concept of a match on the name probably won't pass however. The Netgate folk are very strong on not making assumptions about what the purpose of an interface is based on its naming. Their current "is it a wan interface?" recommendation is the gateway check.
My choices are likely to either remove the check completely, or have some form of warning for interfaces with an attached gateway. Either way, I'll add it to my list. Thanks.
-
@dennypage ty!
-
@CCNewb An updated version of mdns-bridge that removes the gateway restriction is available in 26.07/2.9.0.
-
@dennypage upgraded! Tested again and it's working great. TY!
-
@CCNewb Welcome
-
If anyone else is migrating from Avahi to mDNS Bridge, here's something I ran into outside my OpenVPN testing.
Avahi documents that its reflector drops the “unicast reply” bit when reflecting queries. That meant replies used the multicast path my firewall rules already allowed: 224.0.0.251, UDP port 5353.
mDNS Bridge preserves that bit, so devices can reply directly to pfSense’s interface IP instead. My existing multicast rule didn't cover that destination.
I kept the existing rule on each participating VLAN:
Pass IPv4 UDP
Source: VLAN’s subnets
Destination: 224.0.0.251
Destination port: 5353And added this rule for unicast replies (new rule needed for mDNS bridge):
Pass IPv4 UDP
Source: VLAN’s subnets
Destination: VLAN’s interface address (<VLAN> address)
Destination port: 5353With Avahi, the multicast rules had been enough in my setup. After adding the unicast rules, discovery started working again with mDNS Bridge. Turned out to be the reply path.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginPrivacy Policy · Cookie Policy