为什么 iptables 中所有目标的 ACCEPT all 不允许端口 8445?

Joe*_*elG 3 linux redhat iptables linux-networking

我有一个测试服务器,它具有以下 IPtables 配置:

[root@rhel64 /]# iptables --list
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            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)

当我尝试访问侦听端口 8445 的应用程序时,它被拒绝。一旦我添加了一条规则专门允许 8445 的 tcp 流量,那么我就可以访问它。我的问题是,如果我有规则“接受所有 - 任何地方”,为什么上述配置默认不允许端口 8445?

Mic*_*ton 5

由于iptables -L/--list命令长期存在的设计缺陷。除非使用-v/--verbose选项,否则不会显示完整的防火墙规则。执行此操作后,您将看到该规则接受lo接口上的所有流量!