免费注册 查看新帖 |

Chinaunix

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

[OpenBSD] openbsd做NAT死活不通,救命啊 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-03-14 10:34 |只看该作者 |倒序浏览
本帖最后由 ioerr 于 2011-03-17 16:33 编辑

换装openBSD4.8中:
rc.conf
   pf=YES

sysctl.conf
   net.inet.ip.forwarding=1

pf规则如下:

ext_if="fxp0"  #外网
int_if ="fxp1"  #内网
dmz_if="rl0"    #dmz

#set skip on lo

pass out on $ext_if from 192.168.1.0/24 to any nat-to $ext_if

block all
pass all



死活不通啊。愁死我了
原来配置过4.2和4.5的,以为很容易的事呢,结果被搞定,help,almost crazy!


3.17日补充:
----------
现在是调通了,但是谁能解释下为什么蓝色的规则不通么?

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
2 [报告]
发表于 2011-03-14 13:38 |只看该作者
现在PF的规则搞得有点不适应!

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
3 [报告]
发表于 2011-03-14 13:40 |只看该作者
pass out on $ext_if inet from 192.168.1.0/24 to any nat-to $ext_if

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
4 [报告]
发表于 2011-03-14 13:42 |只看该作者
本帖最后由 congli 于 2011-03-14 13:43 编辑

前两天在4.8上测试的

  1. ext_if = "em1"
  2. int_if = "em0"
  3. lo_if  = "lo0"

  4. pass quick on $lo_if all
  5. pass out on $ext_if inet from $int_if:network to any nat-to $ext_if
  6. pass quick on $int_if all keep state

复制代码

论坛徽章:
0
5 [报告]
发表于 2011-03-14 14:11 |只看该作者
我的  :pass out on $ext_if from 192.168.1.0/24 to any nat-to $ext_if
版主的:pass out on $ext_if inet from 192.168.1.0/24 to any nat-to $ext_if

就查一個inet?

下午開會,有時間我試試去

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
6 [报告]
发表于 2011-03-14 14:28 |只看该作者
应该是block all, 如果是,还得加个quick.
pass out quick on $ext_if inet from 192.168.1.0/24 to any nat-to $ext_if

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
7 [报告]
发表于 2011-03-14 14:53 |只看该作者
按FAQ上,又可以使用match及pass两个.

  1. ext_if = "em1"
  2. int_if = "em0"
  3. lo_if  = "lo0"

  4. pass quick on $lo_if all
  5. pass quick on $int_if all keep state

  6. match out on $ext_if inet from $int_if:network to any nat-to $ext_if
  7. pass out on $ext_if from $ext_if to any
复制代码

论坛徽章:
0
8 [报告]
发表于 2011-03-14 16:01 |只看该作者
这个您加 了没
# nat/rdr
#nat on $ext_if from $stu_if:network to any -> ($ext_if)
nat on $ext_if from $web_if:network to any -> ($ext_if)
nat on $ext_if from $oth_if:network to any -> ($ext_if)
rdr on $ext_if proto tcp from any to any port {80,21,20} -> $web_host

呵呵,致命的一处,貌似

论坛徽章:
0
9 [报告]
发表于 2011-03-14 16:44 |只看该作者
回复 8# myuebbs


    我现在还没通,考虑不了www什么的服务。

论坛徽章:
0
10 [报告]
发表于 2011-03-14 16:54 |只看该作者
回复 6# congli


    初步找到问题了,应该是
pass out quick on $ext_if from $int_if:network to any nat-to $ext_if

加上这个quick就ok了,艹,就这个,差点让我吐血。

我再好好试试,查查手册,然后来个总结,就这么点,真是郁闷,幸好版主帮忙,谢谢了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP