所以是要经过CPU的
在Linux下telnet和nc这两个命令都是是用来测试端口连通性。其中telnet可以测试tcp端口的连通性。nc可以测试tcp和udp端口的连通性。
具体使用方法如下:
1、确保linux机器上已经安装了nc或者telnet命令,如果没有通过yum安装# yum install nc
# yum install telnet 2、telnet命令的使用:
语法:telnet <hostname/IP address> <port number>
例子:
测试通过则会显示下面的文字:
# telnet 192.118.20.95 22Trying 192.118.20.95...
Connected to 192.118.20.95.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1
Protocol mismatch.
Connection closed by foreign host.
测试不通过:
# telnet 192.118.20.95 22Trying 192.118.20.95...
telnet: connect to address 192.118.20.95: No route to host 3、nc测试TCP端口的连通性
语法:nc -z -v <hostname/IP address> <port number>
测试通过:
# nc -z -v 192.118.20.95 22Connection to 192.118.20.95 22 port [tcp/ssh] succeeded!
测试不通过:
# nc -z -v 192.118.20.95 22nc: connect to 192.118.20.95 port 22 (tcp) failed: No route to host 4、nc测试UDP端口的连通性
语法:nc -z -v -u <hostname/IP address> <port number>
测试通过:
# nc -z -v -u 192.118.20.95 123Connection to 192.118.20.95 123 port [udp/ntp] succeeded!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)