Repeating mDNS/Bonjour requests from eth0 through a tunnel (tun0)
You could, instead of repeating the mDNS requests, use dns-sd
to create a proxy service record. If you run dns-sd -Z _raop._tcp
on the network with the mDNS record available, you should get something like this:
Browsing for _raop._tcp
DATE: ---Mon 21 May 2018---
1:29:38.528 ...STARTING...
; To direct clients to browse a different domain, substitute that domain in place of '@'
lb._dns-sd._udp PTR @
; In the list of services below, the SRV records will typically reference dot-local Multicast DNS names.
; When transferring this zone file data to your unicast DNS server, you'll need to replace those dot-local
; names with the correct fully-qualified (unicast) domain name of the target host offering the service.
_raop._tcp PTR 054D66DDCDBB@Gavin\032speakers._raop._tcp
054D66DDCDBB@Gavin\032speakers._raop._tcp SRV 0 0 5000 boxen.local. ; Replace with unicast FQDN of target host
054D66DDCDBB@Gavin\032speakers._raop._tcp TXT "pw=false" "txtvers=1" "vn=3" "sr=44100" "ss=16" "ch=2" "cn=0,1" "et=0,1" "ek=1" "sm=false" "tp=UDP"
You can use this to craft a proxy record to direct AirPlay clients to your server. For my example connection, I would use...
dns-sd -P '054D66DDCDBB@Gavin speakers' '_raop._tcp' 'local.' 'boxen.local' '192.0.2.23' "pw=false" "txtvers=1" "vn=3" "sr=44100" "ss=16" "ch=2" "cn=0,1" "et=0,1" "ek=1" "sm=false" "tp=UDP"
...where 192.0.2.23
is replaced with the IP address of your airplay server and everything else is copied from what you get from dns-sd -Z
. With this, AirPlay clients should be able to see your server.
Note: the dns-sd
command that I'm using here comes with macOS. As far as I'm aware it isn't available for linux, but you could probably do something similar with avahi.