无法在 Cent OS 7 上打开端口

无法在 Cent OS 7 上打开端口

我的应用程序中出现此错误:

Call From master/192.168.X.X to localhost:11111 failed on connection exception: java.net.ConnectException: Connection refused

ssh 确实失败了:

[user@master API_test]$ ssh localhost -p 11111
ssh: connect to host localhost port 11111: Connection refused

然后我在防火墙中打开它:

[user@master test]$ sudo iptables -L
.......
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:11111 ctstate NEW

但 nmap 仍然没有显示该端口已打开:

[user@master API_test]$ nmap master

Starting Nmap 6.40 ( http://nmap.org ) at 2018-01-19 06:00 PST
Nmap scan report for master (192.168.X.X)
Host is up (0.00049s latency).
Not shown: 998 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
111/tcp open  rpcbind

Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds

我怎样才能解决这个问题?

答案1

您正在尝试连接端口11111,但是您已111111在 iptables 中打开。

11111 != 111111

修复 iptables 以打开正确的端口。

相关内容