3
I have a Linux server which functions as the gateway for my home network. It has two ethernet devices:
p3p1
: WAN, public IP addressa.b.c.d
p2p1
: LAN, private IP address10.0.3.1/24
It also connects via a point-to-point OpenVPN tunnel to a remote Linux server (which I also administrate). This adds the device
tun2
: VPN, private IP address10.2.0.2/32
The question is: how do I make all traffic from clients on the LAN redirect through the OpenVPN tunnel?
I can redirect all traffic (including that originating from the gateway server) using the VPN client configuration option redirect-gateway def1
. But that isn't what I want.
Would there be a way to do this using IPTables NAT?
Thanks!
The default gateway is already set to the server. I don't want to redirect all traffic, only traffic originating from the LAN (i.e. I don't want to redirect traffic from the server itself over the VPN). – Fela Maslen – 2017-08-18T22:25:36.560
2
In this case remove the
– A. Fendt – 2017-08-20T16:08:02.157redirect-gateway def1
directive and create some policy based routing entries: http://www.tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.simple.html As you said: every traffic from the local network goes to the VPN Default Gateway and the traffic of the server goes to the Default Gateway behind p3p1.