|
本帖最后由 tyw09 于 2012-3-22 19:15 编辑
########生成网卡#######
# AUTHOR: wsky (), 8162202@gmail.com
# ORGANIZATION:
# CREATED: 2012...03...20... 12...18...39... CST
# REVISION: ---
#===============================================================================- set -o nounset # Treat unset variables as an error
- wan_num=10 #要生成虚拟wan口的数量
- wan_prefix="eth" #wan口前缀
- wan_eth=1 #从eth1开始生成,默认eth1已经被使用了
- mac_prefix="00:12:34:56:78:" #mac地址前缀
- mac_addr=00 #从mac地址最后两位从00开始加1
- for i in $(seq $wan_num);do #循环
- mac_addr=$((mac_addr+1))
- wan_eth=$((wan_eth+1))
- mac=$(printf "$mac_prefix%.2d" $mac_addr)
- eth=$(printf "$wan_prefix%d" $wan_eth)
- ip link add link eth1 $eth type macvlan
- ifconfig $eth hw ether $mac
- ifconfig $eth up
- done
复制代码 #####################
#####负载均衡###############
# AUTHOR: wsky (), 8162202@gmail.com
# ORGANIZATION:
# CREATED: 2012...03...20... 13...29...43... CST
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
pppoe_if=$(ip route show |grep "dev\ pppoe.*proto"|awk '{print $3}')
pppoe_ip=$(ip route show |grep "dev\ pppoe.*proto"|awk '{print $9}')
pppoe_num=$(echo $pppoe_ip|awk '{print NF}')
command="ip route add default scope global nexthop via"
var=
for i in $(seq $pppoe_num);do
s1=$(echo $pppoe_ip|awk '{print $'$i'}')
s2=$(echo $pppoe_if|awk '{print $'$i'}')
s3=
if [ "$i" -ne "$pppoe_num" ];then
s3="nexthop via"
else
s3=""
fi
var="$var $s1 dev $s2 weight 1 $s3"
doneroute del default
command="$command $var"
eval $command
#########################
########使用软件################
修改版pppd:http://www.openwrt.org.cn/bbs/fo ... ead&tid=7527&page=1 谢谢作者
macvlan
还有直接用修改版pppd作者的拨号脚本就行了,改下wan数量,和替换账号密码就行了############### ############### ###############
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
评分
-
查看全部评分
|