当试图通过Python连接到端口7077到星火集群时,我得到了Connection refused Error。
从本地计算机(Ubuntu20.04)运行nmap server_ip显示了4个开放端口(80,8080,22,9000)
运行nc -zv server_ip 7077将给出输出:
nc: connect to server_ip port 7077 (tcp) failed: Connection refused然后我将ssh连接到sles服务器(必须连接到虚拟专用网)并运行以下命令:ss -tulw。该命令为端口7077提供此输出:
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 128 *:7077 *:* 如果我正确理解,这意味着端口7077对任何地址都是开放的。为什么我会得到一个Connection refused Error?
VPN连接中没有端口7077的防火墙。
编辑:
来自iptables -L的输出:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:7077
ACCEPT tcp -- anywhere anywhere tcp dpt:7077
Chain FORWARD (policy ACCEPT)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-INGRESS all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
DROP all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (2 references)
target prot opt source destination
ACCEPT tcp -- anywhere another_ip tcp dpt:9870
ACCEPT tcp -- anywhere another_ip tcp dpt:cslistener
ACCEPT tcp -- anywhere another_ip tcp dpt:7077
Chain DOCKER-INGRESS (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http-alt
ACCEPT tcp -- anywhere anywhere state RELATED,ESTABLISHED tcp spt:http-alt
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere state RELATED,ESTABLISHED tcp spt:http
RETURN all -- anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (2 references)
target prot opt source destination
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere 发布于 2020-11-26 15:11:46
看起来,目标计算机中的本地防火墙不允许TCP端口7077上的传入连接。
这应能解决以下问题:
iptables -A INPUT -p tcp --dport 7077 -j ACCEPT根据现有规则,您可能需要使用-I而不是-A:
iptables -I INPUT -p tcp --dport 7077 -j ACCEPThttps://serverfault.com/questions/1044026
复制相似问题