Permanently route an host to VPN in OS X

Friday, July 4, 2014

I need VPN from the university to ssh to my office computer. But each time I start the VPN, I have to route the host to ppp0 manually to use it,

sudo route add ppp0

because my previous attempt of rerouting was lost. And frankly it's a pain. I wonder if it's possible to use some script to automatically reroute it every time I successfully establish the vpn connection.

PS1. I am using OS X. But I think for both unix and linux system they should be similar?

PS2. I don't want to route all connection to vpn because in that way, the connection to other hosts will be unnecessarily slowed down.