1.使用Telnet访问华为设备
(1)配置telnet登录
真机上需要先启用telnet服务
[AR1]telnet server enable
1 password认证
AR1配置telnet
[AR1]user-interface vty 0 4
[AR1-ui-vty0-4]authentication-mode password
Please configure the login password (maximum length 16):6
[AR1-ui-vty0-4]set authentication password cipher huawei
[AR1-ui-vty0-4]user privilege level 15
AR2 telnet 登录AR1
<AR2>telnet 192.168.1.1
Press CTRL_] to quit telnet mode
Trying 192.168.1.1 ...
Connected to 192.168.1.1 ...
Login authentication
Password:huawei
成功登陆AR1
<AR1>
2 aaa认证
AR1配置telnet
[AR1]user-interface vty 0 4
[AR1-ui-vty0-4]authentication-mode aaa
[AR1-ui-vty0-4]quit
[AR1]aaa
[AR1-aaa]local-user admin password cipher huawei
[AR1-aaa]local-user admin privilege level 15
[AR1-aaa]local-user admin service-type telnet
AR2 telnet 登录AR1
<AR2>telnet 192.168.1.1
Press CTRL_] to quit telnet mode
Trying 192.168.1.1 ...
Connected to 192.168.1.1 ...
Login authentication
Username:admin
Password:huawei
成功登陆AR1
<AR1>
2.使用SSH访问华为设备
(1)服务端配置ssh登录
1创建SSH用户及密码
[AR1]aaa
[AR1-aaa]local-user admin password cipher huawei privilege level 15
[AR1-aaa]local-user admin service-type ssh
[AR1-aaa]quit
2配置ssh用户的认证方式
[AR1]ssh user admin authentication-type password
Authentication type setted, and will be in effect next time
3开启ssh服务
[AR1]stelnet server enable
Info: Succeeded in starting the STELNET server.
查看SSH 服务状态
[AR1]display ssh server status
SSH version :1.99
SSH connection timeout :60 seconds
SSH server key generating interval :0 hours
SSH Authentication retries :3 times
SFTP Server :Disable
Stelnet server :Enable
4生成本地密钥对
[AR1]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...
.........++++++++++++
........................++++++++++++
.................................++++++++
........++++++++
5配置VTY用户界面
[AR1]user-interface vty 0 4
[AR1-ui-vty0-4]authentication-mode aaa
[AR1-ui-vty0-4]protocol inbound ssh
(2)客户端配置ssh登录
首次ssh登录使用如下命令,开启ssh client功能
[AR2]ssh client first-time enable
[AR2]stelnet 192.168.1.1
Please input the username:admin
Trying 192.168.1.1 ...
Press CTRL+K to abort
Connected to 192.168.1.1 ...
The server is not authenticated. Continue to access it? (y/n)[n]:y
Feb 24 2021 21:20:41-08:00 AR2 %%01SSH/4/CONTINUE_KEYEXCHANGE(l)[0]:The server h
ad not been authenticated in the process of exchanging keys. When deciding wheth
er to continue, the user chose Y.
[AR2]
Save the server's public key? (y/n)[n]:y
The server's public key will be saved with the name 192.168.1.1. Please wait...
Feb 24 2021 21:20:46-08:00 AR2 %%01SSH/4/SAVE_PUBLICKEY(l)[1]:When deciding whet
her to save the server's public key 192.168.1.1, the user chose Y.
[AR2]
Enter password:huawei
成功登陆AR1
<AR1>