免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: hehao109
打印 上一主题 下一主题

[网络管理] 使用tc的htb进行ftp服务器流量控制问题 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2007-08-23 11:35 |只看该作者
tc -s q s dev eth1

qdisc htb 1: r2q 10 default 0 direct_packets_stat 254
Sent 19004349 bytes 14451 pkts (dropped 0, overlimits 22553 requeues 0)
qdisc sfq 11: parent 1:11 limit 128p quantum 1514b perturb 10sec
Sent 18972756 bytes 14197 pkts (dropped 0, overlimits 0 requeues 0)

=========================================================

tc -s c s dev eth1


class htb 1:11 parent 1:1 leaf 11: prio 0 rate 80Kbit ceil 160Kbit burst 1639b cburst 1679b
Sent 18974880 bytes 14211 pkts (dropped 0, overlimits 0 requeues 0)
rate 58bit
lended: 7837 borrowed: 6374 giants: 0
tokens: 158106 ctokens: 81102

class htb 1:1 root rate 1000Mbit ceil 1000Mbit burst 501375b cburst 501375b
Sent 18974880 bytes 14211 pkts (dropped 0, overlimits 0 requeues 0)
rate 57bit
lended: 6374 borrowed: 0 giants: 0
tokens: 4108 ctokens: 4108

论坛徽章:
0
12 [报告]
发表于 2007-08-23 11:43 |只看该作者
内网1台linux机器,限制内网用户在此台机器上进行ftp下载的速度,数据方向是linux机器-->客户机器的ftp限速
只使用tc+iptables不考虑其他方式

[ 本帖最后由 hehao109 于 2007-8-23 11:44 编辑 ]

论坛徽章:
0
13 [报告]
发表于 2007-08-23 11:49 |只看该作者
两个问题
1、客户机的 IP 是 192.168.1.2 吗?
2、你确定你的 iptables 和 tc 都支持 32bit 的 MARK 值吗?

论坛徽章:
0
14 [报告]
发表于 2007-08-23 12:25 |只看该作者
原帖由 platinum 于 2007-8-23 11:49 发表
两个问题
1、客户机的 IP 是 192.168.1.2 吗?
2、你确定你的 iptables 和 tc 都支持 32bit 的 MARK 值吗?


将防火墙规则改为
iptables -t mangle -I OUTPUT -o eth1 -j MARK --set-mark 0x02
tc规则也改为根据0x02的防火墙标,结果还是跟原来一样

论坛徽章:
0
15 [报告]
发表于 2007-08-23 12:26 |只看该作者
可否贴一下限制时“超速”状态下的 tc -s c s dev eth1 信息?

论坛徽章:
0
16 [报告]
发表于 2007-08-23 12:41 |只看该作者
原帖由 platinum 于 2007-8-23 12:26 发表
可否贴一下限制时“超速”状态下的 tc -s c s dev eth1 信息?


[root@localhost program]$ tc -s c s dev eth1
class htb 1:11 parent 1:1 leaf 11: prio 0 rate 80Kbit ceil 160Kbit burst 1639b cburst 1679b
Sent 2426824 bytes 2241 pkts (dropped 0, overlimits 0 requeues 0)
rate 10723bit 7pps backlog 24p
lended: 1339 borrowed: 878 giants: 0
tokens: -161294 ctokens: -154804

class htb 1:1 root rate 1000Mbit ceil 1000Mbit burst 501375b cburst 501375b
Sent 2390488 bytes 2217 pkts (dropped 0, overlimits 0 requeues 0)
rate 10983bit 8pps
lended: 878 borrowed: 0 giants: 0
tokens: 4084 ctokens: 4084

论坛徽章:
0
17 [报告]
发表于 2007-08-23 12:57 |只看该作者
原帖由 hehao109 于 2007-8-23 12:41 发表
[root@localhost program]$ tc -s c s dev eth1
class htb 1:11 parent 1:1 leaf 11: prio 0 rate 80Kbit ceil 160Kbit burst 1639b cburst 1679b
Sent 2426824 bytes 2241 pkts (dropped 0, overlimits 0 requeues 0)
rate 10723bit 7pps backlog 24p
lended: 1339 borrowed: 878 giants: 0
tokens: -161294 ctokens: -154804

并没有超速啊?完全在你的限制范围之内
只有一种可能,就是 iptables 做 MARK 时没做全,没有把整个数据流完全都打上 MARK 标记,以至于分类限速的流量只是一部分

[ 本帖最后由 platinum 于 2007-8-23 12:58 编辑 ]

论坛徽章:
0
18 [报告]
发表于 2007-08-24 10:38 |只看该作者
有点眉目了,如果服务器用100M网卡就可以,1000M网卡就不能限速,但交换机都是100M的呀,有人遇到这样的问题吗

论坛徽章:
0
19 [报告]
发表于 2007-08-24 12:08 |只看该作者
听 JohnBull 说过,tc 在 2.4 里面告诉带宽下会不准,不知道你的情况是否和这个有关

论坛徽章:
0
20 [报告]
发表于 2007-08-24 14:22 |只看该作者
原帖由 platinum 于 2007-8-24 12:08 发表
听 JohnBull 说过,tc 在 2.4 里面告诉带宽下会不准,不知道你的情况是否和这个有关

那他是如果解决的呢,有文章可以参考下吗
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP