telnet不能用!!!提示:-bash: telnet: command not found

來源:互聯網
上載者:User

標籤:des   style   color   io   os   使用   ar   for   strong   

一.檢查1、[[email protected] ~]# telnet 
bash: telnet: command not found 
2、 查詢了是否安裝Telnet包,結果如下: 
[[email protected] ~]# rpm -qa telnet* 
telnet-server-0.17-47.el6.i686 
3、又查詢了xinetd的狀態: 
[[email protected] ~]# service xinetd status 
xinetd (pid 2967) 正在運行... 
4、使用ntsysv命令,開啟了Telnet服務;同時,也查看 /etc/xinetd.d/telnet 檔案,將將“disable = yes” 改為“disable = no”;也重啟了服務 [[email protected] /]#service xinetd restart 
在系統服務裡面,也查看過,telnet服務和xinetd也都是工作狀態。 
二.安裝服務
解決方式,重裝一下telnet用戶端。 
centos、ubuntu 
yum list telnet* 查看telnet相關的安裝包 
yum install telnet-server 安裝telnet服務 
yum install telnet.* 安裝telnet用戶端
注意,安裝之前要先安裝#yum install xinetd (注意在root下安裝)因為,telnet要依靠xinetd服務啟動,所以要先安裝該服務三.配置telnet 
方法一:使用ntsysv,在出現的視窗之中,將 telnet 勾選起來,然後按下 OK 即可! 
方法二:使用chkconfig命令直接開啟 
#chkconfig telnet on 
方法三:直接修改設定檔 
vi /etc/xinetd.d/telnet 
一般是這樣子的: 
# default: yes 
# description: The telnet server servestelnet sessions; it uses \ 
# unencrypted username/password pairs for authentication. 
service telnet 
{ 
flags = REUSE 
socket_type = stream 
wait = no 
user = root 
server =/usr/sbin/in.telnetd 
log_on_failure += USERID 
disable = yes 
} 
只需要將”disable= yes”改成” disable=no” 
四、啟用服務 
telnet 是掛在 xinetd 底下的,所以自然只要重新啟用 xinetd 就能夠將 xinetd 裡頭的設定重新讀進來,所以剛剛設定的 telnet 自然 
也就可以被啟用。 
  # servicexinetd restart 
或者#/etc/rc.d/init.d/xinetd restart 
五.iptables防火牆會阻止telnet,所以需要在iptables允許,用如下命令 
當你啟動telnet服務後,你可以用netstat –tunlp命令來查看telnet服務所使用的連接埠,可以發現有23。使用下面命令開啟這些連接埠: 
iptables -I INPUT -p tcp --dport 23 -jACCEPT 
iptables -I INPUT -p udp --dport 23 -jACCEPT 
service iptables save //儲存 
service iptables restart //重啟防火牆 
或者來點狠的!!關閉防火牆! 
service iptables stop 
六、可能的問題: 
下面我們來看一下二種錯誤: 
第一種: 
[[email protected] ~]# telnet 192.168.1.87 
Trying 192.168.1.87... 
telnet: connect to address 192.168.1.87: Noroute to host 
telnet: Unable to connect to remote host:No route to host 
解決方案:這種問題防火牆沒有允許telnet服務,串連被阻止,預設CentOS只允許SSH,所以進入其自訂選項,在telnet前打個勾! 
第二種 :
[[email protected] xinetd.d]# telnet 172.25.1.3 
Trying 172.25.1.3... 
Connected to 172.25.1.3 (172.25.1.3). 
Escape character is ‘^]‘. 
getnameinfo: localhost: Success 
Temporary failure in name resolution: Illegal seek 
Connection closed by foreign host. 
這一個就是/etc/hosts檔案配置問題 
解決方案:我在裡面加兩個IP地址,內容如下: 
[[email protected] ~]$ more /etc/hosts 
# Do not remove the following line, orvarious programs 
# that require network functionality willfail. 
127.0.0.1localhost.localdomainlocalhost 
::1localhost6.localdomain6localhost6 
192.168.1.88 
192.168.1.86 
說明:因為客戶機的名字不好記就沒寫進去,內容格式應為127.0.0.1 pcname

telnet不能用!!!提示:-bash: telnet: command not found

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.