I've successfully had openvpn running on my Edgerouter4 (and previously on my ERPro) connected to IPVanish to route certain subnets and addresses through the VPN. I basically used the instructions in this post about configuring PIA for the same purpose (policy based routing, etc etc).
I recently set up ESXi on a machine with dual Xeons and figured since it's running 24/7, why not make a VM to run OpenVPN client and route traffic through it since it's got a lot more CPU plus AES-NI instructions. This was successful too and I'm able to get clients on the VM's subnet to route through the VM (Ubuntu 16.04 server). With this setup my IPVanish openvpn speeds are in the 220/170 Mbps range (up & down respectively) instead of 32/32 with the ER4 handling the encryption.
My question is how to set up routing/NAT to go through this VM (10.0.12.2). Normally there is a static route and NAT rule set up like this:
static { table 1 { interface-route 0.0.0.0/0 { next-hop-interface vtun0 { } }
rule 5000 {
description IPVanish
log disable
outbound-interface vtun0
protocol all
source {
group {
address-group AG_IPVanish
}
}
type masquerade
}
I tried this which doesn't work:
static { table 1 { route 0.0.0.0/0 { next-hop 10.0.12.2 { } }
Plus I don't want to masquerade to 10.0.12.2 since the VM acting as a router is already masquerading. I tried some different combinations of SNAT and couldn't get it working.
Hopefully I'm just overthinking this and the solution is simple. Here's what I'm trying to accomplish:
Instead of masquerading IPVanish_address_group to vtun0, I want to route it to 10.0.12.2 located on eth3.15 without masquerade. Currently there are no firewall rules on eth3.15 except for the firewall modify:
address 10.0.12.1/24 description IPVanish2 firewall { in { modify OPENVPN_ROUTE } } mtu 1500
I don't think it matters, but the OpenVPN connection on the VM is made through 10.0.10.1 located on eth2.
Thanks for reading.