免费注册 查看新帖 |

Chinaunix

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

[OpenBSD] PF限速不起作用 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2012-10-29 23:19 |只看该作者
我的一个笔记。对于非p2p很管用。

The router is a computer running FreeBSD.

Natd and ipfw is running.

Kernel is rebuilt with below options:

options IPFIREWALL
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=5
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPDIVERT
options DUMMYNET
options HZ=4000


HZ value depends on your CPU frequency and is set at least 1000.

F<1.5G, HZ=2000. F=1.5G~2G, HZ=4000, F>2G,HZ=5000.

The private network IP is 192.168.0/24

The default gateway IP is 192.168.0.1

The server also is running some services, SMB, DNS etc.

We need limit the internet bindwidth and not the bindwidth of accessing the local services.

This sample is that the uplink bindwidth is 256Kbit/s and downlink bindwidth is 1Mbit/s:

ipfw pipe 1 config bw 256Kbit/s mask src-ip 0x000000ff
ipfw add 4001 pipe 1 ip from 192.168.0.0/24 to not 192.168.0.1 in
ipfw pipe 2 config bw 1Mbit/s mask dst-ip 0x000000ff
ipfw add 4002 pipe 2 ip from not 192.168.0.1 to 192.168.0.0/24 out

论坛徽章:
0
12 [报告]
发表于 2012-10-30 11:29 |只看该作者
回复 10# printerror


    你怎么测试的?说一下
A 同时下载pc1 pc2
B pc1 pc2分别下载
??
which one

论坛徽章:
0
13 [报告]
发表于 2012-10-30 13:02 |只看该作者
A 同时下载,pc1,pc2的速度之和是1.5Mb

论坛徽章:
0
14 [报告]
发表于 2012-10-30 13:03 |只看该作者
panabit也用到dummynet,只不过增加了特征码识别,可以做到针对应用来限速。
我在用freebsd7.4+dummynet的时候就没成功过,不知道为什么。

论坛徽章:
0
15 [报告]
发表于 2012-10-30 13:57 |只看该作者
回复 13# printerror


    再加一个queue 速度1.5M 给pc1或者pc2使用

回答完毕!

论坛徽章:
0
16 [报告]
发表于 2012-10-30 14:02 |只看该作者
不止2个人,二十几台机呢,这2个ip只是测试

论坛徽章:
0
17 [报告]
发表于 2012-10-30 14:08 |只看该作者
本帖最后由 wosl2001 于 2012-10-30 14:08 编辑

回复 16# printerror


    规模 需要 都不明确 都敢干 都要做方案? 服你了!干脆你在交互机层面想想办法吧

论坛徽章:
0
18 [报告]
发表于 2012-10-30 14:16 |只看该作者
挨个建队列写规则吧 这个应该是最简单的

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
19 [报告]
发表于 2012-10-30 14:17 |只看该作者
回复 11# anthie


    限连接数你用过吗?就是limit语句,对p2p有作用,但缺点是它是一个状态规则,网络太大了不行。

论坛徽章:
0
20 [报告]
发表于 2012-10-30 14:48 |只看该作者
现在的问题是限速不起作用
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP