Multicast routing across two subnets with FreeBSD 9 (Bonjour between subnets)?
I have a FreeBSD 9 router (a Soekris net6501) connected to the internet via a dsl modem (bridged), doing NAT for two internal subnets, 10.0.1.0/24 (LAN) and 10.0.2.0/24 (wifi net).
There are routes between the subnets and things like ssh host-A.wifi
from host-B.lan
works.
But, wireless clients (like iPads and iPhones) on the 10.0.2.0/24 net can't seem to find stuff on the LAN (for example, airplay to an Apple-TV on the LAN).
I'm not totally sure, but I think this is because Apple uses Bonjour and Bonjour uses Multicast to find things and Multicast is not routed across subnets.
According to the FreeBSD handbook, to route multicast, I need to compile the kernel with options MROUTING
and create a /etc/mrouted.conf
, but I can't find any good examples of the configuration file.
- Is my problem related to multicasting across subnets?
- Is
mrouted
the preferred solution in FreeBSD to enable routing? - How do I create a
/etc/mrouted.conf
that routes between 10.0.1.0/24 and 10.0.2.0/24?
Thanks to @chris-s, I solved my own question by using Avahi instead of trying to route the multicast traffic.
This worked for me:
- Compile and install
net/avahi
anddns/nss_mdns
from the ports tree. - Add
avahi_daemon_enable="YES"
anddbus_enable="YES"
to/etc/rc.conf
- Use the avahi configuration file (
/usr/local/etc/avahi/avahi-daemon.conf
) and added my two internal network interfaces (two internal subnets) to theallow-interfaces
key (comma separated) and set theenable-reflector
key toyes
to make avahi propagate the traffic to all internal networks. - Edit the
hosts
entry in/etc/nsswitch.conf
tohosts: files dns mdns
After starting the avahi daemon, you can check if it works either by directly doing a lookup from the mdns server machine:
root@server / # getent hosts apple-tv.local
10.0.1.4 apple-tv.local
root@server / # getent hosts iphone4s.local
10.0.2.27 iphone4s.local
root@server / # getent hosts ipad.local
10.0.2.22 ipad.local
Or by browsing the .local domain with a utility like Bonjour Browser or iStumbler (both excellent). You should be able to see devices, hosts and services on all subnets.
A footnote is that my stock FreeBSD 9.0 installation's /etc/syslogd.conf
didn't log the messages from avahi-daemon
by default so I didn't see any logging at first (added a daemon.*
selector pointing to /var/log/daemon.log
)