免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2388 | 回复: 4
打印 上一主题 下一主题

[OpenBSD] 参照别人的例子,弄了个pf规则,大家看看中不? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-02 21:57 |只看该作者 |倒序浏览
参照别人的例子,弄了个pf规则,大家看看中不?
-------------------------------------------------------
openbsd4.3 pf 还没用到实际环境
-------------------------------------------------------
1、配置网桥
vi /etc/bridename.bridge0
ass em0 add em1 up
:wq
reboot
2、配置pf
vi /etc/rc.conf
pf=NO 改为 pf=YES
:wq
3、修改pf防火墙规则
vi /etc/pf.conf
# macros
ext_if = "em0"    #  对外网卡 ext_if
int_if = "em1"     #  对内网卡 int_if
#altq

altq on $ext_if cbq bandwidth 100%  queue { default, http,  mail, dns, ftp }
queue   default bandwidth 10% priority 0 cbq(default ecn)
queue   http bandwidth 20% priority 6 { http_vhosts, http_cust1 }
queue    http_vhosts bandwidth 40% cbq(borrow red)
queue    http_cust1 bandwidth 100Kb
queue   mail bandwidth 10% priority 1
queue   dns bandwidth 30% priority 7 cbq(borrow)
queue   ftp bandwidth 20% priority 6 cbq

block return in on $ext_if inet all queue rsets
pass in on $ext_if inet proto tcp from any to any port 80 queue http
pass in out on $ext_if inet proto tcp from any to any port 21 queue ftp
pass in out $ext_if inet proto tcp from any to any port 25 queue mail
pass in out $ext_if inet proto tcp from any to any port 53 queue dns
pass out on $ext_if inet all

altq on $int_if cbq bandwidth 100Mb queue { http,ftp,udp }
queue http bandwidth 300Mb cbq(default)
queue ftp bandwidth 30Mb cbq(red)
queue udp bandwidth 20Mb cbq(red)

pass in quick on $int_if proto tcp from any to 10.32.0.162 keep state queue udp

pass in on $int_if inet from any to any flags S/SA keep state (max 50000, source-track rule, max-src-nodes 30000,max-src-states 10,tcp.established 60,tcp.closing 5)
-------------------------------------------------------------------------------
问题:1、这个规则有问题没,这样能不能很好的利用带宽?
      2、这样的规则当如何改进?
      3、请高手们指点!

论坛徽章:
0
2 [报告]
发表于 2008-10-03 11:41 |只看该作者
经过实践,有很多问题!
还是自己看手册解决的!
有感牛人文章:
重点都没写!让菜鸟们晕头转向!
各位新手,要想学好bsd还得自己看手册!!!!
教训啊!
-----------------------------------
我通过看手册
现在已经上加运行了!

论坛徽章:
0
3 [报告]
发表于 2008-10-03 12:24 |只看该作者
PF 中文手册,很不错

论坛徽章:
0
4 [报告]
发表于 2008-10-03 12:26 |只看该作者
你自己都说是参照!! 别人的东西只供参考用!! 是不是照抄了就不清楚了

论坛徽章:
0
5 [报告]
发表于 2008-10-03 12:41 |只看该作者

回复 #4 cnduly 的帖子

偶光想吃现成的……
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP