Huawei S5700 Factory Reset: Three Official Methods - 夜莺博客

Huawei S5700 Factory Reset: Three Official Methods

Huawei's official documentation describes three ways to restore S Series campus switches to factory settings: press and hold the PNP button, run the one-click reset factory-configuration command, or clear the saved configuration file and reboot. Each method clears different data, so choosing the right one matters. This guide covers all three with the exact CLI output, what gets deleted, and the configuration you need after the reset.

Before You Start

Log in through the console port whenever possible - Telnet or STelnet sessions are lost when the switch is restored to factory settings. Back up the configuration first:

<HUAWEI> display current-configuration   ! copy output to a local .txt file
<HUAWEI> save
<HUAWEI> system-view
[HUAWEI] ssh client first-time enable
[HUAWEI] sftp 10.1.1.1
sftp-client> put vrpcfg.zip          ! upload config to the backup server

Before deciding which method to use, look at what is actually stored on the device. The dir command lists the file system, and the files you see there are exactly what the three methods treat differently:

<HUAWEI> dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time       FileName
    0  -rw-        5,388  Jun 12 2024 09:41:22   vrpcfg.zip
    1  -rw-      134,082  Mar 02 2024 11:02:14   logfile.log
    2  -rw-        1,024  Jan 08 2024 15:20:03   private-data.txt
    3  -rw-   36,754,112  Jan 08 2024 15:19:48   s5700-li-v200r019c10spc500.cc

<HUAWEI> display startup
  MainBoard:
    Configured startup system software:        flash:/s5700-li-v200r019c10spc500.cc
    Startup system software:                  flash:/s5700-li-v200r019c10spc500.cc
    Next startup system software:             flash:/s5700-li-v200r019c10spc500.cc
    Startup saved-configuration file:         flash:/vrpcfg.zip
    Next startup saved-configuration file:    flash:/vrpcfg.zip

Three artefacts matter: the system software package (.cc or .bin), the saved configuration file (vrpcfg.zip), and the user data files (logfile.log, private-data.txt, certificates, plug-in packages). Every method below is really a different answer to the question "which of these three do I want to keep?"

Method 1: PNP Button

On devices with a PNP button, press and hold it for more than 6 seconds. The device restores factory settings and automatically restarts. No login is required - this is the easiest method for unboxing or repurposing hardware.

The button is labelled PNP and sits next to the console port on supported models; on some chassis it is recessed so that it cannot be pressed by accident, and a small screwdriver or a paper clip is needed. Hold it until the indicator changes - on most S5700/S5720 units the system LED starts blinking quickly and the switch restarts a second or two later. Pressing for less than six seconds does nothing at all, which is why "the button doesn't work" is almost always a stopwatch problem rather than a hardware fault.

What makes this method special is not only that it needs no credentials, but that it works when nothing else does: an unresponsive VRP shell, a lost password, a wrong management IP or a configuration so broken that the CPU is saturated all stop mattering at the physical-button level. That same power is its risk - there is no warning prompt, no confirmation, and no way to cancel once the timer expires. Power the switch down beforehand if you are not certain the device is the one you intend to wipe.

Method 2: One-Click Reset

<HUAWEI> reset factory-configuration
Warning: The command will delete all the configurations and files (except the
startup, patch, module, and license files) from the device. Continue? [Y/N]:y
Warning: The system will reboot after configurations and files are deleted. Continue? [Y/N]:y

This deletes all directories and files except the system software package, patch file, plug-in and license file, then reboots automatically.

Two confirmation prompts appear, and both must be answered y. The command is available in the user view (no system-view needed) and on models that support the reset factory-configuration keyword; older releases and some S1700-class devices do not have it, in which case the CLI falls back to reset saved-configuration. The reboot is automatic and cannot be skipped - the switch restarts the moment the deletion finishes, so a remote session dies with it. This is the method Huawei positions as the "true" factory reset in the CLI, because it produces a device whose flash contents match a new one from the factory apart from the software image itself.

