华为路由器登录:华为交换/路由设备配置SSH登录

首先说一下配置的基本步骤

1、 虚拟终端VTY设置

2、 SSH用户设置

3、 SSH服务器设置

下面具体说一下

无线路由器-网关-dtu
华为交换/路由设备配置SSH登录

 

1、 虚拟终端VTY设置

[huawei]user-interface vty 0 4

[huawei-ui-vty0 4]authentication-mode aaa

#用户认证方式为AAA

[huawei-ui-vty0 4]protocol inbound ssh

#设置VTY只支持SSH协议,自动禁止telnet功能。Inbound后面一共有三个参数 all允许所有协议, ssh只允许ssh协议 ,telnet 只允许telnet协议 可根据情况自己选择。

2、 SSH用户设置

[huawei]aaa

#进入AAA配置模式

[Huawei-aaa] local-user sshuser password cipher 12345 privilege level 15

#创建本地用户sshuser 并设置密码方式为cipher 密码为12345 等级为15。

#password 的参数有simple和cipher 一个是明文,一个是密文

[Huawei-aaa]local-user sshuser service-type ssh

#配置本地用户的服务方式为ssh。

[huawei] ssh user sshuser authentication-type password

#创建SSH用户并配置SSH用户的认证方式为password。

注:先在AAA下创建ssh用户,再在ssh 下创建用户的认证方式。

3、 SSH服务器设置

[Huawei]stelnet server enable

#使能stelnet服务

[Huawei]rsa local-key-pair create

#生成本地RSA或DSA密钥对

到这里SSH登录的配置就已经完成了,上面的配置是最基本最简单的配置,有兴趣的同学可以去华为官网找相关资料仔细研究。

检查配置结果

l 执行display ssh user-information [ username ]命令,在SSH服务器端查看SSH用户信息。如果不指定SSH用户,则可以查看SSH服务器端所有的SSH用户信息。

l 执行display ssh server status命令,查看SSH服务器的全局配置信息。

注:ssh设置完成后,通过其它路由器或者交换机登录时会有以下提示

Error: Failed to verify the server’s public key.

Please run the command “ssh client first-time enable”to enable the first-time access function and try again.

这个时候我们只需要在系统视图下执行ssh client first-time enable,把密钥保存到本地就可以了。

[sw1]ssh client first-time enable