2

I am using a openvpn client, with my default configuration the default GW is overwritten. (redirect gateway on the server)
I have 2 routing tables on my linux client, 1 (default eth0), 100 = tun0 which is added by my up script.
What i need is to have split routing using 2 different routing tables.

openvpn client config:

client
dev tun
proto udp
remote blea.com
auth-user-pass
persist-key
persist-tun
remote-cert-tls server
reneg-sec 0
keepalive 10 60
route-nopull
pull-filter ignore "ifconfig-ipv6"
script-security 2
up /etc/openvpn/route-up.sh
mute-replay-warnings
explicit-exit-notify 3
cipher AES-256-CBC
auth SHA512
tls-version-min 1.2

route-up script:

if [ $(/bin/cat /etc/iproute2/rt_tables | /bin/grep $dev | /usr/bin/wc -l) -eq 0 ]; then
/bin/echo "100 tun0" >> /etc/iproute2/rt_tables

/bin/ip route add default via $route_vpn_gateway dev $dev table $dev

There is 1 problem, when using route-nopull the $route_vpn_gateway environment variable is not populated.
When i disable route-nopull the default gateway on my default routing table is overwritten so all the traffic goes through the tunnel.
I have no access to the server so i cannot change anything there.
The default GW which i get served by the OpenVPN server is dynamic, so i cannot set this static.

How to get around this?

3

One way to do this is to use the route-noexec option (instead of route-nopull). This will fully populate your route-* environment variables but won't actually modify your route table, it will leave all the route modification to your route-up.sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.