需要有关 iptables 的帮助

Mee*_*p3D 0 iptables centos

我有一台新服务器,但对 iptables 不太确定。我试过打开端口(25565,如下所示),但仍然无法连接。iptables -L 说明如下;

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         
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:25565 
Run Code Online (Sandbox Code Playgroud)

我认为这与拒绝与 icmp-host-prohibited 有关,但我真的不知道这意味着什么。

关闭 iptables 允许访问,因此问题不是正在运行的服务。

提前致谢!

Vit*_*tal 5

接受的规则应该在拒绝一切的规则之前添加到 INPUT 链中。

以下应该工作:

iptables -I INPUT 4 -p tcp --dport 25565 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

如果有效,请清除您的 OUTPUT 链并保存您的 iptables 设置:

iptables -F OUTPUT
/etc/init.d/iptables save
Run Code Online (Sandbox Code Playgroud)