Can’t chromecast some apps when using VPN on Pi

here is my setup:
A raspberry pi 3 is running osmc (OS is irrelevant)
The Pi is connected to a VPN via OpenVPN.
The Pi creates an access point using hostapd (wlan0)
The Pi provides DHCP to the wlan0 AP using dnsmasq
IP routing tables route wlan0 traffic to the tun0 interface

Everything so far works great, my andoid phone gets an IP address and can access the internet via the VPN. There was an issue with DNS leaking but now I fixed that so that dnsmasq uses the nameservers provided by the VPN provider. This is confirmed visiting https://ipleak.net

On my phone I can access and watch geo-restricted content such as BBC iPlayer and Netflix.
But when casting these apps to the Chromecast (also connected to the same AP) they do not work as expected.

Having read more it seems Chromecast has hardcoded the DNS it uses rather than those provided over DHCP, so I have blocked access to 8.8.8.8 on the pi’s routing table. This does cause the Chromecast to make DNS calls to my Pi. I have also tried using DNAT to redirect those calls to the VPN DNS servers.

But it sometimes works, but never reliably, I have no idea why the BBC iPlayer app (this is the only one as ITV and Channel 4 work perfectly) does not cast properly over Chromecast, but it does on the android even though they are now on the same network and I have blocked google DNS.

I think this has something to do with BBC detecting that I am outside the UK, and most likely DNS leaking was the issue but I have fixed that. Does anyone know how iPlayer detects your country? It starts to cast with the loading screen and then reverts to the “Ready to cast” screen.

Any help would be appreciated, this has been driving me nuts for weeks, happy to provide as much logging or info as needed.

Answer

Attribution
Source : Link , Question Author : Dav , Answer Author : Community

Leave a Comment