- 论坛徽章:
- 0
|
HTB
tc qdisc del dev eth0 root
tc qdisc del dev eth0 ingress
tc qdisc add dev eth0 root handle 200: htb default 2
tc class add dev eth0 parent 200:0 classid 200:1 htb rate 6mbit burst 15k
tc class add dev eth0 parent 200:1 classid 200:2 htb rate 600Kbit burst 3k
tc qdisc add dev eth0 parent 200:2 sfq perturb 15
tc filter add dev eth0 parent 200: protocol ip prio 16 u32 match ip dst 192.168.1.99 \
flowid 200:2
tc qdisc add dev eth0 handle ffff: ingress
tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 match ip src 192.168.1.99 \
police rate 600kbit burst 1k drop flowid :1
CBQ:
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 200: cbq bandwidth 10Mbit avpkt 1000
tc class add dev eth0 parent 200:0 classid 200:1 cbq bandwidth 10Mbit rate 40000Kbit \
allot 1514 weight 200Kbit prio 8 maxburst 8 avpkt 1000 bounded
tc class add dev eth0 parent 200:1 classid 200:2 cbq bandwidth 10Mbit rate 600Kbit \
allot 1513 weight 60Kbit prio 5 maxburst 8 avpkt 1000 bounded
tc qdisc add dev eth0 parent 200:2 sfq quantum 1514b perturb 15
tc filter add dev eth0 parent 200: protocol ip prio 16 u32 match ip src 192.168.1.99 flowid 200:2
tc filter add dev eth0 parent 200: protocol ip prio 16 u32 match ip dst 192.168.1.99 flowid 200:2
tc qdisc add dev eth0 handle ffff: ingress
tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 match ip src 192.168.1.99 \
police rate 600kbit burst 1k drop flowid :1
实际速度是上传只有266k,下载为340k
这个是基础,留待针对所有的ip做一个动态的添加脚本。 |
|