Spotify connect to sonos over different subnets and a firewall

We have some nice Sonos speaker in our network. Of course we devided our network in private and guest. Guest just have acces to the internet.

Sometimes we want our guests to be able to choose the music. In the past they used a tablet for this but they had no access to their own playlists.

Since some weeks Spotify connect is able to control Sonos speaker to play music on them. So why not allow devices from guest-LAN to acces Sonos speaker to control them via Spotify connect?

Our setup: We have a linux box with iptables as a gateway between these two subnets (seperated by VLANs).

Spotify connect uses mDNS for discovery so I sat up the avahi deamon and enabled two options in the configuration.

apt-get install avahi-daemon


Also you need a tiny hole in your firewall. The first rule is to allow the access to the mDNS daemon. The other rules are one per Sonos device you want to allow acces to. We have „private“ Sonos devices we don’t want to share so we have not allowed all of them.

/sbin/iptables -A INPUT -p udp --dport 5353 -j ACCEPT -m comment --comment "mDNS for Spotify"
/sbin/iptables -I FORWARD --destination 192.168.X.Y -p tcp --dport 1400 -j ACCEPT -m comment --comment "Spotify to Sonos Wohnzimmer"
/sbin/iptables -I FORWARD --destination 192.168.X.Z -p tcp --dport 1400 -j ACCEPT -m comment --comment "Spotify to Sonos Kueche"

Spotify uses the local network just for gaining control – all the control itself is made via internet.