Method 3: Clear the Configuration File

<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
Info: Succeeded in clearing the configuration in the device.

<HUAWEI> reboot
Warning: The configuration has been modified, and it will be saved to the next
startup saved-configuration file flash:/vrpcfg.zip. Continue? [Y/N]:n
System will reboot! Continue?[Y/N]:y

Answer n when asked to save the configuration, otherwise the startup file is rewritten. This method clears only the current configuration and configuration file - data files are kept.

The mechanism is worth understanding because the second prompt is where most resets are silently undone. reset saved-configuration erases flash:/vrpcfg.zip and marks the device as having no startup configuration. During the reboot sequence VRP notices that the running configuration differs from the (now empty) saved configuration and offers to save it back. Saying y recreates the file you just deleted and the switch boots with the old configuration perfectly intact. Saying n leaves the file absent, so the next boot loads default parameters and the device comes up in its initial state.

What Gets Cleared: Methods Compared

Method Login required Cleared Reboot
PNP button No All files except startup, patch, module, license Automatic
reset factory-configuration Yes All files except startup, patch, module, license Automatic
reset saved-configuration + reboot Yes Current configuration and config file only Manual

Check what is stored with display startup, display saved-configuration and display current-configuration before choosing a method.

The table is accurate but it hides the detail that decides real cases. Expanding it by file type:

Stored item PNP button reset factory-configuration reset saved-configuration
Running configuration Erased (device reboots) Erased Erased
flash:/vrpcfg.zip Deleted Deleted Deleted
Log files, private data, certificates Deleted Deleted Kept
Startup software image (.cc/.bin) Kept Kept Kept
Patch file, plug-ins Kept Kept Kept
Licence files Kept Kept Kept
Stack and iStack membership data Cleared Cleared Partly kept in data files

The third method therefore leaves the most traces: the logs and user data files survive, so a switch passed to another team can still contain the previous operator's information. If the goal is a clean handover or a disposal, method 1 or 2 is the correct choice; if the goal is simply to get a broken configuration out of the way while keeping the log history for a post-mortem, method 3 is the one to use.

How to Choose: Decision Guide

Work down this list and stop at the first line that matches your situation:

  1. You cannot log in at all (lost password, hang, no management address). Use the PNP button if the model has one. If it does not, use the BootROM route - clear the console password or delete the configuration file from the BootROM menu, which is the only path that does not need a working VRP session.
  2. You can log in, the device is being handed over or disposed of, and everything must go. Use reset factory-configuration. It is auditable (the command is recorded in the command log until the device wipes it) and leaves a genuinely clean flash.
  3. You can log in but want the logs and data files preserved for an incident investigation. Use reset saved-configuration plus reboot with n at the save prompt.
  4. You are preparing a device for a known target configuration and only want to remove stale settings. reset saved-configuration is sufficient and fastest; the data files are irrelevant to the new deployment.
  5. The switch is in a stack or is managed remotely with no hands on site. Prefer the CLI methods and schedule the work in a maintenance window; a PNP press needs physical access and cannot be undone.

Side-by-Side Risk Comparison

The three methods differ most in how recoverable a mistake is, and in what happens if the session or the power fails mid-way.

  • PNP button - irreversible. There is no confirmation and no rollback. If the wrong unit is pressed, the only recovery is restoring a configuration backup, which you can only do from the console. It also cannot be used at all on models without the button, which removes it from the toolbox for older chassis.
  • reset factory-configuration - irreversible but predictable. Because the reboot is automatic and the deletion is atomic from the operator's point of view, there is no half-finished state to reason about. The failure mode is simply "I wiped a device I wanted to keep", which a configuration backup solves.
  • reset saved-configuration - reversible until the reboot. This is the most forgiving of the three: nothing is lost until the switch actually restarts, so a mistake can be caught by saving the running configuration back (save) before rebooting. The counterweight is the save prompt trap - answering y at reboot re-creates the file and the device boots unchanged.

