文章目錄
SSH認證配置
SSH:安全的遠程控制協議,端口 TCP 22 號端口
特點:傳輸的數據時加密的,Linux服務器也很常用
R1——設置IP地址,測試是否可以跟本機ping通
<Huawei>system-view //進入全局配置模式
[Huawei]undo info-center enable //關閉信息告警提示
[Huawei]sysname R1 //改名
[R1]interface g0/0/0 //進入接口
[R1-GigabitEthernet0/0/0]ip address 192.168.199.200 24 //設置IP地址
[R1-GigabitEthernet0/0/0]quit //退出
[R1]ping 192.168.199.223 //測試是否可以ping通
PING 192.168.199.223: 56 data bytes, press CTRL_C to break
Reply from 192.168.199.223: bytes=56 Sequence=1 ttl=64 time=20 ms
Reply from 192.168.199.223: bytes=56 Sequence=2 ttl=64 time=20 ms
Reply from 192.168.199.223: bytes=56 Sequence=3 ttl=64 time=10 ms
Reply from 192.168.199.223: bytes=56 Sequence=4 ttl=64 time=10 ms
Reply from 192.168.199.223: bytes=56 Sequence=5 ttl=64 time=10 ms //ping通
--- 192.168.199.223 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/14/20 ms
[R1]
R1——設置AAA認證模式
[R1]aaa //進入AAA認證模式
[R1-aaa]local-user admin password cipher admin@123 //設置用戶名和密碼
[R1-aaa]local-user admin privilege level 3 //設置用戶權限登記
[R1-aaa]local-user admin service-type ssh //設置用戶登錄方式
[R1-aaa]quit //退出
[R1]
R1——配置虛擬用戶,使用SSH登錄
[R1]user-interface vty 0 4 //配置虛擬用戶
[R1-ui-vty0-4]authentication-mode aaa //設置用戶認證模式爲AAA認證
[R1-ui-vty0-4]protocol inbound ssh //設置登錄用戶接入模式爲SSH
[R1-ui-vty0-4]quit //退出
[R1]
R1——開啓SSH服務
[R1]stelnet server enable //開啓SSH服務
使用SecureCRT連接路由器
路由器當SHH客戶端登錄路由器
R2——設置接口的IP地址
<Huawei>system-view //進入全局配置模式
[Huawei]undo info-center enable //關閉信息告警提示
[Huawei]sysname R2 //改名
[R2]interface g0/0/0 //進入接口
[R2-GigabitEthernet0/0/0]ip address 192.168.199.201 24 //設置IP地址
[R2-GigabitEthernet0/0/0]quit //退出
[R2]
R2——使用SSH遠程登錄R1設備
[R2]ssh client first-time enable //SHH客戶端首次啓用(首次登陸)
[R2]stelnet 192.168.199.200 //SHH連接R1設備
Please input the username:admin //輸入用戶名
Trying 192.168.199.200 ...
Press CTRL+K to abort
Connected to 192.168.199.200 ...
The server is not authenticated. Continue to access it? (y/n)[n]:y //輸入y
Save the server's public key? (y/n)[n]:y //輸入y
The server's public key will be saved with the name 192.168.199.200. Please wait
...
Enter password: //輸入密碼
-----------------------------------------------------------------------------
User last login information:
-----------------------------------------------------------------------------
Access Type: SSH
IP-Address : 192.168.199.223 ssh
Time : 2020-05-15 15:54:02-08:00
-----------------------------------------------------------------------------
<R1> //成功登錄R1設備