telnet

Posted by yaohong on Wednesday, November 18, 2020

TOC

Telnet

telnet host post

示例:

[yaohong@host ~]# telnet www.baidu.com 80
Trying 14.215.177.38...
Connected to www.baidu.com.
Escape character is '^]'.

出现Connected to表示连接上主机;

[yaohong@host ~]# telnet www.baidu.com 882
Trying 14.215.177.38...
telnet: connect to address 14.215.177.38: Connection timed out
Trying 14.215.177.39...

没有出现Connected to表示未连接成功。

nc

nc也可用来测试主机+端口的连接;

如:

[yaohong@host ~]# nc www.baidu.com 80
HTTP/1.1 400 Bad Request
Ncat: Broken pipe.

这里HTTP/1.1 400 Bad Request是baidu服务器的返回;

当主机连接不上提示timed out,如:

[yaohong@host ~]# nc www.baidu.com 81
Ncat: Connection timed out.

「点个赞」

Yaohong

点个赞

使用微信扫描二维码完成支付