#!/bin/bash #start tunnel /usr/bin/sudo /usr/sbin/pppd call vpn cnt=0 /bin/echo -n "Waiting for ppp0 to be up" while [ 1 ] ; do /bin/echo -n "." /sbin/ifconfig | /bin/grep -q ppp0 if [ $? = 0 ]; then break; # ppp0 is now up fi /bin/sleep 1 if [ $cnt == 15 ]; then /bin/echo "waited 15 seconds, exiting" exit 1 fi cnt=`/usr/bin/expr $cnt + 1` done /bin/echo "" # dig out ip addr VPN_IP=`/sbin/ifconfig | /bin/grep 128.184 | /usr/bin/cut -f2 -d: | /usr/bin/cut -f1 -d" "` # traffic to the vpn subnet has to go via the modem /usr/bin/sudo /sbin/route add -host 128.184.151.1 gw 192.168.0.254 # traffic to the vpn server has to go via the modem /usr/bin/sudo /sbin/route add -host 128.184.170.1 gw 192.168.0.254 # add route for all deakin traffic to go via vpn /usr/bin/sudo /sbin/route add -net 128.184.0.0 netmask 255.255.0.0 gw $VPN_IP /usr/bin/sudo /sbin/route add -net 139.132.0.0 netmask 255.255.0.0 gw $VPN_IP