3、ssh登录(优点可以远程登录配置;密文传输数据,安全性高。缺点验证配置相对复杂)
AAA验证配置(ssh不支持单纯密码验证)
第一步配置密码:(在eNSP中做ssh实验时建议使用交换机)
<huawei>sys
Enter system view, return user view with Ctrl Z.
[huawei]sys LSW2
[LSW2]int vlan 1
Sep 11 2023 11:25:33-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 6, the
change loop count is 0, and the maximum number of records is 4095.
[LSW2-Vlanif1]ip add 192.168.1.1 24 进入接口vlan1配置地址和掩码
[LSW2-Vlanif1]
Sep 11 2023 11:25:44-08:00 LSW2 %IFNET/4/LINK_STATE(l)[0]:The line protocol I
P on the interface Vlanif1 has entered the UP state.
[LSW2-Vlanif1]q
[LSW2]
Sep 11 2023 11:25:53-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 7, the
change loop count is 0, and the maximum number of records is 4095.
[LSW2]info
[LSW2]info
[LSW2]undo info-center enable 关闭信息中心,可以不输入
Info: Information center is disabled.
[LSW2]stelnet server en 打开ssh服务
Info: Succeeded in starting the Stelnet server.
[LSW2]ssh user ceshi au 新建ssh用户名为ceshi
[LSW2]ssh user ceshi auth
[LSW2]ssh user ceshi authentication-type pa
[LSW2]ssh user ceshi authentication-type password 设置用户ceshi的验证方式为密码
Info: Succeeded in adding a new SSH user.
[LSW2]ssh user ceshi ?
assign Set the key
authentication-type Authentication type
authorization-cmd Authorization mode
service-type Set service type
sftp-directory Set SFTP directory
<cr>
[LSW2]ssh user ceshi ser
[LSW2]ssh user ceshi service-type ?
all Set all service type
sftp Set SFTP service type
stelnet Set Stelnet service type
[LSW2]ssh user ceshi service-type stel
[LSW2]ssh user ceshi service-type stelnet 配置ceshi将服务ssh协议华为中ssh=stelnet
[LSW2]aaa
[LSW2-aaa]loca
[LSW2-aaa]local-user ceshi pa 新建本地用户ceshi,这里新建的用户名要与之前ssh中创建的用户名一致
[LSW2-aaa]local-user ceshi password ci
[LSW2-aaa]local-user ceshi password cipher huawei pr
[LSW2-aaa]local-user ceshi password cipher huawei privilege le
[LSW2-aaa]local-user ceshi password cipher huawei privilege level 15
Info: Add a new user.
[LSW2-aaa]local-user ceshi ser
[LSW2-aaa]local-user ceshi service-type ssh 配置新建用户ceshi将服务于那个协议
[LSW2-aaa]q
[LSW2]user-in
[LSW2]user-interface vty 0 4
[LSW2-ui-vty0-4]au
[LSW2-ui-vty0-4]aut
[LSW2-ui-vty0-4]authentication-mode aaa 配置验证方式为aaa验证
[LSW2-ui-vty0-4]pr
[LSW2-ui-vty0-4]protocol inb
[LSW2-ui-vty0-4]protocol inbound ssh 允许通过协议ssh的数据
[LSW2-ui-vty0-4]q
[LSW2]
第二步验证密码:
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl Z.
[Huawei]sys
[Huawei]sysname LSW1
[LSW1]
Sep 11 2023 11:30:03-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 4, the
change loop count is 0, and the maximum number of records is 4095.
[LSW1]undo info-center en 关闭信息中心,可以不用输入
Info: Information center is disabled.
[LSW1]int vlan1
[LSW1-Vlanif1]ip add 192.168.1.2 24 进入vlan1接口下配置地址和掩码
[LSW1-Vlanif1]ping 192.168.1.1 测试数据连通性
PING 192.168.1.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=80 ms
Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=50 ms
Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=40 ms
Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=60 ms
Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/52/80 ms
[LSW1-Vlanif1]q
[LSW1]stel
[LSW1]stelnet ser en 打开ssh协议
Info: Succeeded in starting the Stelnet server.
[LSW1]ssh c
[LSW1]ssh client fi
[LSW1]ssh client first-time en 第一次使用ssh,加载ssh客户端
[LSW1]stelnet 192.168.1.1 使用ssh连接LSW2,华为中ssh=stelnet
Please input the username:ceshi 输入用户名ceshi
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] :y 同意进行链接
Save the server's public key? [Y/N] :y 同意保存公共钥匙
The server's public key will be saved with the name 192.168.1.1. Please wait...
Enter password: 输入密码huawei
Info: The max number of VTY users is 5, and the number
of current VTY users on line is 1.
The current login time is 2023-09-11 11:32:58.
<LSW2>