|
|
Shorewall 是一款强大又方便的防火墙配置包,下面是普通用户
(不作为路由,只保护防火墙所在机器)的配置方法,非常简单:
0. aptitude install shorewall-perl
1. cp /usr/share/doc/shorewall-common/examples/one-interface/{interfaces,policy,
rules,zones} /etc/shorewall
2. chmod 600 /etc/shorewall/*,这一步文档没说,只是出于安全强迫症。
3. 修改 /etc/default/shorewall,将 startup=0 改成 startup=1
4. 修改 /etc/shorewall/interfaces,这里默认是 eth0,我这里有两块网卡 eth0 和
eth1,就把 eth0 那行拷贝粘贴再替换 eth0 为 eth1
5. 修改 /etc/shorewall/rules,添加 SSH 访问,我可能偶尔需要这个传文件:
# Allow SSH connection from the internet.
SSH/ACCEPT net $FW
执行 shorewall start,完毕。
在 shorewall start 前后可以从其他机器 ping 自己试验,如果之前
能 ping 通(之前没配置防火墙)之后不能 ping 通,那么就 ok 了。
注意 /etc/init.d/shorewall stop 对应的是 shorewall clear,作用是
把 iptables 规则清空。shorewall stop 则是进入维护模式,参见
man shorewall 的说明。
shorewall show log 最后二十条 netfilter log
shorewall logwatch 即时监视 netfilter 事件
shorewall dump shorewall 运行情况报表
想了解原理的可以参考 http://www.shorewall.net/standalone.htm。 |
|