一、配置ssh远程登录
1.拓扑图
2.配置接口IP,保障网络的通信
R1:
<Huawei>sys # 进入系统视图
[Huawei]sysname R1 # 命名
[R1]int g0/0/0 # 进入接口g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.10.10.1 24 # 配置接口IP地址
[R1-GigabitEthernet0/0/0]q
R2:
<Huawei>sys # 进入系统视图
[Huawei]sysname R2 # 命名
[R2]int g0/0/0 # 进入接口g0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.10.10.2 24 # 配置接口IP地址
[R2-GigabitEthernet0/0/0]q # 退出
3.在R1上配置ssh远程登录,认证方式为aaa
[R1]aaa # 配置aaa认证
[R1-aaa]local-user huawei password cipher huawei@123 # 配置用户名密码
Info: Add a new user. # 添加成功
[R1-aaa]local-user huawei pri lev 3 # 设置用户等级
[R1-aaa]local-user huawei service-type ssh # 设置远程登录模式为ssh
[R1-aaa]q # 退出
[R1]stelnet server enable # 开启ssh远程登录服务
Info: Succeeded in starting the STELNET server. # 显示Succeeded为成功
[R1]user-interface vty 0 4 # 配置ssh
[R1-ui-vty0-4]authentication-mode aaa # 设置认证模式为aaa
[R1-ui-vty0-4]protocol in ssh # 开启ssh模式
[R1-ui-vty0-4]q # 退出
[R1]ssh client first-time enable # 首次认证
[R1]rsa local-key-pair create # 生成秘钥
The key name will be: Host
% RSA keys defined for Host already exist.
Confirm to replace them? (y/n)[n]:y # 输入y为yes
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]:1024 # 设置为1024
Generating keys...
...........++++++
.....................++++++
......++++++++
.................................++++++++
4.在R2上测试是否配置成功
[R2]ssh client first-time enable # 首次认证
[R2]stelnet 10.10.10.1 # 登录ssh
显示R1即为成功