找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 7225|回复: 9

macafee帮帮忙,关于Traffic Shaping如何设置?

[复制链接]
发表于 2006-10-5 01:25:32 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
今天终于把Traffic Shaping设置成功,知道如何为每IP设置限速,但方法非常麻烦,想请教一下我的设置是否有问题,或者有哪些更直接的方法?
方法如下:
1、除了两个父queue之外,为每IP都设置两个queue,一个是UP,一个是DOWN,每个queue的Bandwidth设置为10%,Service Curve-》upperlimit的M2中输入这个queue的最大流量。
2、为每IP添加两个RULES,一个UP,一个是DOWN,然后套用相应的QUEUE,完成设置后使用迅雷及BT做测试,发现限速功能有效。

以上是我的设置方法,但发现这样设置非常繁琐,因为要为每IP设置两个QUEUE而且还要为每IP写两个RULES,如果一个网段里有200台机子,那么就要添加800个条目才能完成这实在太累人了,请问版主有没有好的方法实现,或者Traffic Shaping有没有响应的选项简化这些操作,谢谢!
routeros
发表于 2006-10-5 09:31:23 | 显示全部楼层
方法是可取的!但是官方并不推荐这么做!官方有一个PERUSERBW包,不过由于DUMMYNET和PF有一些兼容性BUG,所以该包被延期发布,PF官方目前的消息是该包不会出现在1.0之前的任何版本!如果一定有限速的要求建议你从交换机着手或者另外配置一个MONOWALL专门用于限速!
routeros
回复

使用道具 举报

 楼主| 发表于 2006-10-5 13:45:23 | 显示全部楼层
谢谢你的回复,我现在有个新想法,不使用WEB界面,直接在SHELL中启动PF然后添加相关的PF条目行得通么?其实我对PFSENSE与PF之间的关系还搞不太清楚,因为在SHELL看了一下PFSENSE的设置脚本中,并没有启用PF的东东存在,可能底子不够摸不懂,麻烦版主指点一下!
routeros
回复

使用道具 举报

发表于 2006-10-5 21:14:04 | 显示全部楼层
除非你修正了DUMMYNET的问题!否则通过SHELL也是一样的!
routeros
回复

使用道具 举报

发表于 2006-10-7 10:16:41 | 显示全部楼层
最近有人提出一种方案使用IPFW+DUMMYNET但是要剔除RRD,该方案暂时未被官方采纳,官方只是表态使用该方案可行!
routeros
回复

使用道具 举报

 楼主| 发表于 2006-10-7 13:48:10 | 显示全部楼层
谢谢版主回复!
不知PFSENSE的后续版本会不会在这方面改善一下,如果没有的话只能一个个条目添加了,因为我对IPFW不太熟悉,而且在PFSENSE中启动IPFW会不会产生别的问题?
routeros
回复

使用道具 举报

发表于 2006-10-7 14:05:25 | 显示全部楼层
后续版本肯定会完善限速功能的,等待吧!
routeros
回复

使用道具 举报

发表于 2006-10-8 19:15:32 | 显示全部楼层
以下是老外给出的一个每主机限速样列:

# enable queueing on the external interface to control traffic going to
# the Internet. use the priq scheduler to control only priorities. set
# the bandwidth to 610Kbps to get the best performance out of the TCP
# ACK queue.

altq on fxp0 priq bandwidth 610Kb queue { std_out, ssh_im_out, dns_out, \
   tcp_ack_out }

# define the parameters for the child queues.
# std_out      - the standard queue. any filter rule below that does not
#                explicitly specify a queue will have its traffic added
#                to this queue.
# ssh_im_out   - interactive SSH and various instant message traffic.
# dns_out      - DNS queries.
# tcp_ack_out  - TCP ACK packets with no data payload.

queue std_out     priq(default)
queue ssh_im_out  priority 4 priq(red)
queue dns_out     priority 5
queue tcp_ack_out priority 6

# enable queueing on the internal interface to control traffic coming in
# from the Internet. use the cbq scheduler to control bandwidth. max
# bandwidth is 2Mbps.

altq on dc0 cbq bandwidth 2Mb queue { std_in, ssh_im_in, dns_in, bob_in }

# define the parameters for the child queues.
# std_in      - the standard queue. any filter rule below that does not
#               explicitly specify a queue will have its traffic added
#               to this queue.
# ssh_im_in   - interactive SSH and various instant message traffic.
# dns_in      - DNS replies.
# bob_in      - bandwidth reserved for Bob's workstation. allow him to
#               borrow.

queue std_in    bandwidth 1.6Mb cbq(default)
queue ssh_im_in bandwidth 200Kb priority 4
queue dns_in    bandwidth 120Kb priority 5
queue bob_in    bandwidth 80Kb cbq(borrow)


# ... in the filtering section of pf.conf ...

alice         = "192.168.0.2"
bob           = "192.168.0.3"
charlie       = "192.168.0.4"
local_net     = "192.168.0.0/24"
ssh_ports     = "{ 22 2022 }"
im_ports      = "{ 1863 5190 5222 }"

# filter rules for fxp0 inbound
block in on fxp0 all

# filter rules for fxp0 outbound
block out on fxp0 all
pass  out on fxp0 inet proto tcp from (fxp0) to any flags S/SA \
   keep state queue(std_out, tcp_ack_out)
pass  out on fxp0 inet proto { udp icmp } from (fxp0) to any keep state
pass  out on fxp0 inet proto { tcp udp } from (fxp0) to any port domain \
   keep state queue dns_out
pass  out on fxp0 inet proto tcp from (fxp0) to any port $ssh_ports \
   flags S/SA keep state queue(std_out, ssh_im_out)
pass  out on fxp0 inet proto tcp from (fxp0) to any port $im_ports \
   flags S/SA keep state queue(ssh_im_out, tcp_ack_out)

# filter rules for dc0 inbound
block in on dc0 all
pass  in on dc0 from $local_net

# filter rules for dc0 outbound
block out on dc0 all
pass  out on dc0 from any to $local_net
pass  out on dc0 proto { tcp udp } from any port domain to $local_net \
   queue dns_in
pass  out on dc0 proto tcp from any port $ssh_ports to $local_net \
   queue(std_in, ssh_im_in)
pass  out on dc0 proto tcp from any port $im_ports to $local_net \
   queue ssh_im_in
pass  out on dc0 from any to $bob queue bob_in
routeros
回复

使用道具 举报

发表于 2006-10-9 12:28:23 | 显示全部楼层
官方的pf规则是/tmp/rules.debug
自己重新写一个可以的。
我这350台机器,我按照你的方法试过,会报错,可能队列太多。
routeros
回复

使用道具 举报

 楼主| 发表于 2006-10-10 22:15:55 | 显示全部楼层
原帖由 macafee 于 2006-10-8 19:15 发表
以下是老外给出的一个每主机限速样列:

# enable queueing on the external interface to control traffic going to
# the Internet. use the priq scheduler to control only priorities. set
# the bandwid ...


多谢版主提醒,现在在啃“PF中文文档”中!
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-21 01:40 , Processed in 0.059614 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表