防火墙拒绝特定入站stream量的目的是什么?

许多常见的防火墙规则包括阻止特定入站stream量的多条线路。 以ipfw为例:

# Fragments $cmd 00420 deny all from any to any frag in via $pif # ACK packets that did not match the dynamic rule table $cmd 00430 deny tcp from any to any established in via $pif 

但最后,通常会阻止任何不符合任何规则的事情:

 # Deny any other inbound traffic, with logging $cmd 00998 deny log all from any to any in via $pif # Deny any other traffic, with logging $cmd 00999 deny log all from any to any 

如果我们阻止所有其他stream量,如何包括第一套规则会带来好处?

我不能和ipfw交谈,但是在iptables这是非常有意义的,因为第一次方块匹配会胜出 ,通常在顶端的明确否定和底层的否决之间有宽松的规则(除非你正在build立一个非常,非常安静的设备!)。

所以,如果你明确地想要排除所有的火星人 ,你需要有像这样的线

 iptables -A INPUT -s 10.0.0.0/8 -j DROP iptables -A INPUT -s 172.16.0.0/12 -j DROP iptables -A INPUT -s 192.168.0.0/16 -j DROP 

在线之前

 iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A INPUT -j DROP 

因为否则的话,ssh的接受线将允许火星人在他们看到毯子DENY之前。

感谢迈克尔汉普顿build立相同的逻辑适用于ipfw规则集。