Airplay across multiple broadcast domains

Airplay across multiple broadcast domains

Airplay is great and “just works” if all of your devices are on the same network. But if your device and TV are on separate broadcast domains, e.g. different VLANs, they will not be able to discover each other. Luckily the solution is simple.

Find somewhere to run Linux (for me, a Raspberry Pi), plug it into a trunking switch port, and create a new network interface for each VLAN you’d like to “bridge” the multicast domain with.

# apt install -y vlan
# cat /etc/netplan/50-vlans.yaml
network:
    version: 2
    ethernets:
        eth0:
            optional true
    vlans:
        vlan10:
            id: 10
            link: eth0
            dhcp4: true
            macaddress: aa:bb:cc:dd:ee:01
        vlan20:
            id: 20
            link: eth0
            dhcp4: true
            macaddress: aa:bb:cc:dd:ee:02
# netplan generate
# netplan apply

Next we need to Avahi and enable its mDNS reflector.

# apt install -y avahi-daemon
# sed -i 's/#enable-reflector=no/enable-reflector=yes/' /etc/avahi/avahi-daemon.conf
# sed -i 's/#allow-interfaces=eth1/allow-interfaces=vlan10,vlan20/' /etc/avahi/avahi-daemon.conf
# systemctl restart avahi-daemon

That’s it! You should be able to see mDNS traffic with tcp-dump -n host 224.0.0.251 and port 5353 between your Apple and AirPlay devices now.