Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 10.10.3.1 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.

share|improve this question
add comment

2 Answers

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

share|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
add comment

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

gateway=192.168.1.1 # or whatever your default gateway is
# anything going to 10.10.3.0 will go through the vpn (cscotun0 interface)
route add -net 10.10.3.0 netmask 255.255.255.0 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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