linux下用TC命令控制带宽参见
tc qdisc del dev eth2 root 2>/dev/null
tc qdisc add dev eth2 root handle 1: htb default 13
tc class add dev eth2 parent 1: classid 1:1 htb rate 2684kbit prio 0
tc class add dev eth2 parent 1:1 classid 1:2 htb rate 1610kbit ceil 1610kbit prio 0
#说明10,11,12共享1610kbit的带宽.
#192.168.19.9
tc class add dev eth2 parent 1:2 classid 1:10 htb rate 1074kbit ceil 1074kbit prio 2
tc qdisc add dev eth2 parent 1:10 handle 10: sfq perturb 10
#192.168.39.9
tc class add dev eth2 parent 1:2 classid 1:11 htb rate 268kbit ceil 500kbit prio 2
tc qdisc add dev eth2 parent 1:11 handle 11: sfq perturb 10
#192.168.59.9
tc class add dev eth2 parent 1:2 classid 1:12 htb rate 268kbit ceil 500kbit prio 2
tc qdisc add dev eth2 parent 1:12 handle 12: sfq perturb 10
#other
tc class add dev eth2 parent 1:1 classid 1:13 htb rate 1074kbit ceil 1074kbit prio 1
tc qdisc add dev eth2 parent 1:13 handle 13: sfq perturb 10
tc filter add dev eth2 parent 1:0 protocol ip prio 1 u32 match ip src 192.168.19.9/32 flowid 1:10
tc filter add dev eth2 parent 1:0 protocol ip prio 1 u32 match ip src 192.168.39.9/32 flowid 1:11
tc filter add dev eth2 parent 1:0 protocol ip prio 1 u32 match ip src 192.168.59.9/32 flowid 1:
阅读(1928) | 评论(0) | 转发(1) |