- 论坛徽章:
- 0
|
我的一个笔记。对于非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 |
|