Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Master ISP
- isp1_ip="85.143.163.113"
- # Backup ISP
- isp2_ip="91.220.11.1"
- is_set()
- {
- ip="$1"
- gw=`/usr/bin/netstat -rn -4 | /usr/bin/grep 'default' | /usr/bin/awk '{print $2}'`
- test $gw = $ip
- }
- set_gw()
- {
- ip="$1"
- /sbin/route change default $ip
- }
- if /sbin/ping -c 10 -n -q $isp1_ip > /dev/null 2>&1
- then
- is_set $isp1_ip || set_gw $isp1_ip
- else
- is_set $isp2_ip || set_gw $isp2_ip
- fi
Advertisement
Add Comment
Please, Sign In to add comment