Thumbnail: spotify

How to get Spotify to work through NordVPN

on under vpn
3 minute read

If you are using a VPN, Spotify sometimes get’s confused and thinks you are offline. The solution is pretty simple and it’s here.

It’s also good to know why it is failing, what doesn’t work and what could work with a bit more digging.

The situation

If you use Spotify and a VPN, Spotify probably thinks you are offline. So why does it think that? Spotify is doing its own check to figure out if you are connected to the Internet. I’m not sure if they implemented it themselves, but they are not only checking if you are connected, they also check how good the connectivity is.

Let’s assume for simplicity, they are using the NetworkManager tool, nmcli. @voho explains it in the comments of the AUR package, so I’m gonna paraphrase his answer.

His solution only fixed my problem for a while, but it also seems a little hacky. If I’m connected to the Internet but have my VPN activated, nmcli networking connectivity check tells me, that my connectivity is limited instead of full.

The problem

NetworkManager figures this out, through fetching a txt-file from some server. This information is in /usr/lib/NetworkManager/conf.d/20-connectivity.conf and this is how it looks like on my machine:

[connectivity]
uri=http://ping.archlinux.org/nm-check.txt

There seems to be an issue coming from how NetworkManager makes this check, because it sends a request over the VPN and the network card, but the later one is stopped by the firewall. NetworkManager now seems to confuse this missing answer as a connectivity issue. Networking is not my strength, so I guess we have to trust @voho on this one.

The non-fixes

Make a hole in the firewall

Now, we could fix this, as @voho suggests, by letting that second request through. Even if we update his command to the new address in the .conf-file, it doesn’t work anymore, at least on my machine. If you want to try it, do it, just do a curl --verbose http://ping.archlinux.org/nm-check.txt (check if your file has the same URI) to get the IP-address.

Turn off NetworkManager’s connectivity check

Yeah, you could do that and probably break other stuff. Other services could rely on it. Just add the line enabled=false to /usr/lib/NetworkManager/conf.d/20-connectivity.conf if that’s your style.

Completely turn off the VPN

Seems overkill, but you aren’t supposed to have a VPN running all the time anyway. What’s the point of using a VPN if you log into thousand services? Commercial VPNs are often unneccessairy for most people as the majority of sites are TLS encrypted through HTTPS. If you are looking for real anonymity or security from being checked on by your local government or ISP, use TOR.

Tell NetworkManager to not send a request into the firewall

You could program it and make a pull request to the NetworkManager repository. This is an issue they know about, but it’s not fixed yet.

The simple fix (for now)

Just put the server from the connectivity check in your whitelist. Sure, you are trusting archlinux.org in this case, but they say they don’t log.

So, let’s figure out the IP, which is done by a little curl --verbose http://ping.archlinux.org/nm-check.txt. It is 95.216.195.133 btw.

Now, in case of NordVPN, do a little nordvpn whitelist add subnet 95.216.195.1/24 to whitelist their servers. That’s it, now you trust Arch Linux a little bit more and nmcli networking connectivity check should give you a nice full as an answer. Spotify should be online now, restart it if it’s still confused.

If Spotify still thinks it is offline, tough luck, I guess this is outdated then.

Happy (kinda) private or region unlocked music listening!

spotify, vpn, nordvpn, linux, nmcli