Fedora 11
我们以前的IT人员在我们的防火墙上设置了iptable规则,这让我感到困惑,他没有logging任何文件。 我希望有人能够帮助我理解它。
iptables服务显然是在启动时启动的,但/etc/sysconfig/iptables文件没有改动(默认值)。
我在/etc/rc.local发现他正在这样做:
# We have multiple ISP connections on our network. # The following is about 50+ rules to route incoming and outgoing # information. For example, certain internal hosts are specified here # to use ISP A connection while everyone else on the network uses # ISP B connection when access the internet. ip rule add from 99.99.99.99 table Whatever_0 ip rule add from 99.99.99.98 table Whatever_0 ip rule add from 99.99.99.97 table Whatever_0 ip rule add from 99.99.99.96 table Whatever_0 ip rule add from 99.99.99.95 table Whatever_0 ip rule add from 192.168.1.103 table ISB_A ip rule add from 192.168.1.105 table ISB_A ip route add 192.168.0.0/24 dev eth0 table ISB_B # etc...
然后接近文件结尾,在他刚刚宣布的所有ip规则之后,他有这样的:
/root/fw/firewall-rules.fw
他正在执行由fwbuilder自动生成的防火墙规则文件。
一些问题
为什么他在rc.local声明所有这些ip规则,而不是像所有其他规则一样在fwbuilder中声明它们? 任何优点或必要性? 或者,这只是一个组织糟糕的方式来实现防火墙规则?
为什么在执行fwbuilder脚本之前他声明了ip规则? 我会假设fwbuilder脚本的第一件事情是在声明所有新的规则之前摆脱任何现有的规则。 我错了吗? 如果是这样的话,fwbuilder脚本基本上只会删除在rc.local中定义的所有ip规则。 这有意义吗?
为什么他在rc.local启动时执行所有这些东西,而不是仅仅使用iptables-save来将防火墙设置iptables-save在/etc/sysconfig/iptables ,这些将在运行时实现?
您显示的IP规则与iptables不直接相关。 ip命令控制高级路由。 你的系统已经设置了一些分离路由。 iptables命令控制防火墙(netfilter)规则。
iptables-save / iptables-restore并不直接与路由和规则做任何事情。
请参阅“ Linux高级路由和stream量控制HOWTO ”,了解有关可以使用iproute2执行的操作的详细信息。