I have an OpenVPN server set up on Ubuntu 18.04. Clients connect to the VPN and all traffic is routed through the VPN. The outgoing IP is the same IP the clients connect to.
Now I've added another network interface on a private subnet. I want the clients' outgoing traffic to be routed through that interface so that the outgoing IP will be the external ip of the NAT gateway on the private subnet.
I'm a bit at a loss as I don't know how to configure the routing. If I just increase the metric of eth1 to put it above eth0 then I can no longer connect to the VPN or SSH to the server.
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default ip-172-30-0-1.e 0.0.0.0 UG 100 0 0 eth0 default ip-172-30-10-1. 0.0.0.0 UG 200 0 0 eth1 10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0 172.30.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 ip-172-30-0-1.e 0.0.0.0 255.255.255.255 UH 100 0 0 eth0 172.30.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 ip-172-30-10-1. 0.0.0.0 255.255.255.255 UH 200 0 0 eth1
Green arrows are what I want to achieve, red is what happens now.