Save the route
script to /usr/local/lib/openvpn/route
on the client. Make it executable with chmod +x
.
Remove the push redirect-gateway
option from the OpenVPN server config.
Add these options to the OpenVPN client config:
setenv OPENVPN_ROUTE_TABLE 94
route-noexec
route-up /usr/local/lib/openvpn/route
route 0.0.0.0 128.0.0.0
route 128.0.0.0 128.0.0.0
Run these commands as root on the client before starting OpenVPN, replacing VPN_SERVER_IP_ADDRESS as appropriate:
ip rule add table 94
ip rule add to VPN_SERVER_IP_ADDRESS unreachable
ip rule add to VPN_SERVER_IP_ADDRESS table main
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
These commands need only be run once per boot. The changes they make will be lost when the system reboots.