天道酬勤,学无止境

检查

在Linux服务器上检查TCP/UDP端口的连通性

telnet和nc是用来测试端口连通性的一般工具。telnet可以测试tcp端口的连通性。nc可以测试tcp和udp端口的连通性。请确保telnet和nc工具已经安装 # yum install nc # yum install telnet测试tcp端口的连通性:语法:telnet <hostname/IP address> <port number> 如下是连通成功的例子:[root@linux-node01 ~]# telnet 192.168.56.11 22 Trying 192.168.56.11... Connected to 192.168.56.11. Escape character is '^]'. SSH-2.0-OpenSSH_5.3 Connection closed by foreign host.如下是连通不成功的例子:[root@linux-node01 ~]# telnet 192.168.56.12 22 Trying 192.168.56.12... telnet: connect to address 192.168.56.12: No route to host使用nc命令来测试tcp端口的连通性:语法:nc -z -v <hostname/IP address> <port number> 如下是连通成功的例子:[root@linux

2021-06-01 22:20:51    分类:博客    检查   tcp   udp   Linux基础