Method Confusion: What Is Not a Factory Reset

Several neighbouring commands get confused with the three official methods, and using one when you meant another wastes a maintenance window.

  • BootROM "clear password for console user". Removes the console login password only. The configuration, the management address and every service stay exactly as they were, so the switch is still configured - it is a recovery, not a reset.
  • Deleting vrpcfg.zip manually with delete /unreserved flash:/vrpcfg.zip. Produces a result similar to reset saved-configuration on many releases, but it is not supported as a reset procedure, the file may be locked by VRP, and the device can still write the running configuration back at reboot unless the save prompt is answered n.
  • Rebooting without saving. A plain reboot with the running configuration left unsaved returns the device to the last saved configuration - which after an earlier reset may be no configuration at all, or a completely different one. This is neither a factory reset nor a no-op, and it is a classic way to end up in an unexpected state.
  • Removing the stack configuration. On iStack/CSS devices, clearing the stack data changes the way the chassis boot, but leaves each member's configuration in place. Do not use it as a reset shortcut.

Platform and Version Differences

Availability of the three methods varies by model and release:

  • S5700, S5720, S5730, S6720, S6730 (V200R005 and later): all three methods exist; the PNP button is present on most fixed-chassis models but not on all of them.
  • S1700 and entry-level S2700/S3700: no PNP button and no reset factory-configuration on older releases - the CLI method to use is reset saved-configuration followed by reboot.
  • CloudEngine (CE series): the command names differ slightly and the reset procedure deletes different data; check the model's command reference before assuming the campus syntax applies.
  • Stacked devices: the CLI reset must be run on the master, and a reset applied to one member can trigger a stack re-election that changes which device is master after the reboot.

Verifying the Reset Worked

Whatever the method, confirmation is the same three commands. Immediately after the reboot completes and the console shows the initial login prompt, check that the device really is in its default state:

<HUAWEI> display startup
<HUAWEI> display saved-configuration
<HUAWEI> display current-configuration

On a correctly factory-reset device the saved-configuration file reference is either absent or points at a freshly generated file containing only defaults, and display current-configuration returns the manufacturer defaults (VLAN 1, STP enabled, no hostname change). If the old hostname, VLANs or management address are still present, the reset did not take - on the third method, the usual reason is that the reboot save prompt was answered y.

After the Factory Settings Are Restored

<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

! enable STelnet management
[HUAWEI] user-interface vty 0 4
[HUAWEI-ui-vty0-4] authentication-mode aaa
[HUAWEI-ui-vty0-4] protocol inbound ssh
[HUAWEI] stelnet server enable
[HUAWEI] ssh user client002 service-type stelnet
[HUAWEI] aaa
[HUAWEI-aaa] local-user client002 password irreversible-cipher Abcd@1234
[HUAWEI-aaa] local-user client002 service-type ssh

A default switch is not a usable switch: the management interface has no address, there is no route off the management subnet, the default user credentials are publicly known, and every service except the console is in its shipped state. Treat the reset as the first step of a deployment rather than the last, and put the device on an isolated management VLAN until authentication and access control are configured.

Selection Cheat Sheet

  • No access at all, button present → PNP button (6+ seconds).
  • No access, no button → BootROM menu, then rebuild from a backup.
  • Full clean-out for handover or disposal → reset factory-configuration.
  • Keep logs and data files, remove only the configuration → reset saved-configuration + reboot + answer n.
  • Anything remote or scheduled → the CLI methods, never the button.

Related articles: Huawei S5700 factory reset and password recovery (BootROM), 华为交换机恢复出厂设置的三种方法, Huawei S5700 factory reset guide: CLI, BootROM and recovery, and H3C switch factory reset via CLI and BootWare.

原文链接:https://support.huawei.com/enterprise/en/doc/EDOC1100088109