Could I use avahi to publish service across subnetworks?

10,028

Solution 1

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.

Solution 2

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.

Share:
10,028
bertyuan
Author by

bertyuan

Updated on June 05, 2022

Comments

  • bertyuan
    bertyuan about 2 years

    Avahi is usually used for service discovery. I want to make a service discoverable from a different subnetwork, could I use avahi to achieve this?

    For example, the service host ip is "192.168.1.100" with mask "255.255.255.0", so it's in 192.168.1.X subnetwork. Another host ip is "192.168.2.100" with mask "255.255.255.0". Could I use avahi to let this host discover the previous service host?

  • Petr
    Petr over 2 years
    This assumes that the Avahi daemon is running on the gateway, right?
  • Ross Tajvar
    Ross Tajvar over 2 years
    no, you can run avahi on any host, as long as it has interfaces in both of the subnets you want to reflect between.