一:
/sbin/tc qdisc del dev eth0 root >/dev/null
/sbin/tc qdisc add dev eth0 root handle 10: htb default 2352
/sbin/tc class add dev eth0 parent 10: classid 10:1 htb rate 4000kbps ceil 100000kbps prio 0 burst 50k
i=5
while [ $i -lt 233 ]
do
/sbin/tc class add dev eth0 parent 10:1 classid 10:2$i htb rate 100kbps ceil 120kbps prio 1
/sbin/tc qdisc add dev eth0 parent 10:2$i handle 2$i: sfq perturb 10
/sbin/tc filter add dev eth0 parent 10: protocol ip prio 1 u32 match ip dst 192.168.0.$i flowid 10:2$i
sum=1
i=`expr "$i" "+" "$sum"`
done
二:
/sbin/tc qdisc del dev eth0 root >/dev/null
/sbin/tc qdisc add dev eth0 root handle 10: htb default 2256
/sbin/tc class add dev eth0 parent 10: classid 10:1 htb rate 3000kbps ceil 30000kbps burst 50k
i=1
while [ $i -lt 233 ]
do
/sbin/tc class add dev eth0 parent 10:1 classid 10:2$i htb rate 100kbps ceil 120kbps burst 20k
/sbin/tc qdisc add dev eth0 parent 10:2$i handle 2$i: sfq perturb 10
/sbin/tc filter add dev eth0 parent 10: protocol ip prio 1 handle 2$i fw flowid 10:2$i
/sbin/iptables -t mangle -A PREROUTING -s 192.168.0.$i -j MARK --set-mark 2$i
/sbin/iptables -t mangle -A PREROUTING -s 192.168.0.$i -j RETURN
sum=1
i=`expr "$i" "+" "$sum"`
done
阅读(895) | 评论(0) | 转发(0) |