Could I use avahi to publish service across subnetworks?

Sure you can. It's called a reflector and it's part of the Linux avahi daemon.

Look at "SECTION [REFLECTOR]" of man avahi-daemon.conf on your distribution.


Unfortunately, no, it's going to require reconfiguration of whatever device is routing between those two subnets. mDNS uses the multicast addresses 224.0.0.251 for IPv4 and ff02::fb for IPv6. Those are link-local addresses and the data sent to them is typically not routed outside of the current subnet.

There are various options, some may be easier than others depending on what your routing device is.

Multicast Proxying. mdns-repeater is a simple solution that will repeat mDNS requests across interfaces.

Wide Area DNS. Wide-Area DNS-SD could be enabled on the DNS resolver that is service the hosts in those subnets. Avahi could then be configured to publish not the .local domain but to the domain for those subnets.

Multicast Routing. The device routing between those subnets could be configured to route the multicast groups between those two subnets.

mDNS Gateway. There is a draft RFC for implementing a mDNS gateway that sits at the edge of a network segment (typically a router). This is not a simple repeater/reflector, but a gateway that caches service entries and responds to queries from other connected network segments.