I am trying to setup Spotify connect. I run the linux client on my desktop and the Android client on my smartphone. The smartphone is connected to the local WLAN. The desktop is connected to the same IP subnet via ethernet. The smartphone does not detect the desktop via Spotify Connect, though.
Everything I can find about network setup is the following useless comment:
The following IP ranges should be open on port 4070: 220.127.116.11/21, 18.104.22.168/21.
That number 21 is the prefix length
This is not even half the information necessary. 😞 I need the following information for every communication spotify requires:
For a reference example:
The desktop device has IP address 192.168.93.100
The phone has IP address 192.168.93.104
Both have outbound internet access via gateway 192.168.93.1
Spotify communications on my machine:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:4381 0.0.0.0:* LISTEN 22382/spotify
tcp 0 0 127.0.0.1:8099 0.0.0.0:* LISTEN 22382/spotify
tcp 0 0 127.0.0.1:4371 0.0.0.0:* LISTEN 22382/spotify
tcp 0 0 0.0.0.0:57621 0.0.0.0:* LISTEN 22382/spotify
tcp 0 0 192.168.93.101:46839 22.214.171.124:4070 VERBUNDEN 22382/spotify
tcp 0 0 192.168.93.101:57621 192.168.93.104:53357 VERBUNDEN 22382/spotify
The last line tells me the phone and the desktop are connected to each other. They do exchange data:
pkts bytes target prot opt in out source destination
115 33507 ACCEPT tcp -- net0 any 192.168.93.0/24 anywhere tcp dpt:57621
Nevertheless, the phone claims there are no devices to connect to, and it does not control the desktop. I'm confused. What might be going wrong?
Hi! Try connecting them on the same WiFi. I think it only works with the same WiFi. Hope this helps 🙂
The desktop has no wi-fi. It's on the same IP subnet as the phone (192.168.93.0/24) without any address magic (like NAT) inbetween (bridged ethernet/wireless). There IS a firewall, but disabling it doesn't make it work so that's not the root cause.
So if spotify uses only standard IP packets that should be as good as "the same wi-fi". If it does more involved things, I need to know which, thats why I asked about broadcasting and other protocols. In any case, for proper firewall setup later I need to know which holes to punch specifically.
P.S. It seems it is using IP multicasting for mDNS/DNS-SD ("ZeroConf"), network-local HTTP and a third protocol relayed by the spotify servers  I wonder whether I need avahi installed? Is anyone else using spotify connect on linux?
I don't know the exact details about how devices are detected to be near, but it is probably "zeroconf" and some other local subnet probing.
You should definitely be able to control your ethernet only desktop, especially if you know this much about networking. I am controlling a desktop linux ethernet from my android right now.
The only thing I can think of is that you are using the stable version of Spotify on 32-bit linux, which is only version 0.9.4 which does not have connect support. You need either 0.9.17 which is 64-bit only or the testing version, which is currently 1.0.14 for both 32 and 64-bit.
Thank you a lot, jooon, that was a very useful hint. I checked and as it turns out, I'm already using v0.9.17.
As it seems to work for you, can you watch the network what it is doing? Do you have an idea what might be different between your setup and mine? How do you connect ethernet and wi-fi?
Hope you are doing well.
Lets start with the IP ranges :
126.96.36.199/22 - Spotify UK
188.8.131.52/21 - Spotify Sweeden
|IP range (network - broadcast)||Subnet Mask|
|184.108.40.206 - 220.127.116.11||255.255.252.0|
|18.104.22.168 - 22.214.171.124||255.255.248.0|
But this should not be the case.
I would love to see some tcpdump and netstat, but lets start just with netstat :
netstat -antp | grep spotify
edit : It looks like the connection is done over different port every time spotify is restarted, so it is good idea to open all the ports and check if Spotify connect is working normally : )
I already posted a netstat in the first post. in fact, almost exactly the command you asked for 🙂 I only added -v as well.
P.S. Oops, it is localized. "VERBUNDEN" means connected in that case.
P.P.S. I would love to do some packet capture, but obviously I'd need to know what to look for first.
3PS. For completeness sake: I also mentioned in the OP that I did switch off the firewall completely for initial testing.
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game…