Chinaunix首页 | 论坛 | 博客
  • 博客访问: 714813
  • 博文数量: 116
  • 博客积分: 7046
  • 博客等级: 少将
  • 技术积分: 1160
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-14 13:47
个人简介

学无止境

文章分类

全部博文(116)

文章存档

2019年(1)

2011年(1)

2009年(6)

2008年(25)

2007年(44)

2006年(39)

我的朋友

分类: LINUX

2007-03-28 16:13:21

#!/bin/bash
ip route replace default equalize nexthop dev ppp0 weight 1 nexthop dev ppp1 weight 1 nexthop dev ppp2 weight 1
LOOP1="7"
while (true)
do
LOOP="0"

if [ "`ifconfig | awk -F"[ :]" '/ppp0/{print $1}'`" = "ppp0" ]; then
LOOP=`expr $LOOP + 1`
fi
if [ "`ifconfig | awk -F"[ :]" '/ppp1/{print $1}'`" = "ppp1" ]; then
LOOP=`expr $LOOP + 2`
fi
if [ "`ifconfig | awk -F"[ :]" '/ppp2/{print $1}'`" = "ppp2" ]; then
LOOP=`expr $LOOP + 4`
fi

if [ $LOOP1 -ne $LOOP]; then
case "$LOOP" in
0) /root/ipt.sh
 ;;
1) ip route replace default via 221.218.168.1
 ;;
2) ip route replace default via 221.218.168.1
 ;;
3) ip route replace default equalize nexthop dev ppp0 weight 1 nexthop dev ppp1 weight 1
 ;;
4) ip route replace default via 221.218.168.1
 ;;
5) ip route replace default equalize nexthop dev ppp0 weight 1 nexthop dev ppp2 weight 1
 ;;
6) ip route replace default equalize nexthop dev ppp1 weight 1 nexthop dev ppp2 weight 1
 ;;
7) ip route replace default equalize nexthop dev ppp0 weight 1 nexthop dev ppp1 weight 1 nexthop dev ppp2 weight 1
 ;;
 
esac
ip route flush cache
fi
LOOP1="$LOOP"
sleep 3

done
阅读(1831) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~