Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a personal VPN that I use while at work.

What I want to do is exclude all of my local traffic from the VPN. Everything in the 10.* range needs to work the same was as when not connected, and all other traffic should go over the VPN.

  • 10.x.x.x => goes out eth0
  • all others => over ppp0 (vpn)

'vpn on demand' won't work, because I don't want it triggering when I browse a page which has a link to an image on twitter, for fbcdn, etc. and tries to download it.

I have seen a few questions here which do the exact opposite: send only 10.* traffic over VPN. I can't see how to reverse those answers, knowing as little as I do.

Is there any way to do this? I am using a standard PPTP vpn, as well as a L2TP one. The L2TP connects less reliably, if ever, so I prefer to use the PPTP one.

FYI: I run this when google gets blocked too badly over here, since it is the only thing that finds coding questions reliably (and too much content is permablocked on wordpress/blogspot/etc.) Right now I connect & then disconnect once I am done, but during that time I am locked out of svn/file shares/etc, since they are all 10..*

share|improve this question
    
I've given up on this one for now. –  Andrew Backer Feb 20 '12 at 1:56

1 Answer 1

up vote 2 down vote accepted

At the moment i'm not in a position to find you more detailed information on this, so sorry if this is vague, but i recall reading about this before, and the trick was to set static routes in the scripts contained in /etc/ppp. For example, on the 'up' script i think you could do something like:

#!/bin/sh

# route everything through PPP
/sbin/route -n add -net 0.0.0.0 $IPREMOTE >> /tmp/ppp.log 2>&1
# exclude 10.x.x.x
/sbin/route -n delete -net 10.0.0.0 $IPREMOTE >> /tmp/ppp.log 2>&1

I may be slightly wrong about the syntax, but hopefully that's a start. :)

share|improve this answer
    
Thanks! I'm looking into that right now. Thankfully, at home I don't need those routes since I am the only one, and it is 192.*. I wonder what the effects would be if I connected while on a strange AP that did have a 10. subnet. –  Andrew Backer Nov 7 '11 at 6:36
    
Not working quite right, but one of the commands does something ;) I'll spend more time on it when I have a slow day at work. –  Andrew Backer Nov 8 '11 at 7:14

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.