華為交換機配置SSH登錄

2024年2月6日 17点热度 0人点赞

前言

Telnet傳輸過程采用TCP進行明文傳輸,缺少安全認證方式,容易招致DoS等惡意攻擊,存在著較大的安全隱患,因此在實際生產環境中,一般不建議采用此種認證方式。故,本文在這裡介紹華為交換機配置SSH的方法。

步驟

搭建拓撲,並配置IP,保證可以ping通對端。

配置AAA用戶

輸入AAA,進入AAA模式,並在模式中創建用戶名密碼,以及該用戶的適用范圍以及級別。

[r1]aaa
[r1-aaa]local-user test password cipher 123456 #配置用戶名為test,密碼為123456
Info: Add a new user.
[r1-aaa]local-user test privilege level 15 #配置用戶級別為15級(最高級)
[r1-aaa]local-user test service-type ssh telnet #將該用戶用於ssh以及telnet登陸
[r1-aaa]quit

配置SSH用戶認證方式

[r1]ssh user test authentication-type password

開啟ssh服務

[r1]stelnet server enable 
Info: Succeeded in starting the Stelnet server.

創建RSA的key

這裡采用768位

[r1]rsa local-key-pair create 
The key name will be: r1_Host
The range of public key size is (512 ~ 2048). 
NOTES: If the key modulus is greater than 512, 
       it will take a few minutes.
Input the bits in the modulus[default = 512]:768
Generating keys...
..............................................................        
...........        
..........         
.............         

配置VTY通道,允許通過SSH登錄

[r1]user-interface vty 0 4	
[r1-ui-vty0-4]protocol inbound ssh

通過模擬登錄,發現可正常登錄。至此,配置結束