Setting up a server that routes local traffic through vpn, while still being able to access internet directly
Posted
by
Kazuo
on Server Fault
See other posts from Server Fault
or by Kazuo
Published on 2013-10-20T18:38:46Z
Indexed on
2013/10/20
21:56 UTC
Read the original article
Hit count: 141
The goal is to setup a local server that routes local traffic through an uncontrolled remote vpn service while still being able to access the internet directly (not tunneled via vpn) and provide services through that direct connection.
It is supposed to look like this: http://i.stack.imgur.com/74dGC.png
Note: There is another router with modem between the local server and the internet.
What is the easiest (best?) way to get this network setup working?
I'm planning to setup the connection between the local router and the local server with simple ip forwarding.
The problem now is that all the server's traffic is routed through the vpn tunnel as soon as I connect the server's openvpn client to the remote service so there is no direct internet connection available. My first idea was to setup a virtual machine (lxc container or something) and run the vpn client and local networking stuff in the vm. So that the vm receives all the incoming traffic from the local router and tunnels it through the vpn. This, as far as I understand, should not affect the physical server's network connection and should allow it to provide services to the internet. Before I start trying to set this up (I don't have much experience in networking), is there any easier or better way to do this? I would be thankful for every suggestion.
Edit: Let's say the interface connected to the internet is eth0 and the interface connected to the local router is eth1. Another idea would be to create a virtual interface eth0:0 and specifiy it as openvpn's local endpoint and then force any traffic coming from eth1 through eth0:0. I'm not sure how I would force the traffic through eth0:0, though (possibly by adding routes).
© Server Fault or respective owner