日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【实操】配置Telnet与SSH

發布時間:2025/3/20 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【实操】配置Telnet与SSH 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

實驗目的

?

1.?理解Telnet與SSH的運行原理

2.?掌握Telnet與SSH的配置方法

?

實驗拓撲

?

?

實驗需求

?

1、根據實驗拓撲圖,完成設備的基本配置;

2、SW1允許R1通過Telnet遠程管理,VTY密碼為xmws;

3、R2允許R1通過SSH version2遠程管理,用戶名為xmws,密碼為wisdom,域名為xmws.cn。

?

實驗步驟

?

步驟1:設備的基本配置

配置R1

Router>enable

Router#configure terminal

Router(config)#hostname R1

R1(config)#no ip domain-lookup

R1(config)#line console 0

R1(config-line)#exec-timeout 0 0

R1(config-line)#logging synchronous

R1(config-line)#exit

R1(config)#enable password xmws

R1(config)#interface ethernet0/0

R1(config-if)#ip address 192.168.1.254 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#interface ethernet0/1

R1(config-if)#ip address 192.168.12.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#end

R1#

?

配置R2

Router>enable

Router#configure terminal

Router(config)#hostname R2

R2(config)#no ip domain-lookup

R2(config)#line console 0

R2(config-line)#exec-timeout 0 0

R2(config-line)#logging synchronous

R2(config-line)#exit

R2(config)#enable password xmws

R2(config)#interface ethernet0/0

R2(config-if)#ip address 192.168.12.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#end

R2#

?

配置SW1

Switch>enable

Switch#configure terminal

Switch(config)#hostname SW1

SW1(config)#no ip domain-lookup

SW1(config)#line console 0

SW1(config-line)#exec-timeout 0 0

SW1(config-line)#logging synchronous

SW1(config-line)#exit

SW1(config)#enable password xmws ??//必須設置,否則Telnet上SW1后無法進入特權模式

SW1(config)#interface vlan 1

SW1(config-if)#ip address 192.168.1.1 255.255.255.0

SW1(config-if)#no shutdown

SW1(config-if)#exit

SW1(config)#ip default-gateway 192.168.1.254

SW1(config)#end

SW1#

?

步驟2:配置Telnet

配置SW1

SW1>enable

SW1#configure terminal

SW1(config)#line vty 0 4 ??//進入VTY

SW1(config-line)#password xmws ??//設置Telnet登錄的密碼為xmws

SW1(config-line)#login ??//啟用密碼

SW1(config-line)#transport input telnet ??//允許通過Telnet遠程登錄

SW1(config-line)#end

SW1#

?

步驟3:配置SSH

配置R2

R2>enable

R2#configure terminal

R2(config)#username xmws password wisdom ??//創建用戶名和密碼

R2(config)#ip ssh version 2 ??//啟用SSH版本2

R2(config)#ip domain-name xmws.cn ??//定義域名

R2(config)#crypto key generate rsa ??//生成密鑰

The name for the keys will be: R2.xmws.cn

Choose the size of the key modulus in the range of 360 to 4096 for your

??General Purpose Keys. Choosing a key modulus greater than 512 may take

??a few minutes.

How many bits in the modulus [512]:?1024 ??//SSHv2密鑰長度至少768位

% Generating 1024 bit RSA keys, keys will be non-exportable...

[OK] (elapsed time was 0 seconds)

R2(config)#

R2(config)#line vty 0 4

R2(config-line)#login local ??//使用用戶名和密碼驗證

R2(config-line)# transport input ssh ??//允許通過SSH遠程登錄

R2(config-line)#end

R2#

?

實驗檢查

?

步驟1:Telnet測試

  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
R1#telnet 192.168.1.1Trying 192.168.1.1 ... OpenUser Access VerificationPassword:SW1> //成功登錄SW1 注意,如果SW1沒有設置Enable密碼,R1登錄到SW1后輸Enable會出現如下提示:R1#telnet 192.168.1.1Trying 192.168.1.1 ... OpenUser Access VerificationPassword:SW1>enable% No password set 同時按<Ctrl+Shit+6>組合鍵,然后再按x把界面切回R1R1#show sessions //查看R1打開的Telnet會話Conn Host Address Byte Idle Conn Name* 1 192.168.1.1 192.168.1.1 6 5 192.168.1.1R1#resume 1 //重新連接到SW1[Resuming connection 1 to 192.168.1.1 ... ]SW1>

?

步驟2:檢查Telnet

  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
  • ?
SW1#show users //SW1上查看誰登錄到自己Line User Host(s) Idle Location* 0 con 0 idle 00:00:00 2 vty 0 idle 00:02:47 192.168.1.254 Interface User Mode Idle Peer AddressLocation表示是誰登錄到自己,192.168.1.254是R1。SW1#clear line 2 //清除R1的Telnet連接[confirm] [OK]SW1#show users Line User Host(s) Idle Location* 0 con 0 idle 00:00:00 Interface User Mode Idle Peer AddressR1已經被清除。

?

步驟3:SSH測試

R1#ssh -l xmws 192.168.12.2

Password:

R2>enable

Password:

R2# ??//成功登錄到R2

?

步驟4:檢查SSH

  • ?
  • ?
  • ?
  • ?
R2#show ssh Connection Version Mode Encryption Hmac State Username0 1.99 IN aes128-ctr hmac-sha2-256 Session started xmws0 1.99 OUT aes128-ctr hmac-sha2-256 Session started xmws

總結

以上是生活随笔為你收集整理的【实操】配置Telnet与SSH的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。