华为交换机常用配置.二.配置SSH连接.

由于telnet缺少安全认证方式,而且传输过程中采用TCP明文传输,容易导致IP地址欺骗等恶意攻击, 所以存在较大的风险。现在众多IT运维人员已经抛弃单纯的telnet管理了。SSH(Secure Shell)是一个网络安全协议,通过对网络数据的加密,使其能在一个不安全的环境里,提供安全的远程登录和其他网络服务。SSH数据加密传输,认证机制更加安全,而且可以替代telnet,现在已经被广泛使用了,特别是近年来等保和分保都对设备远程登录有了比较严格的要求。

由于SSH用户使用Password方式验证,需要在SSH服务器端生成本地RSA密钥,因此生成本地RSA密钥是完完成SSH登录配置的首要操作,如下:

1、创建本地密钥对

[Sw-Core]rsa local-key-pair create
The key name will be: Core-SW_Host
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 = 2048]:
Generating keys...
..+++++
........................++
....++++
...........++

2、检查是否存在SSH user(可跳过),系统提示没有SSH user 存在

[Sw-Core]dis ssh user-information
Info: No SSH user exists.

3、创建SSH user

[Sw-Core]ssh user test \可以直接敲第二行命令
[Sw-Core]ssh user test authentication-type password \认证模式为密码认证
[Sw-Core]ssh user test service-type stelnet \服务类型为stelnet,即SSH

4、创建用户

[Sw-Core]aaa
[Sw-Core-aaa]local-user test password cipher xxx \xxx处为想要设置的密码
Info: Add a new user.
[Sw-Core-aaa]local-user test privilege level 15 \用户level最高到15
[Sw-Core-aaa]local-user test service-type ?
8021x 802.1x user
bind Bind authentication user
ftp FTP user
http Http user
ppp PPP user
ssh SSH user
telnet Telnet user
terminal Terminal user
web Web authentication user
x25-pad X25-pad user
[Sw-Core-aaa]local-user test service-type ssh \开启该用户允许使用SSH访问设备的权限

5、启用SSH(stelnet)服务

[Sw-Core]stelnet server enable
Info: Succeeded in starting the Stelnet server.

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

[Sw-Core]user-interface vty 0 4
[Sw-Core-ui-vty0-4]authentication-mode aaa
[Sw-Core-ui-vty0-4]protocol inbound ssh