iptables阻止stream量

有人可以请解释为什么IPTABLES阻止这个规则列表中的任何端口:

Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere tcp dpt:mysql ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination 

对我来说,看起来像ACCEPT ALL应该接受所有的stream量,但事实并非如此。

你的iptables应该被看作是每一个链。

  1. 所有stream量都被INPUT链接受。
  2. 所有stream量都可以在OUTPUT链接中使用。
  3. 即使默认策略设置为ACCEPT所有stream量也会在FORWARD链中被拒绝。

总之,您的防火墙允许所有传入和传出的连接。 但是,拒绝将任何数据包转发给其他主机。

一般的规则是遵循你的iptables规则来匹配。 如果没有匹配,则应用默认链策略。

  pkts bytes target prot opt in out source destination 6741 691K ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED 1 84 ACCEPT icmp -- any any anywhere anywhere 0 0 ACCEPT all -- lo any anywhere anywhere 

事实certificate,我认为是允许所有stream量通过只允许回环stream量(即“LO”)左右。