3

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

1
  • I've given up on this one for now.
    – Andrew
    Feb 20, 2012 at 1:56

1 Answer 1

4

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. :)

2
  • 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
    Nov 7, 2011 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
    Nov 8, 2011 at 7:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .