#!/bin/bash
#
# Script used to change the default route from Sprint to the VPN.
#
GW=`route -n | grep 0.0.0.0 | grep 68 | sed -r "s/\ /\n/" | grep 68 | grep -n 1 | grep "1:" | sed -r "s/1:/\ /"`
VPN=10.8.0.1
echo "Your Sprint route is $GW."
route add -host 217.160.252.81 gw $GW dev ppp0
route add -host 217.160.253.76 gw $GW dev ppp0
route add -host 216.229.194.176 gw $GW dev ppp0  
route del default
route add default gw 10.8.0.1 dev ocvpn
echo "Your new route is over the VPN on $VPN."


# Sample of what the output of route -n should look like.
# Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
# 217.160.252.81  68.28.169.6     255.255.255.255 UGH   0      0        0 ppp0
# 217.160.253.76  68.28.169.6     255.255.255.255 UGH   0      0        0 ppp0
# 68.28.169.6     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
# 216.229.194.176 68.28.169.6     255.255.255.255 UGH   0      0        0 ppp0
# 10.8.0.0        0.0.0.0         255.255.255.0   U     0      0        0 ocvpn
# 0.0.0.0         10.8.0.1        0.0.0.0         UG    0      0        0 ocvpn
