iptables 阻塞流量

DD.*_*DD. 2 iptables

有人可以解释为什么 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
Run Code Online (Sandbox Code Playgroud)

在我看来, ACCEPT ALL 线应该接受所有流量,但事实并非如此。

Kha*_*led 6

应该为每个链查看您的 iptables。

  1. INPUT链中接受所有流量。
  2. OUTPUT链中接受所有流量。
  3. FORWARD即使默认策略设置为 ,所有流量也会被链式拒绝ACCEPT

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

一般规则是按照您的 iptables 规则进行匹配。如果没有匹配,则应用默认链策略。