iptables 在 http 上 DROP 与 REJECT

iptables 在 http 上 DROP 与 REJECT

我正在尝试了解 iptables,今天开始动手实践。我试图为我的 http 服务器设置规则。我最初有接受规则,并且能够成功执行 wget。后来,我将规则更改为 DROP 和 REJECT 以观察工作情况。

这是我注意到的。

我的系统在两种情况下都能够连接到端口 80,并且在两种情况下,如果不执行 wget,我都会收到一条重试消息。DROP 不是应该避免发出任何消息吗?但它们的作用完全相同。我还确保了两条规则都存在,不会发生任何冲突。我觉得我的一些基本知识缺失了。此外,在有 DROP 或 REJECT 的情况下,它如何能够连接到端口 80 上的服务器,但当然不会收到回复?

Chain INPUT (policy ACCEPT) 
target prot opt source destination 
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh 
DROP tcp -- anywhere anywhere tcp dpt:http 
target prot opt source destination 
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh 
REJECT tcp -- anywhere anywhere tcp dpt:http reject-with icmp-port-unreachable

相关内容