免费注册 查看新帖 |

Chinaunix

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

请教IPFW+NATD问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-16 18:48 |只看该作者 |倒序浏览
按照《利用FreeBSD保护好企业网络安全》讲述做了一个IPFW+NATD的网关
外网网卡:rl0
IP:220.xx.xx.11
别名:220.xx.xx.12
内网网卡:rl1
IP:192.168.0.254
别名:11.xx.x.1
WEB服务器IP为:11.xx.x.2
内网用户可以上外网,现在问题是内网中可以用域名或IP访问WEB,但外网不可以,甚至外网ping都ping不通外网网卡(即:我请朋友在外地ping220.xx.xx.11或12)
以下是IPFW.CONF文件:
#-------------NATD-------------
add 00400 divert natd all from any to any via any
#--------------------------
add 00001 deny log ip from any to any ipoptions rr
add 00002 deny log ip from any to any ipoptions ts
add 00003 deny log ip from any to any ipoptions ssrr
add 00004 deny log ip from any to any ipoptions lsrr
add 00005 deny tcp from any to any in tcpflags syn,fin
#-------------TCP-------------
add 10001 allow tcp from any to 220.xx.xx.12 80 in
add 10002 allow tcp from 220.xx.xx.12 80 to any out
add 10003 allow tcp from any to 11.xx.x.2 80 in
add 10004 allow tcp from 11.xx.x.2 80 to any out
add 10005 allow tcp from 192.168.0.99 to 11.xx.x.2 22 in
add 10006 allow tcp from 192.168.0.0/24 to 11.xx.x.2 20 in
add 10007 allow tcp from 11.xx.x.2 20 to 192.168.0.0/24 out
add 19997 check-state
add 19998 allow tcp from any to any out keep-state setup
add 19999 allow tcp from any to any out
#-------------UDP-------------
add 20001 allow udp from any 53 to me in recv rl0
add 29999 allow udp from any to any out
#-------------ICMP-------------
add 30000 allow icmp from any to any icmptypes 3
add 30001 allow icmp from any to any icmptypes 4
add 30002 allow icmp from any to any icmptypes 8 out
add 30003 allow icmp from any to any icmptypes 0 in
add 30004 allow icmp from any to any icmptypes 11 in
#-------------Lan-------------
# Enable lan user visit the internet
add 40000 allow all from 192.168.0.0/24 to any
add 40001 allow all from any to 192.168.0.0/24

以下是natd.conf文件内容:
redirect_port tcp 11.xx.x.2:80 220.xx.xx.12:80

请高手帮忙指出问题!

[ 本帖最后由 jxxfjun 于 2008-4-16 18:49 编辑 ]

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
2 [报告]
发表于 2008-04-16 23:27 |只看该作者
dd 10001 allow tcp from any to 220.xx.xx.12 80 in
add 10002 allow tcp from 220.xx.xx.12 80 to any out

把这两 句的序号改为300和301。

最好的办法还是把第一句改为15000。

PS:常ipfw -a list看一下,如果经常有规则的包数量为0,那么就可能有问题。
  估计你的规则中应该有不少是常为零的。

论坛徽章:
0
3 [报告]
发表于 2008-04-17 09:04 |只看该作者
原帖由 lsstarboy 于 2008-4-16 23:27 发表

把这两 句的序号改为300和301。

最好的办法还是把第一句改为15000。

PS:常ipfw -a list看一下,如果经常有规则的包数量为0,那么就可能有问题。
  估计你的规则中应该有不少是常为零的。

谢谢你的回复,我照你的办法把第一句改为15000了,但还是不行!而且改了之后原先我在内网环境中可以访问WEB服务器的,现在也变得不行了

[ 本帖最后由 jxxfjun 于 2008-4-17 09:08 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2008-04-18 17:13 |只看该作者
请参考:
http://bbs.chinaunix.net/thread-1079801-1-2.html
也是lsstarboy兄给指点帮助解决的。不过我因为是初学这个,一切从简,IPFW等于是全开放,没你的那么复杂。
等解决之后在这里写一下方案,让更多遇到相关问题的朋友参考参考。

论坛徽章:
0
5 [报告]
发表于 2008-04-19 17:23 |只看该作者
谢谢各位的帮助,已经解决问题了,在后面加了两条:

add 40002 allow ip from 11.xx.x.0/28 to any
add 40003 allow ip from any to 11.xx.xx.0/28
add 40004 allow ip from 220.xx.xx.0/24 to any
add 40005 allow ip from any to 220.xx.xx.0/24
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP