华为交换机SSH、Telnet配置手册
华为交换机SSH、Telnet配置手册
一、配置准备
- 连接Console口:使用Console线连接交换机,波特率9600
- 进入系统视图:
<Huawei> system-view [Huawei] sysname SW1 # 修改设备名称 |
二、SSH配置步骤(推荐安全连接)
- 生成RSA密钥对:
[SW1] rsa local-key-pair create # 密钥长度默认2048位,用于加密通信 |
- 配置VTY用户界面:
[SW1] user-interface vty 0 4 [SW1-ui-vty0-4] authentication-mode aaa # 启用AAA认证 [SW1-ui-vty0-4] protocol inbound ssh # 仅允许SSH接入 |
- 创建管理用户:
[SW1] aaa [SW1-aaa] local-user admin password cipher Admin@123 [SW1-aaa] local-user admin privilege level 3 # 权限等级3为最高 [SW1-aaa] local-user admin service-type ssh |
- 启用SSH服务:
[SW1] stelnet server enable # 开启STelnet服务 [SW1] ssh user admin authentication-type password |
三、Telnet配置步骤(不推荐生产环境)
- 基础配置:
[SW1] telnet server enable [SW1] user-interface vty 0 4 [SW1-ui-vty0-4] authentication-mode password [SW1-ui-vty0-4] set authentication password cipher Telnet@123 |
- 可选配置ACL限制:
[SW1] acl 2000 [SW1-acl-basic-2000] rule permit source 192.168.1.100 0 [SW1-ui-vty0-4] acl 2000 inbound # 仅允许指定IP访问 |
四、验证命令
- 查看SSH状态:
display ssh server status display ssh user-information |
- 测试连接:
# 客户端使用命令:ssh admin@交换机IP # Telnet测试:telnet 交换机IP |
五、安全建议
- SSH版本强制:
[SW1] ssh server compatible-ssh1x disable |
- 修改默认端口:
[SW1] ssh server port 2222 |
- 空闲超时设置:
[SW1-ui-vty0-4] idle-timeout 5 # 5分钟无操作自动断开 |