I am quite new to linux and Raspberry Pi world and networking in general.
I would like to add a VPN on my Pi, connect my XBOX to my Pi using LAN and have it act as a gateway of sorts so my XBOX is on the same VPN basically, and route all traffic over the Pi's wifi (WLAN).
Now i've got this working with just WLAN at the moment, but I think it's quite inefficient for the XBOX to go over the wifi to the router, to the Pi, and back to the router.
Currently I have this in my /etc/interfaces file:
auto lo iface lo inet loopback auto eth0 allow-hotplug eth0 iface eth0 inet manual auto wlan0 allow-hotplug wlan0 iface wlan0 inet static wpa-ssid "XXX" wpa-psk "XXXXX" address 192.168.2.14 netmask 255.255.255.0 gateway 192.168.2.1 dns-nameservers 192.168.2.1
And in my /etc/rc.local file I have this:
sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE sudo iptables -A FORWARD -i tun0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan0 -o tun0 -j ACCEPT
And it's working. But i think there is quite a bit of latency because it's all happening over wifi.
Is there a way to connect the XBOX directly to my pi using a LAN cable and have the same thing working?
I've tried giving my eth0 a static IP address and trying various configurations for dns and gateway settings, but in all cases either my pi loses internet access, or my xbox (lan device) has no internet access.
I am using expressVPN if it's relevant, as i've read it does not allow level 2 routing or nat-ing.
Any help would be appreciated.