Automatically create routes in OS X using VPN
Very annoyed in OS X, that after the establishment of VPN-connections, you had to manually are forwarding some subnets inside VPN. After a while it got tired and was written a little script that is executed automatically immediately after the VPN-connection is established.
$ sudo nano -w /etc/ppp/ip-up #!/bin/sh # When the ppp link comes up, this script is called with the following parameters # $1 the interface name used by pppd (e.g. ppp0) # $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 IFNAME="$1" IPLOCAL="$4" IPREMOTE="$5" if [ "${IPREMOTE}" == "10.9.1.1" ]; then /sbin/route add -net 10.1 -interface ${IFNAME} /sbin/route add -net 10.2 -interface ${IFNAME} /sbin/route add -net 10.9 -interface ${IFNAME} /sbin/route add -host 10.20.30.40/32 -interface ${IFNAME} fi $ sudo chmod +x /etc/ppp/ip-up