在Ubuntu系统中,使用telnet测试服务器的步骤如下:
Ctrl + Alt + T 打开。sudo apt update
sudo apt install telnet
telnet --version
telnet <服务器地址> <端口号>
例如,要连接到IP地址为 192.168.1.100 的服务器上的HTTP服务(默认端口80),可以输入:
telnet 192.168.1.100 80
Trying xxx.xxx.xxx.xxx...
Connected to 192.168.1.100.
Escape character is '^]'.
GET / HTTP/1.1
Host: 192.168.1.100
HTTP/1.1 200 OK
Date: Wed, 21 Oct 2020 07:28:00 GMT
Server: Apache/2.4.41 (Ubuntu)
Content-Type: text/html; charset=UTF-8
...
Connection closed by foreign host.
GET /path/to/resource HTTP/1.1
Host: example.com
Custom-Header: Value
然后按回车键发送。
quit 或按下 Ctrl + ] 然后输入 close 来关闭Telnet会话。通过以上步骤,你可以在Ubuntu系统中使用Telnet客户端来测试服务器的连通性和响应情况。