anthie 发表于 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

wosl2001 发表于 2012-10-30 11:29

回复 10# printerror


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

printerror 发表于 2012-10-30 13:02

A 同时下载,pc1,pc2的速度之和是1.5Mb

ioiioi_cu 发表于 2012-10-30 13:03

panabit也用到dummynet,只不过增加了特征码识别,可以做到针对应用来限速。
我在用freebsd7.4+dummynet的时候就没成功过,不知道为什么。

wosl2001 发表于 2012-10-30 13:57

回复 13# printerror


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

回答完毕!

printerror 发表于 2012-10-30 14:02

不止2个人,二十几台机呢,这2个ip只是测试

wosl2001 发表于 2012-10-30 14:08

本帖最后由 wosl2001 于 2012-10-30 14:08 编辑

回复 16# printerror


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

wosl2001 发表于 2012-10-30 14:16

挨个建队列写规则吧 这个应该是最简单的

lsstarboy 发表于 2012-10-30 14:17

回复 11# anthie


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

printerror 发表于 2012-10-30 14:48

现在的问题是限速不起作用
页: 1 [2] 3
查看完整版本: PF限速不起作用