如何测试端口通不通

September 4, 2020

一般情况下使用telnet ip port判断端口通不通,其实测试方法不止这一种,本文主要介绍nc检测工具。

1、使用telnet判断

1)先用telnet连接不存在的端口

[root@localhost ~]# telnet 10.0.250.3 80
Trying 10.0.250.3...
telnet: connect to address 10.0.250.3: Connection refused #直接提示连接被拒绝

2)再连接存在的端口

[root@localhost ~]# telnet localhost 22
Trying ::1...
Connected to localhost. #看到Connected就连接成功了
Escape character is '^]'.
SSH-2.0-OpenSSH_5.3
a
Protocol mismatch.
Connection closed by foreign host.

2、nc命令

1)不存在的端口

[root@localhost] nc -v localhost 8889
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connection refused.

2)存在的端口

[root@localhost] nc -v localhost 8889
Connection to x.x.x.x 8889 port [tcp/http] succeeded!
Linux

IARNO

服务端开发

wrk压测

Centos安装Nodejs