Centos7
telnet的安装及使用
检测是否安装telnet命令
rpm -qa telnet-server
rpm -qa xinetd
安装telnet
yum list |grep telnet
yum -y install telnet-server.x86_64
yum -y install telnet.x86_64
yum list |grep xinetd
yum -y install xinetd.x86_64
将服务加入开机自启动
systemctl enable xinetd.service
systemctl enable telnet.socket
启动服务
systemctl start telnet.socket
systemctl start xinetd
telnet使用
- telnet 网址/IP 端口号
- telnet:通过客户端远程登陆特定的服务器
使用telnet访问百度
[wens@localhost SOCKET]$ telnet www.baidu.com 80
Trying 163.177.151.110...
Connected to www.baidu.com.
Escape character is '^]'.
^] //键入ctrl+]
telnet>
GET /index.html HTTP/1.1
Host: www.baidu.com
按两下回车
一个表示换行,一个为输入一个空行
请求响应
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: no-cache
Connection: Keep-Alive
Content-Length: 14615
Content-Type: text/html
Date: Sun, 13 Jan 2019 06:24:02 GMT
Etag: "5c36c624-3917"
Last-Modified: Thu, 10 Jan 2019 04:12:20 GMT
P3p: CP=" OTI DSP COR IVA OUR IND COM "
Pragma: no-cache
Server: BWS/1.1
Set-Cookie: BAIDUID=25B80A93BF3EA0F12A2C08B9CB1E2A8D:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: BIDUPSID=25B80A93BF3EA0F12A2C08B9CB1E2A8D; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: PSTM=1547360642; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Vary: Accept-Encoding
X-Ua-Compatible: IE=Edge,chrome=1
<!DOCTYPE html><!--STATUS OK-->
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="dns-prefetch" href="//s1.bdstatic.com"/>
<link rel="dns-prefetch" href="//t1.baidu.com"/>
<link rel="dns-prefetch" href="//t2.baidu.com"/>
<link rel="dns-prefetch" href="//t3.baidu.com"/>
<link rel="dns-prefetch" href="//t10.baidu.com"/>
<link rel="dns-prefetch" href="//t11.baidu.com"/>
<link rel="dns-prefetch" href="//t12.baidu.com"/>
<link rel="dns-prefetch" href="//b1.bdstatic.com"/>
<title>百度一下,你就知道</title>
参考总结自网络