2017-04-07 44 views
0

我正在使用CentOS 6機器。我試着遵循以下指南:CentOS上的開放端口問題

如果我在目標機器上運行nmap ipofmachine我有這個奇怪的結果。

Host is up (0.0079s latency). 
Not shown: 996 filtered ports 
PORT  STATE SERVICE 
22/tcp open ssh 
80/tcp closed http 
443/tcp closed https 
8080/tcp closed http-proxy 

然而,當我運行sudo iptables -L我有以下的輸出:

Chain INPUT (policy ACCEPT) 
target  prot opt source    destination   
ACCEPT  tcp -- anywhere    anywhere   tcp dpt:webcache 
ACCEPT  tcp -- anywhere    anywhere   tcp dpt:webcache 
ACCEPT  tcp -- anywhere    anywhere   tcp dpt:http 
ACCEPT  all -- anywhere    anywhere   state RELATED,ESTABLISHED 
ACCEPT  icmp -- anywhere    anywhere    
ACCEPT  all -- anywhere    anywhere    
ACCEPT  tcp -- anywhere    anywhere   state NEW tcp dpt:ssh 
ACCEPT  tcp -- anywhere    anywhere   state NEW tcp dpt:http 
ACCEPT  tcp -- anywhere    anywhere   state NEW tcp dpt:https 
ACCEPT  tcp -- anywhere    anywhere   state NEW tcp dpt:webcache 
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   

我缺少的東西?讓我知道你是否需要更多信息(我試圖打開端口8080)。

回答

0

爲了允許特定端口上的連接必須配置CentoOS防火牆:

> sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp 
> sudo firewall-cmd --reload 
  • 你需要如果您使用iptables來配置權限提升使用sudo
0

,將以下規則添加到etc/sysconfig/iptables中

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT 

然後運行以下命令來保存:iptables-restore </etc/sysconfig/iptables