One OpenVPN client that optionally tunnels gateway traffic
Posted: Wed Dec 24, 2014 7:44 pm
I currently have two wireless routers configured as OpenVPN clients tunneling to the same server running two OpenVPN service instances; router1 client tunnels only the private 10.11.0.0 network traffic, and router2 client tunnels all network traffic. With this setup, I can choose whether my wired/wireless devices get fully tunneled or not by choosing which router to connect to.
But I want to know whether I can have this same choice using only one router and OpenVPN client. My hope is that different routing rules would be chosen according to the gateway used by the wired/wireless device. The router1 has a LAN address (say 192.168.1.1) which is the gateway normally used by the wired/wireless devices, but the router1 also has an OpenVPN address (say 10.11.0.6) that can successfully be used as a gateway address by the wired/wireless device. Is it possible to write iptables rules such that *all* traffic coming to the OpenVPN gateway address 10.11.0.6 gets tunneled, but traffic coming to the 'regular' gateway 192.168.1.1 gets routed normally (tuneled only if the destination is the network 10.11.0.0)?
But I want to know whether I can have this same choice using only one router and OpenVPN client. My hope is that different routing rules would be chosen according to the gateway used by the wired/wireless device. The router1 has a LAN address (say 192.168.1.1) which is the gateway normally used by the wired/wireless devices, but the router1 also has an OpenVPN address (say 10.11.0.6) that can successfully be used as a gateway address by the wired/wireless device. Is it possible to write iptables rules such that *all* traffic coming to the OpenVPN gateway address 10.11.0.6 gets tunneled, but traffic coming to the 'regular' gateway 192.168.1.1 gets routed normally (tuneled only if the destination is the network 10.11.0.0)?