歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Linux系統管理與維護之-telnet命令

Linux系統管理與維護之-telnet命令

日期:2017/3/2 10:00:54   编辑:關於Linux

功能說明:通過telnet協議與遠程的主機通信或者獲取遠程主機對應端口的信息。與windows下的telnet完成相同的功能。
使用格式:telnet 主機名或者ip地址 端口
舉例:
1. 通過telnet協議登錄到開啟了telnet服務的遠程主機上,使用以下命令:
[root@localhost ~]# telnet 192.168.60.123 23
Trying 192.168.60.123...
Connected to 192.168.60.123 (192.168.60.123).
Escape character is '^]'.
HP-UX host4 B.11.11 U 9000/800 (ta)
login: root
Password:
#當我們輸入用戶名和密碼後就登錄到了“192.168.60.123“服務器,這裡我們直接用”telnet 192.168.60.123“也是可以的,因為telnet默認尋找的就是”23“端口。
[root@localhost ~]# telnet 192.168.60.123 25
Trying 192.168.60.123...
telnet: connect to address 192.168.60.123: Connection refused
#如果出現這個問題,表示這個端口對應的服務沒有開啟,或者端口被屏蔽,無權訪問。
2. 查看某台linux系統的22和80端口是否打開以及分別開啟了什麼服務,使用以下命令:
[root@localhost ~]# telnet 192.168.60.88 22
Trying 192.168.60.21...
Connected to 192.168.60.21 (192.168.60.21).
Escape character is '^]'.
SSH-1.99-OpenSSH_3.9p1
Protocol mismatch.
Connection closed by foreign host.
#從這裡可以看出,在“192.168.60.88“的22端口運行著ssh服務,對應的ssh版本為OpenSSH_3.9p1。
[root@localhost ~]# telnet www.qianshoublog.com 80
Trying 221.130.192.57...
Connected to www.qianshoublog.com(221.130.192.57).
Escape character is '^]'.
get
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>501 Method Not Implemented</title>
</head><body>
<h1>Method Not Implemented</h1>
<p>get to /index.html not supported.<br />
</p>
<hr>
<address>Apache/2.2.4 (Unix) PHP/5.2.3 mod_fastcgi/2.4.2 Resin/3.1.3 Server at www.qianshoublog.com Port 80</address>
</body></html>
Connection closed by foreign host.
#當我們輸入“telnet www.qianshoublog.com 80“之後,如果”www.ixdba.net“對應ip的80端口是開啟的話,會給出歡迎信息,類似與”Escape character is '^]'“,此時我們通過鍵盤輸入”get“命令,將顯示80端口對應的應用服務器類型,例如本例的80端口對應的應用服務為apache與php以及resin的組合。

Copyright © Linux教程網 All Rights Reserved