I’m planning to wipe and reinstall OSMC from my Raspberry Pi B+. I was wondering whether it would be possible to have the internet going through the WiFi, but the LAN traffic routed through the Ethernet.
Effectively I want to run the internet through a particular router which is set up to run through a VPN, but when doing so I lose the ability to use my phone as a remote and I lose access to my NFS because (I believe) the LAN traffic also routes through the VPN.
The VPN router is downstream of the main router, and the NFS is connected to the main router. I’m hoping that by routing the LAN directly through the main router I will still be able to use my phone to access the RPi (the phone will be connected to the main router) and the Pi will still be able to access the NFS.
I have spent some time looking around and it doesn’t look like it’s possible, does anyone have any ideas as to how it may be doable?
Thanks in advance!
Not trivial at this time unfortunately.
Can probably be done with a network namespace or adjusting routes. Keep in mind OSMC only connects to Wired if it is available; so you’d need to manually connect to WiFi
You might be able to do it by adjusting the route metric but perhaps a change to your network set-up would be more appropriate.
Assuming the following:
- a VPN client process is running on the internet-facing router
- you are running a dual-NAT configuration (where the WAN port of the of the “main” router connects to a LAN port of the VPN router)
you should be able to talk to all devices on the (main router’s) LAN from your phone.
If I’ve read this right, I would expect it to be ‘upstream’, ie between all your local network and the outside world. Then your ‘main’ router would just be a gateway behind which everything can talk to each other.
If I’m being slow here, please ignore.
But just going from your heading, I was doing exactly that recently while testing something. WiFi connection to a wifi/4G router (on 192.168.0.0) while LAN connected on ethernet (192.168.1.0). And despite what Sam says, it would re-connect to WiFi automatically on re-boot.
I think you’re right, I just haven’t been able to work it out yet. This was just an idea of a workaround if it was easy, which it seems not to be.
I’m pretty sure both assumptions are correct but it doesn’t seem to work - think it might have something to do with the subnets I have set up. I have the main router handling the DHCP work, and a static IP set up for the VPN router. The main router uses subnet 192.168.2.x while the VPN router uses subnet 192.168.3.x. I believe that connecting the Pi to the VPN router must assign it an address in the 192.168.3.x subnet, which prevents it talking to the 192.168.2.x devices.
I also can’t access the router web interface for the VPN router while connected to the main router, should I be able to?
@grahamh I think it’s downstream, as the VPN router is plugged into the main router which is then internet facing. The way you describe would be preferable, but the mini router I use does not really have the oomph to deal with the traffic. In the future I hope to invest in a decent router which can run a VPN client, since that will stop all the messing around with LAN settings but for the time being this is the best I’ve got.
Your testing set up sounds about right (I think). Could you give a description of how you managed that?
Currently ConnMan will only connect to the first preferred technology. Then it gives up. A connmanctl connect in rc.local will work around this
Simple, really. You just configure the ethernet IP in one subnet and the wifi in the other. In my case, my wired ethernet has a DHCP server for 192.168.1.0/24 and the 4G router does the same for 192.168.0.0/24. You may find giving Pi static IPs on each subnet more reliable. In the test setup there was no bridging between the two subnets. In everyday use, the Pi is a gateway between the interweb and the domestic LAN but that doesn’t seem to be what you want. The trick is to get the Pi to connect to the WiFi you want if you also have WiFi on your ‘main’ network. Probably telling your main router not to talk to the Pi’s MAC will do it.
I must have managed to turn on both technologies in MyOSMC and I thought that had stuck - maybe I had to do this after every re-boot but remembered it wrong. I’ve wiped that SD card now.
It won’t persist. It’s a ConnMan limitation
Well thanks both for the help, I’ll look into the network side of it and see if I can work it through that way. Shame it can’t be done easily but it’s pretty niche as requirements go, so I’m not surprised.