LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 592|回复: 0

ip问题

[复制链接]
发表于 2003-10-8 22:35:57 | 显示全部楼层 |阅读模式
以下的xx.xx.xx.xx 是代表动态的IP还是静态的IP呢?
还有x.x.x.x又是代表动态IP还是静态IP呢?我看不懂所以请教一下,知道的请告诉我一下谢谢·

新建/etc/ipfw.conf 文件,在文件里写入以下内容:

add 00400 divert natd ip from any to any via xl0 //natd服务启动设置

add 00001 deny log ip from any to any ipopt rr

add 00002 deny log ip from any to any ipopt ts

add 00003 deny log ip from any to any ipopt ssrr

add 00004 deny log ip from any to any ipopt lsrr

add 00005 deny tcp from any to any in tcpflags syn,fin //这5行是过滤各种扫描包

#######tcp#########

add 10000 allow tcp from xx.xx.xx.xx to x.x.x.x 22 in //向Internet的xx.xx.xx.xx这个IP开放SSH服务。也就是只信任这个IP的SSH登陆。

add 10001 allow tcp from any to x.x.x.x 80 in //向整个Internet开放HTTP服务。

add 10002 allow tcp from any to x.x.x.x 25 in //向整个Internet开放smtp服务。

add 10003 allow tcp from any to x.x.x.x 110 in //向整个Internet开放pop3服务。

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 //这三个组合起来是允许内部网络访问出去,如果想服务器自己不和Internet进行tcp连接出去,可以把19997和19998去掉。(不影响Internet对服务器的访问)

######udp##########

add 20001 allow udp from any 53 to me in recv xl0 //允许其他DNS服务器的信息进入该服务器,因为自己要进行DNS解析嘛~

add 20002 allow udp from any to x.x.x.x 53 in recv xl0 //向整个Internet开放DNS服务。

add 29999 allow udp from any to any out //允许自己的UDP包往外发送。

######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 //允许自己ping别人的服务器。也允许内部网络用router命令进行路由跟踪。

#######lan##########

add 40000 allow all from 192.168.0.0/16 to any

add 40001 allow all from any to 192.168.0.0/16 //允许内部网络访问Internet。






好了,还有natd没设置了,我们再次添加/etc/natd.conf这个文件,其内容如下:



log yes //启动natd的log记录。

redirect_port tcp 192.168.0.2:25 x.x.x.x:25 //把对服务器IP为x.x.x.x的smtp访问转到192.168.0.2的25上去。

redirect_port tcp 192.168.0.2:80 x.x.x.x:80 //把对服务器IP为x.x.x.x的http访问转到192.168.0.2的80上去。

redirect_port tcp 192.168.0.2:110 x.x.x.x:110 //把对服务器IP为x.x.x.x的pop3访问转到192.168.0.2的110上去。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表