I’m looking to leverage a Linux device as a default gateway, routing off-host traffic over an OpenVPN connection without impacting the hosts route the internet. I don’t want traffic for the host to egress via the VPN, only that traffic that is coming from other devices.
I have successfully configured the NATing, have the traffic from devices using my host as a default gateway egress using whatever the default route is on the host (e.g. if the VPN is open, it goes via the VPN, if it’s not, goes via the hosts normal internet connection, with the host as an additional hop in traceroute)
However, I cannot successfully configure this so that the OpenVPN connection doesn’t impact the hosts networking and have the host route gateway traffic via the OpenVPN interface
Things I have done:
- Configured IP forwarding & verified it works
- Been able to stop OpenVPN updating the default route on the host with
pull-filter ignore redirect-gateway
I’m guessing that there is either a dynamic part of this (pull the route information from the open vpn config), or hopefully a ‘no, really, just apply these routes for the NAT traffic’ flag/setting.
- Internet access is via a boring router with no fancy capabilities
- Linux device (Raspberry Pi) wired to the network, running ufw, iptables, openvpn
- Other device(s) wired, some of which I want to manually set their default gateway to the Linux device
- Subnet is