Kodi, VPN and local access to the web interface

Hi

I’ve got Kodi running on an Android box and it’s pretty sweet. I also installed a VPN client on it. Mostly, I use my phone as a remote via Kodi’s web interface.

My problem is that if I start the VPN client, Kodi is no longer controllable via the web interface. I guess it binds to the VPN address.

Is there any way to configure Kodi to use the local IP for its web server while using the VPN for communicating externally?

The VPN puts you in a different network and Kodi will only be able to listen on that network, not the local one. You might be able to to route the port for the web interface (usually 8080), but on Android you will likely need a rooted device for that, but no idea how you could achieve that.

Actually, as I understand it, the VPN puts the box on a second network. For example, I can still ping it at the local address, it just seems that Kodi binds to the VPN address. I would have thought that I could change that Kodi behaviour, and tell it which address to bind to.

Hmm just typing that has given me an idea. Maybe if I start kodi before starting the vpn client, kodi will stay bound to the local IP. Will try when I get home.

The Ping gets answered by the network interface, which is of course still active (since it is through this interface that the VPN is used). But every application on the device is basically on the VPN, even if they were started before the VPN.

Right. Both network interfaces are active, so applications should be able to choose which to use.

When I use the VPN on my Windows PC, I can still access the media server running on it from other devices on the lan, because I can tell it to use the local interface.

Not every app. Think of it as dual network. For example can still hit a local NAS to playback media. Also if ur VPN is engaged and you SSH or other shell commands with specifically setting up a proxy or torify that activity you will be on ur ISP assigned IP not the VPN.

That is true, but usually depends on the app. And the majority of apps don’t give you that control. Kodi might actually (but if it does likely not through the GUI), but even if it does, you probably couldn’t make it use eth0 for port 8080 only, it would be either everything over the virtual network interface or everything over the default interface.

Edit: you bring up a good point though, active connections are unaffected (though Kodi doesn’t really keep you connected unnecessarily, only when it actually needs something). A SSH tunnel crossed my mind as a possible solution, though I didn’t really think about connection before connecting to the VPN. We don’t really know what OP has to play around with, SSH tunnels are no problem even on Android devices, though you will have to connect SSH before the VPN, because at least I don’t know any SSH client for Android that allows selecting the network interface, that or SSH through the VPN/internet. OP will need a SSH server for that, though.

It’s certainly possible to have an application bound to multiple ip’s. It’s pretty common in Apache, for example, where one instance of the web server software can listen to multiple ip’s and ports simultaneously

If it’s not possible with Kodi for some odd reason, I guess I could try looking at the network stuff on Android, maybe mapping all incoming port 8080 requests on the local ip to port 8080 on the vpn port, and update the routing take to make sure it looks for that address on itself instead of routing it out to the internet. I don’t want my menu navigation tho go all around the world just to get from my couch to my kodi.

I’m a bit gobsmacked that this isn’t a really common use case.