3G work with office network
phillips@phillips-ThinkPad-T420:~$ cat bin/3Gwifi_net_office.sh
#!/bin/sh
# For dropbox sync ~/Dropbox
# This script help update routing table for forward main traffic to wifi -> 3G
# and keep office network connection via eth0
wlanip=`ip -4 addr show wlan0 | grep inet| awk '{print $2}' | awk -F \/ '{print $1}'`
newgw=`echo $wlanip | awk '{split($0,array,".")} END{print array[1]”.”array[2]”.”array[3]"."1}'`
case $1 in
start)
route add default gw $newgw
route add -net 172.22.20.0 netmask 255.255.254.0 gw 172.22.2.1
route add -net 172.22.12.0 netmask 255.255.254.0 gw 172.22.2.1
route add -net 172.22.4.0 netmask 255.255.254.0 gw 172.22.2.1
route add -net 172.22.16.0 netmask 255.255.254.0 gw 172.22.2.1
;;
stop)
route del default gw $newgw
route del -net 172.22.20.0 netmask 255.255.254.0
route del -net 172.22.12.0 netmask 255.255.254.0
route del -net 172.22.4.0 netmask 255.255.254.0
route del -net 172.22.16.0 netmask 255.255.254.0
route add default gw 172.22.2.1
;;
esac