Routing all traffic except a few IP-ranges though default gateway in Mountain Lion

Solution 1:

If you specify in the VPN preference panel (System Preferences, VPN item, Advanced) that you do NOT want all traffic routed through the VPN, then after connecting to the VPN, none of your routes will be altered. Then, to get routes just for the specific things you need that are on the inside of the VPN, you need to create this file:

/etc/ppp/ip-up

containing

#!/bin/bash
/sbin/route add -net 10.10.10 -interface ppp0

where "10.10.10" corresponds to the subnet of where you are inside. The above works when I want to get into the 10.10.10/24 network, whose subnet is 255.255.255.0. If the subnet was 255.255.0.0, I would substitute "10.10" instead.

When you made the file, set its permissions so it will run after the VPN connects:

chmod 755 /etc/ppp/ip-up 

I don't know what to tell you if you have multiple VPNs that you need to connect to, each with different routes that need to be added. But this works for just 1 VPN.