Avahi would be the right tool to help you in this case. For your Avahi config, you will want a config like this:
/etc/avahi/avahi-daemon.conf
:
[server]
use-ipv4=yes
use-ipv6=yes
check-response-ttl=no
use-iff-running=no
[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=no
publish-domain=yes
[reflector]
enable-reflector=yes
reflect-ipv=no
[rlimits]
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=30
rlimit-stack=4194304
rlimit-nproc=3
The enable-reflector=yes
is the key setting there. That is what will "reflect" your mDNS broadcasts from one subnet to the other subnets. Your firewall rules are what control which subnets are allowed to broadcast mDNS in the first place (and those will be the ones that Avahi will reflect for you).
You would need to create firewall rules for each of the subnets you wish to allow mDNS broadcasts from. Here are some examples of how I have this set up to allow my IoT subnet to broadcast mDNS:
FW3:
config rule
option name 'Allow-IOT-mDNS'
option family 'ipv4'
list proto 'udp'
option src 'iot'
option src_port '5353'
list dest_ip '224.0.0.251'
option dest_port '5353'
option target 'ACCEPT'
config rule
option name 'Allow-IOT-mDNS6'
option family 'ipv6'
list proto 'udp'
option src 'iot'
option src_port '5353'
list dest_ip 'ff02::fb'
option dest_port '5353'
option target 'ACCEPT'
If you are using nftables
instead, you would be looking at some rules like this:
# Allow mDNS
udp sport mdns udp dport mdns ip daddr 224.0.0.251 accept
udp sport mdns udp dport mdns ip6 daddr ff02::fb accept