- 论坛徽章:
- 0
|
网络连接图为
局域网内一台linux的ftp服务器地址为192。168。1。1
测试客户端为192。168。1。2
|---|
| F | |---| |---|
| T | | 交| | 测|
| P |---------| 换|--------| 试|
| 服| | 机| | 机|
| 务| |---| |---|
| 器|
|---|
tc规则如下
tc qdisc add dev eth1 root handle 1: htb
tc class add dev eth1 parent 1: classid 1:1 htb rate 1000Mbit ceil 1000Mbit
tc class add dev eth1 parent 1:1 classid 1:11 htb rate 10kbps ceil 20kbps
tc qdisc add dev eth1 parent 1:11 handle 11: sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 11 handle 0x10000001 fw classid 1:11
防火墙规则如下
iptables -t mangle -I OUTPUT -o eth1 -d 192.168.1.2 -p tcp --sport ! 22 -j MARK --set-mark 0x10000001
其它防火墙规则全都清空了
在测试机上进行ftp下载可以限制流量,但达不到设定的值,大概时150kbs左右,看tc的状态也在工作,不运行tc的速度大概1M左右,不知各位有无遇到这样的情况,希望能指点一下我。
内核2.6.14.7
iptables v1.3.5
tc状态为:
[root@localhost program]$ tc -s -d qdisc ls dev eth1
qdisc htb 1: r2q 10 default 0 direct_packets_stat 48 ver 3.17
Sent 3025983 bytes 2162 pkts (dropped 0, overlimits 3632 requeues 0)
backlog 14p
qdisc sfq 11: parent 1:11 limit 128p quantum 1514b flows 128/1024 perturb 10sec
Sent 3020672 bytes 2114 pkts (dropped 0, overlimits 0 requeues 0)
backlog 14p
[root@localhost program]$ tc -s -d class ls dev eth1
class htb 1:11 parent 1:1 leaf 11: prio 0 quantum 1000 rate 80Kbit ceil 160Kbit burst 1639b/8 mpu 0b overhead 0b cburst 1679b/8 mpu 0b overhead 0b level 0
Sent 3618341 bytes 2516 pkts (dropped 0, overlimits 0 requeues 0)
rate 19966bit 13pps backlog 29p
lended: 1276 borrowed: 1211 giants: 0
tokens: -140769 ctokens: -151056
class htb 1:1 root rate 1000Mbit ceil 1000Mbit burst 501375b/8 mpu 0b overhead 0b cburst 501375b/8 mpu 0b overhead 0b level 7
Sent 3574435 bytes 2487 pkts (dropped 0, overlimits 0 requeues 0)
rate 20058bit 13pps
lended: 1211 borrowed: 0 giants: 0
tokens: 4084 ctokens: 4084
[root@localhost program]$ tc -s -d filter ls dev eth1
filter parent 1: protocol ip pref 11 fw
filter parent 1: protocol ip pref 11 fw handle 0x10000001 classid 1:11
[ 本帖最后由 hehao109 于 2007-8-23 10:21 编辑 ] |
|