自己写的一个防火墙脚本,并+了注释。

由 gouf123 在 06-09-2004 18:53 发表:

自己写的一个防火墙脚本,并+了注释。

eth0接外网

eth1接内

我自己写的防火墙,对各个部分都做了解释,希望大家喜欢,并欢迎大家一起交流

编辑/etc/sysctl.conf文件,并确认net.ipv4.ip_forward = 1

#重新设置策略链并删除已有规则

iptables --policy INPUT ACCEPT

iptables --policy OUTPUT ACCEPT

iptables --policy FORWARD ACCEPT

iptables --flush

iptables --flush -t nat

#设置基本的过滤规则,从而拒绝所有的网络流量

iptables --policy INPUT DROP

iptables --policy OUTPUT DROP

iptables --policy FORWARD DROP

#在回送接口允许所有内部网络流量

iptables -A OUTPUT -j ACCEPT -i lo

iptables -A INPUT -j ACCEPT -o lo

#配置向外方向的TCP规则,其中,-state ESTABLISHED,NEW参数指定要检查哪个状态。ESTABLISHED

标志匹配属于已有的TCP连接的封包。NEW标志指定试图创建一条新TCP连接的第一个封包,这条规则指明

属于新建的和已建立的TCP连接的封包将会通过eth0端口想外发送。

iptables -A OUTPUT -j ACCEPT -o eth0 -p tcp -m state --state ESTABLISHED,NEW

#检查到达外部网络接口的封包状态。属于已有TCP连接的封包都允许通过

iptables -A INPUT -i eth0 -p -m state --state ESTABLISHED,RELATED -j ACCEPT

#配置封包从一个端口转发到另一个

iptables -A FORWARD -i eth1 -j ACCEPT

iptables -A FORWARD -j eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

#下面对源地址进行转换

iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to a.b.c.d


由 doocoo 在 06-09-2004 18:59 发表:


你好.能不能帮我写一下.有关于带200台机子的路由上的防火墙呢?

谢谢..还有就是透明代理..加proftpd.+ Samba

E-mail [email protected]


由 Snoopy 在 06-09-2004 19:00 发表:


好,兄弟努力 !


And then in the evening light, when the bars of freedom fall

I watch the two of you in the shadows on the wall

How in the darkness steals some of the choices from my hand

Then will I begin to under


由 doocoo 在 06-09-2004 19:02 发表:


我的想法是用redhat -as3做服务器..做一个透明的代理.带上二百台的机子.加上proftpd.+ .samba.内核是2.6.6//

就是不知道得加上那些模快.和不要那些....还有就是防火墙..


由 Snoopy 在 06-09-2004 19:04 发表:


不是很难,,参考一下精华可以搞定,有具体问题再发贴


And then in the evening light, when the bars of freedom fall

I watch the two of you in the shadows on the wall

How in the darkness steals some of the choices from my hand

Then will I begin to under


由 faint 在 06-09-2004 19:06 发表:


200台机器?用iptables+squid高效的防火墙.


由 doocoo 在 06-09-2004 19:09 发表:


不是的. 用...redhat-as3 .内核是2.6.6..如果精华里找不到.我想过二天去书城...找一些我想要的资料..架成了再做个总结..


由 gouf123 在 06-09-2004 19:11 发表:


朋友,我告诉你。先看论坛的精华帖,有什么不懂的在说。你这样被人怎么帮你,难道去帮你做服务器?


由 doocoo 在 06-09-2004 19:14 发表:


是的.我也是这样想的.对了我找了好多的资料..有关代理的.有一点是不明白的.就是做成了代理.我下面的客户机的网关是192.168.0.19想架成以后.不用再改下面的机子..在代理中写到.代理服务器成了以后.要在下面的IE设置里改..192.168.0.19:3128,


由 gouf123 在 06-09-2004 19:21 发表:


编辑/etc/squid/squid.conf,加以下内容:

httpd_accel_host virtual

httpd_accel

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus