华为S5700交换机恢复出厂配置实操:reset saved-configuration - 夜莺博客

华为S5700交换机恢复出厂配置实操:reset saved-configuration

华为S5700系列交换机要恢复出厂配置,最干净的做法是在用户视图下清空保存的配置文件,而不是只删除某几行配置。整个过程分三步:先把现有配置备份出去,再执行 reset saved-configuration 清空下次启动使用的配置文件,最后重启并在恢复后的空配置上重新配置管理网口和默认路由。本文按华为官方文档的流程逐步说明,并补齐恢复后最容易踩坑的部分。

第一步:恢复前先备份配置

<HUAWEI> save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Now saving the current configuration to the slot 0.............
Save the configuration successfully.

<HUAWEI> system-view
[HUAWEI] ssh client first-time enable
[HUAWEI] sftp 10.1.1.1
Please input the username:client001
sftp-client> put vrpcfg.zip

把 vrpcfg.zip 上传到 SFTP 服务器后,交换机上的配置、VLAN、IP 地址就有了可回滚的副本。恢复出厂后管理地址会被清掉,如果没有备份,只能从业务侧重新摸索整个配置。

第二步:清空配置文件

<HUAWEI> reset saved-configuration
Warning: The action will delete the saved configuration in the device.
The configuration will be erased to reconfigure. Continue? [Y/N]:y
Warning: Now clearing the configuration in the device.
Info: Succeeded in clearing the configuration in the device.

该命令清空设备下次启动使用的配置文件并取消其指定关系,设备重启后即按出厂状态运行。之后执行 reboot,当系统询问 Save the current configuration? [Y/N] 时务必选择 N —— 选 Y 会把当前运行配置重新写回启动配置,等于把刚才的清空前功尽弃。

第三步:恢复后重新配置管理口与默认路由

<HUAWEI> system-view
[HUAWEI] interface MEth 0/0/1
[HUAWEI-MEth0/0/1] ip address 10.1.1.2 24
[HUAWEI-MEth0/0/1] quit
[HUAWEI] ip route-static 0.0.0.0 0 10.10.10.10

管理网口(MEth)是恢复后唯一还能配置的带外通道,先把它配上静态地址并写好默认路由,再恢复远程登录方式。之后按原备份重建 VLAN、上联 trunk 和网管配置。

注意事项

  • reset saved-configuration 与 reset factory-configuration 不同:后者会连同业务数据文件一起清除并要求重启,用于彻底复位;前者只清空启动配置。
  • 恢复出厂只能在本地 Console 或仍可登录的会话中操作;一旦执行完成,SSH/Telnet 全部失效。
  • 堆叠环境下按 PNP 按钮(长按 6 秒以上)会复位整机,操作前确认堆叠成员。

Related reading: 华为交换机恢复出厂设置三种方法对比, 华为 NQA 测试实例与 SLA 监控, H3C 与华为命令对比.

原文链接:https://support.huawei.com/enterprise/zh/doc/EDOC1100088143