如图:
让R1作为客户机,使r1 可以远程登陆R2
1.配置图上的ip
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip ad 192.168.12.1 24
R2 同上,ip ad 192.168.12.2 24
2.在R2上进入vty虚拟接口0 4 配置身份认证类型为aaa模式,登录协议为ssh
[R2]user-int vty 0 4
[R2-ui-vty0-4]authentication-mode aaa
[R2-ui-vty0-4]protocol inbound ssh
3.进入aaa模式下创建一个用户user,设置3级权限,密码123,允许ssh登录
[R2-ui-vty0-4]aaa
[R2-aaa]local-user user password cipher 123
Info: Add a new user.
[R2-aaa]local-user user privilege level 3
[R2-aaa]local-user user service-type ssh
4。创建密钥对,用于加密传输数据,允许user用户使用任何验证方式,在aaa内开启stelnet服务。
[R2-aaa]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
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]:
Generating keys...
.......................++++++++++++
........++++++++++++
.................++++++++
................++++++++
[R2]user-int vty 0 4
[R2-ui-vty0-4]ssh user user authentication-type all
Authentication type setted, and will be in effect next time.
[R2]user-int vty 0 4
[R2-aaa]stelnet server enable
Info: Succeeded in starting the STELNET server.
在ssh客户端R1上启动第一次连接时的自动配置,指定自己要链接的ip
[R1]ssh client first-time enable
[R1]stelnet 192.168.12.2
Please input the username:user
Trying 192.168.12.2 ...
Press CTRL+K to abort
Connected to 192.168.12.2 ...
Enter password:
<R2>