You are not logged in.

#1 2017-06-22 00:39:06

thoss
Member
Registered: 2015-02-16
Posts: 33

Split tunnel with OpenVPN

I'd like to configure OpenVPN so that I can choose what traffic to direct over it.

I figure one way to do it would be to set a second default route at a higher metric than the normal default route.

So I pass route-nopull as an option to my openvpn setup and comment out redirect-gateway.

Then add a route via

sudo ip route add 0.0.0.0/0 via 10.x.x.x metric 245

So my route table looks like:

% route                                                                                                  
Kernel IP routing table                                                                                                              
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.x.x.1       0.0.0.0         UG    202    0        0 eth0                                                         
default         10.y.y.1     0.0.0.0         UG    245    0        0 tun0                                                         
10.x.0.0       0.0.0.0         255.255.255.0   U     202    0        0 eth0                                                         
10.y.y.0     0.0.0.0         255.255.255.0   U     0      0        0 tun0

Testing with

ping -I tun0 $IP-or-URI

or curl --interface inevitably hangs, though. I can still ping the gateway at .1.

Everything still routes normally to my default gateway on this setup.

Any tips to get things to route successfully through my tun device when I specify it?

Offline

Board footer

Powered by FluxBB