I have spent the past few weeks trying to get Spotify Connect working where my phone with the Spotify is on one VLAN and the Sonos speaker is on another VLAN. Spotify simply does not find the speaker on the other VLAN, although I am able to cast media to my Chromecast with the same VLAN setup. Moreover, the Sonos app is able to play media with the same setup so it's just Spotify Connect not working.
I have read quite a few posts on this, but most of them seem to be related to enabling device discovery in the first place, rather than getting Spotify Connect to work. I have for example read the following posts:
Summary
- Sonos controller doesn't see player (different VLAN)
- Sonos fully operational across VLANs (Updated Solution)
- Accessing Sonos from another LAN/VLAN - #10
- https://www.reddit.com/r/sonos/comments/t0emv0/the_definitive_sonos_vlan_segregation_post/
- https://blog.christophersmart.com/2020/03/30/resolving-mdns-across-vlans-with-avahi-on-openwrt/
- https://www.packetmischief.ca/2021/08/04/operating-sonos-speakers-in-a-multi-vlan-network/
Any idea why Spotify Connect cannot find the speakers in the other VLAN? All input is appreciated.
Setup:
The Sonos speakers use mDNS and SSDP for discovery, meaning that multicast must be proxied or reflected between the networks so I installed avahi and mcproxy for this purpose (see config below).
This is my network setup:
- lan_secondary interface: 192.168.98.1/24
- iot interface: 172.20.3.1/24
- All devices in both interfaces are connected via wifi and lan_secondary and iot have their own SSIDs. The lan_secondary network has access to the internet and can forward traffic to the iot network. The iot network only has access to the internet and cannot forward traffic to the lan_seconday network.
These are the firewall rules:
config zone
option name 'lan_second'
option output 'ACCEPT'
option forward 'REJECT'
list network 'lan_secondary'
option input 'ACCEPT'
config zone
option name 'iot'
list network 'iot'
option output 'ACCEPT'
option input 'REJECT'
option forward 'REJECT'
config forwarding
option src 'lan_second'
option dest 'wan'
config forwarding
option src 'lan_second'
option dest 'iot'
config forwarding
option src 'iot'
option dest 'wan'
config rule
list proto 'tcp'
option src 'iot'
option dest 'lan_second'
option target 'ACCEPT'
option name 'IoT Sonos to Seconday LAN TCP'
option dest_port '445 554 1400 1443 3400 3401 3405 3445 3500 3501 3689 4070 4444 5297 5298'
config rule
option name 'IoT Sonos to Seconday LAN UDP'
list proto 'udp'
option src 'iot'
option dest 'lan_second'
option target 'ACCEPT'
option dest_port '136-139 554 1900-1905 5353 6969 30000-65535'
where the list of ports comes from https://support.sonos.com/en-au/article/configure-your-firewall-to-work-with-sonos
This is /etc/avahi/avahi-deamon.conf:
[server]
#host-name=foo
#domain-name=local
use-ipv4=yes
use-ipv6=yes
check-response-ttl=no
use-iff-running=no
allow-interfaces=iot,lan_secondary
[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=no
publish-domain=yes
#publish-dns-servers=192.168.1.1
#publish-resolv-conf-dns-servers=yes
[reflector]
enable-reflector=yes
reflect-ipv=no
[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=30
rlimit-stack=4194304
rlimit-nproc=3
This is /etc/mcproxy.conf:
config mcproxy 'mcproxy_file'
option disabled '1'
option respawn '1'
option file '/etc/mcproxy.conf'
config mcproxy 'mcproxy'
option disabled '0'
option respawn '1'
option protocol 'IGMPv3'
config instance
option disabled '0'
option name 'proxy1'
list upstream 'iot'
list downstream 'lan_secondary'
config instance
option disabled '0'
option name 'proxy2'
list upstream 'lan_secondary'
list downstream 'iot'
With this setup, I can ping devices from the lan_secondary network which are connected to the iot network so the mDNS part seems to work as expected. The Sonos app finds the speaker and I am able to cast media via Chromecast.
Any idea why Spotify Connect cannot find the devices?