拓扑图

华为交换机配置SSH远程登陆-编程知识网

 1、配置IP

<Huawei>sys
[Huawei]sys SW1
[SW1]un in en
[SW1]vlan 137
[SW1-vlan137]int e0/0/1
[SW1-Ethernet0/0/1]p l a
[SW1-Ethernet0/0/1]p d v 137
[SW1-Ethernet0/0/1]int vlanif 137
[SW1-Vlanif137]ip addr 192.168.137.10 24
[SW1-Vlanif137]quit

2、开启stelnet权限,这里就是指ssh

[SW1]stelnet server enable 

3、创建ssh用户名为admin

# 创建用户
[SW1]ssh user admin# 认证方式为密码
[SW1]ssh user admin authentication-type password# 服务类型为ssh
[SW1]ssh user admin service-type stelnet 

4、进入aaa模式下配置用户

# 进入aaa模式
[SW1]aaa# 配置密码为 Admin@123
[SW1-aaa]local-user admin password cipher Admin@123# 配置用户权限 15是最高
[SW1-aaa]local-user admin privilege level 15# 允许用户ssh访问权限
[SW1-aaa]local-user admin service-type ssh
[SW1-aaa]quit

5、配置vty界面支持的登录协议

[SW1]user-interface vty 0 4# 认证为aaa
[SW1-ui-vty0-4]authentication-mode aaa# 登陆协议为ssh
[SW1-ui-vty0-4]protocol inbound ssh

6、Xshell 验证登陆

Connecting to 192.168.137.10:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.WARNING! The remote SSH server rejected X11 forwarding request.Info: The max number of VTY users is 5, and the numberof current VTY users on line is 1.The current login time is 2023-01-11 17:20:44.
<SW1>