I need to use for some things a cisco VPN connection, but I don't want to route all my trafic over the VPN but only that traffic, that is send to a specific network.

How does a script look like, that sends all traffic to or exchange.server.de through the VPN tunnel and the rest of the traffic uses the default route that existed before the VPN was established?

Thanks for your help.


You would have to set up split tunneling on the concentrator side of the connection This link will give you a good idea of what I'm talking about. If you do not have access to the VPN concentrator, then you will not be able to change what does and what doesnt go through the tunnel

| improve this answer | |
  • Hmm, I mean I can change it in the way, that nothing goes through the VPN tunnel with deleting the default route. But when I add the subnet of the network I want to route through the VPN to my routes, the routing dosen't work... So I think it must be somehow work. At least it works fine with L2PT... – Dominik Jan 17 '13 at 17:21

You'll need root access, but basically, you would reset the routes (route) and the IP chains (iptables):

gateway= # or whatever your default gateway is
# anything going to will go through the vpn (cscotun0 interface)
route add -net netmask dev cscotun0
# everything else will go through the gateway
route del default
route add default gw $gateway
# flush iptables to clear the ciscovpn chain
iptables --flush
iptables --delete-chain
echo "nameserver $gateway" >> /etc/resolv.conf

This is just a rough setup (and assumes that your VPN network is class C). The one that I use with my company's VPN is much more involved with nearly a dozen static routes added.

You aren't quite clear about what the VPN networks are, so I made some guesses.

| improve this answer | |

I just set up what they call "client side VPN split tunnel" to achieve access to two hosts by VPN while maintaining traffic outside the VPN (in this case the default route allowing access by ssh and so on). As I understand it the perfect way would be a server-side configuration but obviously this is not always possible.

Find this well written How-to that explains how to set up a split tunnel to access some hosts inside the vpn network with fixed IP addresses and keep DNS and all other routes to the internet.

| improve this answer | |

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.