andreadima
Posts: 1
Joined: Mon Jun 20, 2016 8:45 am

Connecting to eth0 interface through wlan0/VPN

Mon Jun 20, 2016 8:52 am

Hello everyone,

I've recently bought a Pi 3 (mostly for fun), and i wanted to try using it to connect to my home network through a VPN. At the moment i've succesfully created the VPN and connected to my Pi using OpenVPN, but i'm quite unexperienced in the next step.
The Pi is connected to the internet through it's wireless interface, which is using a 192.168.1.x network. I'd like to access any device that is connected to the ethernet port, which i configured as 192.168.2.x.
I'm unsure as to what i need to do next: bridge the ethernet interface to the wireless one? Or is it just a matter of correctly configuring the VPN?

Thanks in advance

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Connecting to eth0 interface through wlan0/VPN

Mon Jun 20, 2016 5:26 pm

You can't bridge a wifi interface in client mode with an ethernet interface. Only if the wifi interface is in AP mode.
But your can route/filter between the 2.

I suppose what you are looking for is this:
- bridge the openvpn interface with the eth0 port, so that when you land on this side of the tunnel, you're in br0 and see all machines connected behind eth0
- NAT/filter between br0 and wlan0 to let everybody (including openvpn) access the internet
- Depending on which side does the connect, port-forward a hit on, e.g. wlan0 port 1194/tcp to br0 port 1194/tcp

I assume the Pi listens, and you actively connect to it with a client. So you'll need 2 port forward and 2 NAT rules (one set in the router, one set in the Pi.) It should work fine, I've never seen Openvpn complain about double-NAT.
For performance and stability, turning the Pi around with its ethernet link towards the router, and an AP for the clients would be preferable. Or better yet, find a physical switch and an extra ethernet cable, connect Pi, router, PCs to that switch. Then in the Pi add eth0 and the openvpn interface to a bridge. No more wifi and no more double-NAT.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Beginners”