看板FreeBSD
标 题Re: ipfw限制out失效?
发信站元智大学风之塔 (Sat Apr 17 08:32:06 2004)
转信站ptt!ctu-reader!ctu-peer!Spring!news.nctu!news.ntu!news.mcu!news.csie.m
※ 引述《[email protected] (Yu-Chuan Wu)》之铭言:
> BSD:Nat+Dhcp+Ipfw+Http
> rl1:对内
> fxp0:对外
> 其他电脑就是透过bsd连出去,那譬如有一台取得的IP是192.168.3.22
> ,那在ipfw的规则如下,可是却只有in那一条生效,out完全无效,之
> 前找过一些答案,譬如 sysctl net.inet.ip.fw.one_pass=0,试了还
> 是无效,我有透过trafshow分析,out的部分是.22那一台直接与外部IP
> 做封包传送,而bsd是对外网卡直接对外作封包传输,如果我管制fxp0
> 是有效,不过这样连Http也被管制到了,可是我只想限制.22那一台,
> 那该如何管制呢?
> 谢谢..
> ipfw -f flush
> # /usr/bin/sockstat
> ipfw add 10 divert natd all from any to any via fxp0
> ipfw add 10 allow ip from any to any via rl1
> ipfw add 3000 allow ip from any to any
> ipfw -f pipe flush
> ipfw add 200 pipe 1 ip from 192.168.3.22 to any via fxp0
> ipfw add 200 pipe 2 ip from any to 192.168.3.22 via fxp0
> ipfw pipe 1 config bw 100Kbit/s queue 10Kbytes
> ipfw pipe 2 config bw 1Mbit/s queue 100Kbytes
ipfw add 20 pass all from 192.168.0.0/16 to 192.168.0.0/24
ipfw add 200 pipe 1 all from 192.168.3.22 to any
ipfw add 201 pipe 2 all from any to 192.168.3.22
--
※ Origin: 元智大学 风之塔 <bbs.yzu.edu.tw>
※ From : bbs.yzu.edu.tw