华为交换机关闭Telnet、开启SSH服务命令

SECURECRT登录进去后
< BJDSNW-2F>敲 sys
进入 system view

关闭Telnet
[BJDSNW-2F]undo telnet server enable
[BJDSNW-2F]quit
< BJDSNW-2F>save
The current configuration will be written to the device.

开启ssh
[BJDSNW-2F]

1、创建本地RSA秘钥对
[BJDSNW-2F]rsa local-key-pair create       //产生RSA本地秘钥
The key name will be: BJDSNW-2F_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、配置vty界面支持的登录协议(设置vty 0 4远程登陆的虚拟端口)

VTY是路由器的远程登陆的虚拟端口,0 4表示可以同时打开5个会话,line vty 0 4是进入VTY端口,对VTY端口进行配置,比如说配置密码,或者ACL.

[BJDSNW-2F]user-interface vty 0 4  //进入vty 0 4远程虚拟端口
[BJDSNW-2F-ui-vty0-4]authentication-mode aaa     //验证方式为aaa
Warning: The level of the user-interface(s) will be the default level of AAA users, please check whether it is correct.

[BJDSNW-2F-ui-vty0-4]protocol inbound all  {ssh | all}      //这里选择ssh或者ALL都可以,ssh代表的是只支持ssh登录,all代表也支持其他的登录方式

//必须配置VTY用户界面的验证方式为AAA,不然protocol inbound ssh配置不成功
[BJDSNW-2F-ui-vty0-4]qu

3.
[BJDSNW-2F]ssh user admin     // 创建SSH用户admin
Info: Succeeded in adding a new SSH user.
[BJDSNW-2F]ssh user admin authentication-type password //为admin用户设置ssh认证为password,此命令对设置单一用户设置来说比较实用
[BJDSNW-2F]
[BJDSNW-2F]
[BJDSNW-2F]
[BJDSNW-2F]aaa

[BJDSNW-2F-aaa]local-user admin password   //不想修改原来的telnet密码的话,可以不用设置,该步骤可以省略
Please configure the login password (8-128)
It is recommended that the password consist of at least 2 types of characters, including lowercase letters, uppercase letters, numerals and special characters.
Please enter password:
Please confirm password:
Please enter old password:
Error: The new password is the same as the old password.

[BJDSNW-2F-aaa]local-user admin service-type ssh
Info: After changing the rights (including the password, access type, FTP directory, and level) of a local user, the rights of users already online do not change. The change takes effect to users who go online after the change.

[BJDSNW-2F-aaa]qu
[BJDSNW-2F]
[BJDSNW-2F]
[BJDSNW-2F]

[BJDSNW-2F]ssh user admin service-type stelnet  //为admin用户设置ssh认证服务类型为stelnet

[BJDSNW-2F]stelnet server enable
Info: Succeeded in starting the Stelnet server.
[BJDSNW-2F]quit
< BJDSNW-2F>save

以ssh2方式登录验证 :

display ssh server status

 

感谢作者:Partner2016
原文:https://blog.csdn.net/partner2016/article/details/78686925

您可能还喜欢...