Friday, February 4, 2011

add static route after vpn interface up on Mac OSX

to do this on mac is simply create a script and put it under /etc/ppp/ , and name it ip-up, here is my example, on script you can see I need both 10.10.20.0/24 and 10.10.10.0/24 to be routed to ppp interface after vpn interface get connected.



bash-3.2#
bash-3.2# cat /etc/ppp/ip-up
#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices; export PATH

ifppp=$(ifconfig ppp0 | grep inet | awk '(print $2}')
/sbin/route add -net 10.10.20.0/24 $ifppp
/sbin/route add -net 10.10.10.0/24 $ifppp

bash-3.2#

current

last archive