A script to provide VPN split routing via PPPTP

Mar 17, '03 08:51:00AM

Contributed by: Anonymous

Apple's PPTP Internet Connection app doesn't provide split routing. To avoid that all your traffic going through the VPN tunnel, you could start (as root using sudo), when the VPN connection is already established, the following script.


#! /bin/sh
dr=`netstat -nr | grep ' UHLW ' | awk '{print $1}'`
route delete default AAA.BBB.CCC.DDD
route add    default $dr
route add    AAA.BBB.0.0 AAA.BBB.CCC.DDD
Where AAA.BBB.CCC.DDD is provided by the logfile of the PPTP connection application: "remote IP address AAA.BBB.CCC.DDD" . Then only connections to the AAA.BBB.x.y range of addresses will use the VPN.

[robg adds: I haven't tested this one.]

Comments (16)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030313194656474