- 论坛徽章:
- 0
|
如果你在安装linux时没有选择启动防火墙,是这样的
# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
什么规则都没有.
首先就要告诉Linux内核把相应的功能模块打开
# echo 1 > /proc/sys/net/ipv4/ip_forward
把/proc/sys/net/ipv4/ip_forward这个文件的内容从0改成了1告诉内核支持ip转发。/proc系统是个虚拟的文件系统,它实际存在于内存,用于显示系统运行状态。
这样在系统重启后,将会被重置,有人说这样可以保存(在/etc/sysct1.conf里添加了下面这一行:net.ipv4.ip_forward = 1 重启后生效了)
保存iptables:
#iptables-save > /etc/network/iptables
在/etc/network/interface里的eth0配置下加入下面这一行,使系统启动时自动转入iptables
up /sbin/iptables-restore iptables
还有这么一段,有待考证
通过 ifup 配置防火墙规则
还可以在网络配置文件 /etc/network/interfaces 中设置防火墙规则. 您需要:
重建网络接口激活时的防火墙规则.
使用 iptables-save 将规则设定保存到 /etc 下, 例如 /etc/iptables.up.rules.
配置 etc/network/interfaces 调用配置的规则设定.
iface eth0 inet static
address x.x.x.x
[.. interface configuration ..]
pre-up iptables-restore iptables.up.rules
您还可以选择设定一些规则应用于网络接口 down 的时候, 将其保存在 /etc/iptables.down.rules 文件中, 然后添加到接口配置文件中:
post-down iptables-restore iptables.down.rules
有关 ifupdown 更多的高级防火墙配置脚本, 可以针对性的放置到 *.d/ 目录, 通过 run-parts (参阅 run-parts(8)) 调用.
整合 iptables 的工具套件
- shorewall
- lokkit DebianWiki介绍说是"是最基础的图形设定工具,提供最简易不用大脑的接口。只需要选择高度安全并选择你将开放的接口(port)即可"。原来就是Redhat安装时缺省所带的防火墙配置软件,用用确实很简单的
http://www.17xie.com/read-46655.html
http://www.cnxhacker.com/Article/safe/subject/200612/7290.html
http://biz.chinabyte.com/17/2048517.shtml
一个网友写的脚本
http://www.mamiyami.com/neo-diary/2007/10/26/firewall-qos.sh
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/57287/showart_2156543.html |
|