0

I have a Virtual Private Server (VPS) that I connect to on port 22 using ssh.

Once I'm connected to that VPS I make web requests from it (through curl for example)

By default these web requests come from the public IP the VPS assigns me.

What I want to do is connect to Private Internet Access (PIA) Virtual Private Network (VPN) on the VPS so that instead of having the web requests on the VPS come from the public IP that was assigned to it, web requests will come from PIA's VPN

So far to try to get this to work I've installed network manager and have enabled it to manage ifupdown and installed openvpn and the different configs that private internet access installs with its install shell script and connected to the VPN using nmcli

This shows that there is a connection to the tunnel but all traffic is still being routed over eth0 not the VPN tunnel.

I believe this is due to how iptables is currently setup but I don't understand iptables enough to route outgoing traffic on the VPS over the private internet access VPN while still being able to maintain my port 22 SSH over the VPS's default IP/gateway.

Any help on how I could get this setup would be greatly appreciated.

  • Thank you for the welcome! I am trying to ssh into my vps and then from the vps make a http request to google.com (for example), I want that connection to google from the vps to be over PIA's VPN. Does that make it a little clearer what I'm trying to do? I Really appreciate the prompt reply! – NomNomCameron Jan 2 '17 at 7:05
  • PIA = private internet access - the VPN service I am trying to use on my VPS. I changed the question to be as explained as possible, hopefully this helps! – NomNomCameron Jan 2 '17 at 19:19
  • Deleted my previous comments. More clear now. This has nothing to do with ssh, vpn, iptables, openvpn nor vps (which are the tags you used) but is a pure and simple network routing question. Is the VPN address on your server a fixed routable IP address? – Fabby Jan 2 '17 at 19:52
  • Private internet access allows you to connect to many different VPN's all of them have a public IP address that does not change – NomNomCameron Jan 3 '17 at 0:35
  • edit yor question and provide ifconfig output before and after connecting to the VPN. (Does PIA allow split tunneling?) – Fabby Jan 4 '17 at 3:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.