- 论坛徽章:
- 4
|
本帖最后由 3645636 于 2011-01-07 23:09 编辑
[root@IPROUTE ~]# tc qdisc del dev eth0 root
[root@IPROUTE ~]#
[root@IPROUTE ~]#
[root@IPROUTE ~]#
[root@IPROUTE ~]# tc qdisc add dev eth0 root handle 1: htb default 12
[root@IPROUTE ~]# tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps
[root@IPROUTE ~]# tc class add dev eth0 parent 1:1 classid 1:10 htb rate 30kbps ceil 100kbps
[root@IPROUTE ~]# tc class add dev eth0 parent 1:1 classid 1:11 htb rate 10kbps ceil 100kbps
[root@IPROUTE ~]# tc class add dev eth0 parent 1:1 classid 1:12 htb rate 60kbps ceil 100kbps
[root@IPROUTE ~]# tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 \
> match ip src 10.0.0.11 match ip dport 80 0xffff flowid 1:10
[root@IPROUTE ~]# tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 \
> match ip src 10.0.0.11 flowid 1:11
[root@IPROUTE ~]# wget http://10.0.0.1/SafariQuickTimeSetup.exe
--2011-01-03 22:50:50-- http://10.0.0.1/SafariQuickTimeSetup.exe
Connecting to 10.0.0.1:80... 宸茶挎ャ
宸插搴 HTTP 璇锋憋兼?濞绛寰
邋?.. 200 OK
榭搴︼?1993896 (50M) [application/octet-stream]
Saving to: `SafariQuickTimeSetup.exe.2'
0% [ ] 0 --.-K/s ^100%[======================================>] 51,993,896 4.35M/s in 11s
2011-01-03 22:51:02 (4.42 MB/s) - `SafariQuickTimeSetup.exe.2' saved [51993896/51993896]
大家可以看到这个TC HTB的角本,根本不管用啊,这台机器的地址是10.0.0.11 ,限制的流量相差的实在离谱啊!!!!rate 30kbps ceil 100kbps
最大才100K左右,也不至于直接跑到了4MB左右,麻烦大家伙给帮帮忙,是内核不支持HTB吗,我的系统是centos 5.5 ,如果将HTB换成CBQ,即可以控制流量,其它信息
[root@IPROUTE ~]# tc -s -d class show dev eth0
class htb 1:11 parent 1:1 prio 0 quantum 1000 rate 80000bit ceil 800000bit burst 1610b/8 mpu 0b overhead 0b cburst 1700b/8 mpu 0b overhead 0b level 0
Sent 27870 bytes 143 pkt (dropped 0, overlimits 0 requeues 0)
rate 3240bit 2pps backlog 0b 0p requeues 0
lended: 143 borrowed: 0 giants: 0
tokens: 149800 ctokens: 15880
class htb 1:1 root rate 800000bit ceil 800000bit burst 1700b/8 mpu 0b overhead 0b cburst 1700b/8 mpu 0b overhead 0b level 7
Sent 1194951 bytes 17703 pkt (dropped 0, overlimits 0 requeues 0)
rate 3248bit 2pps backlog 0b 0p requeues 0
lended: 12119 borrowed: 0 giants: 0
tokens: 15880 ctokens: 15880
class htb 1:10 parent 1:1 prio 0 quantum 3000 rate 240000bit ceil 800000bit burst 1629b/8 mpu 0b overhead 0b cburst 1700b/8 mpu 0b overhead 0b level 0
Sent 1148545 bytes 17400 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 5293 borrowed: 12107 giants: 0
tokens: 19995 ctokens: 16360
class htb 1:12 parent 1:1 prio 0 quantum 6000 rate 480000bit ceil 800000bit burst 1659b/8 mpu 0b overhead 0b cburst 1700b/8 mpu 0b overhead 0b level 0
Sent 18536 bytes 160 pkt (dropped 0, overlimits 0 requeues 0)
rate 8bit 0pps backlog 0b 0p requeues 0
lended: 148 borrowed: 12 giants: 0
tokens: 27000 ctokens: 16600
# attach ingress policer:
tc qdisc add dev $DEV handle ffff: ingress
# filter *everything* to it (0.0.0.0/0), drop everything that's
# coming in too fast:
tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
root@ubuntu:~# tc qdisc del dev eth0 ingress
root@ubuntu:~# tc qdisc add dev eth0 handle ffff: ingress
root@ubuntu:~# tc filter add dev eth0 parent ffff: protocol ip prio 1 u32 match ip src 10.0.0.11/24 police rate 1000kbit burst 500k drop flowid :ffff
root@ubuntu:~# wget http://10.0.0.1/kav11.0.1.400zh-Hans-CN_0926.exe
--2011-01-07 15:07:50-- http://10.0.0.1/kav11.0.1.400zh-Hans-CN_0926.exe
正在连接 10.0.0.1:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 112041400 (107M) [application/octet-stream]
正在保存至: “kav11.0.1.400zh-Hans-CN_0926.exe.1”
0% [ ] 1,085,076 192K/s ETA 8m 40s |
|