Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: A script for PPTP custom routing on VPNs Network
Tiger only hintTo stop OS X 10.4 from creating a default route to your VPN connection, open Internet Connect (in Applications). Choose Options from the Connect menu, then uncheck the "Send all traffic over VPN connection" option. Click OK, and you're done.

To make a custom route to the subnet on the other side of the VPN connection, read the rest of the hint...

As root, create /etc/ppp/ip-up, and put in the following code:
# When the ppp link comes up, this script is called with the following
# parameters
#       $1      the interface name used by pppd (e.g. ppp3)
#       $2      the tty device name
#       $3      the tty device speed
#       $4      the local IP address for the interface
#       $5      the remote IP address
#       $6      the parameter specified by the 'ipparam' option to pppd

## echo "1:$1 2:$2 3:$3 4:$4 5:$5 6:$6" > $DEBUGFILE
NET=`echo $5 | cut -d. -f1,2,3`
## echo $NET >> $DEBUGFILE

case $NET in 192.168.3)
     ## echo "CASE1" >> $DEBUGFILE
     RESULT=`/sbin/route add -net $5`
     ##echo $RESULT >> $DEBUGFILE
     ## echo "CASE2" >> $DEBUGFILE
     RESULT=`/sbin/route add -net netmask gw $5`
     ## echo $RESULT >> $DEBUGFILE
     ## echo "CASE3" >> $DEBUGFILE
     RESULT=`/sbin/route add -net netmask gw $5`
     ## echo $RESULT >> $DEBUGFILE
     ## echo "No match" >> $DEBUGFILE
  1. Once you create the file, do a chmod u+x /etc/ppp/ip-up.
  2. The $5 variable is your remote IP address (your IP address on the remote network).
  3. In the first case statement, change the 192.168.x entry to the first three octets of your remote network. In this instance, the remote IP is, and the remote network is (the remote VPN box is doing the routing -- this is so SAMBA will work without needing to proxy ARP).
  4. Uncomment (remove the ##'s) from the debug lines to see what this script is doing. Output will be written to the /tmp/ip-up-debug.txt file. Remember to put the ##'s back in when you are done testing.
  5. This script has options for three different VPN connections. Just change the 192.168.x entries to the different network addresses of your different VPNs.
[robg adds: The first part of this hint is a duplicate, but I believe the second part is new, so I chose to run it as is...]
  • Currently 4.17 / 5
  You rated: 5 / 5 (6 votes cast)

10.4: A script for PPTP custom routing on VPNs | 2 comments | Create New Account
Click here to return to the '10.4: A script for PPTP custom routing on VPNs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: A script for PPTP custom routing on VPNs
Authored by: Patchsmyle on Feb 22, '06 10:25:23AM

So now that this ability of choices has been implemented. It brings an issue to the table. In my case I go do different clients. Sometimes they use the same network address 192.168.1.x. It would be interesting to be able to have a full setup of routes, but have the script perform a reverse DNS lookup. Based on that lookup, it would filter out given routes to add. Talk about an intelligent VPN Tunnel tool!!

Any one willing to take a stab at it?

[ Reply to This | # ]
10.4: A script for PPTP custom routing on VPNs
Authored by: tf23 on Feb 22, '06 01:55:10PM

I would like it better if the logic in the script checked for any location defined that is other then 'automatic'.

That way, you could set location = 'client blah' via the apple menu. VPN in, and it'd set you up just as you wanted.

[ Reply to This | # ]