Restoring the Factory Settings of S5700 Series Switches

This document describes how to restore factory settings.

Restoring the Factory Settings of S5700 Switches

Restoring the Factory Settings of S5700 Switches

Overview

In some scenarios, you often need to restore the factory settings of a switch. For example, to delete a large number of useless configurations or move a switch from a network to another network, you can restore the factory settings of the switch and reconfigure the switch.

Prerequisites

The following example describes how to restore the factory settings of S5700 series switches running V200R019C10. The operations to be performed may vary depending on the device model and version. For details, see the corresponding product documentation.

This document is written based on device information obtained under lab conditions. If your device is running on the live network, ensure that you understand the potential impact of all commands.

Before You Start

Logging In to the Switch

When restoring factory settings, you are advised to log in to the switch through the console port. For details, see Example for Configuring Switch Login Through a Console Port. If you log in to the switch through Telnet or STelnet, your connection with the switch will be lost after the switch is restored to factory settings. In this case, to restore the connection with the switch, you can log in to the switch only through the console port.

If you log in to the switch through the console port, the password for logging in to the switch through the console port is restored to the initial password after the switch is restored to factory settings. To obtain the initial user name and password for logging in to the switch through the console port, see S Series Switches Default Usernames and Passwords.

Backing Up the Configuration File

Once the factory settings are restored, the current configurations are deleted. To prevent unexpected situations after factory settings are restored, you are advised to back up the configuration file before restoring factory settings. This operation ensures that the device can be returned to the previous state at any time. There are two similar methods for backing up the current configurations of the switch. The first method is relatively simple.

  • Copy configurations on the screen to a local text file.

    Run the display current-configuration command in the CLI and copy all the command output to a .txt file on a maintenance terminal. The current configurations are then saved to the hard disk of the maintenance terminal.

    If the configuration of a specific command is too long, the configuration may be displayed in multiple lines on the terminal screen, depending on the terminal software. When copying a multi-line configuration from the screen to a .txt file, ensure that the configuration occupies only one line in the .txt file. Otherwise, configuration restoration fails when the .txt file is used. To conveniently copy all displayed information, you are advised to run the screen-length 0 temporary command in the user view to disable the multi-screen display function of the current terminal screen. Then, if more than one screen of information exists, the system does not pause automatically.

  • Back up the configuration file through File Transfer Protocol (FTP), Trivial File Transfer Protocol (TFTP), File Transfer Protocol over Secure Sockets Layer (FTPS), Secure File Transfer Protocol (SFTP), or Secure Copy Protocol (SCP).
    Configuration file backup through FTP or TFTP is simple but introduces security risks. In scenarios with high security requirements, FTPS, SFTP, and SCP are recommended for configuration file backup. The following example describes the configuration file backup process using SFTP. For details about other configuration file backup methods, see File Management.
    <HUAWEI> save  //Save the current configurations to the default storage directory.
    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  //Enable authentication upon the first login of the SSH client.
    [HUAWEI] sftp 10.1.1.1   //Enable the SFTP client to connect to the SSH server through password authentication. Assume that the IP address of the SFTP server is 10.1.1.1/24.
    Please input the username:client001                                                                                                     
    Trying 10.1.1.1 ...                                                                                                            
    Press CTRL+K to abort                                                                                                               
    Connected to 10.1.1.1 ...                                                                                                      
    Enter password:                                                                                                                     
    
    sftp-client>put vrpcfg.zip  //Upload the local configuration file to the remote SFTP server.
    Remote file: /vrpcfg.zip --->  Local file: vrpcfg.zip                                                                               
    |                                                                                                                                   
    Info: Downloading file successfully ended.                                                                                          
    SFTP: 2872 byte(s) received in 0.119 second(s) 23.56Kbyte(s)/sec.                                                                   

Restoring the Factory Settings

This document provides three methods for restoring factory settings: press and hold the PNP button to restore factory settings, restore factory settings with one click, and clear the configuration file to restore factory settings.

The differences between the three methods are as follows:

  • Whether factory settings are restored by using commands or pressing a specific button

    Pressing and holding the PNP button to restore factory settings does not require a login to the switch and is easy to operate.

  • What will be cleared after factory settings are restored

    When you press and hold the PNP button or restore factory settings with one click, all directories and files except the system software package, patch file, plug-in, and license file for the next startup as well as factory settings are deleted.

    If you clear the configuration file to restore factory settings, only the current configurations and configuration file of the switch are cleared.

    For ease of understanding, the following describes the factory settings, configuration file, and current configurations.

    Item

    Description

    How to View

    Factory settings

    Factory settings are basic configurations provided for a new device. This type of configurations enables a device to start and operate correctly when there is no configuration file, or when the configuration file is lost or damaged.

    Check the configurations in the $_default.cfg file in the protected directory.

    Configuration file

    When a device is powered on, it reads the configuration file from the default storage directory to initialize the system. Therefore, the configurations in the configuration file are called initial configurations.

    • Run the display startup command to check the current and next startup configuration files. For details about the command output, see display startup.

    • Run the display saved-configuration command to check the next startup configuration file. For details about the command output, see display saved-configuration.

    Current configurations

    The configurations that are in effect during device operation are current configurations. To use modified configurations as the next startup configurations, run the save command to save them to the default storage medium.

    Run the display current-configuration command to check the current configurations of the device.

Pressing and Holding the PNP Button to Restore Factory Settings

For a device that has the PNP button, you can press and hold the PNP button for more than 6 seconds to restore the device to factory settings and restart the device. The following figure shows the PNP button.

Figure 1-1 PNP button

Restoring Factory Settings with One Click

  1. Run the reset factory-configuration command in the user view.
    <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  //If you enter y, all configuration and data files on the device are cleared.                                                                                             
    Warning: The system will reboot after configurations and files are deleted. Continue? [Y/N]:y  //If you enter y, the device automatically restarts.

Clearing the Configuration File to Restore Factory Settings

  1. Run the reset saved-configuration command in the user view.
    <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  //If you enter y, the saved configurations on the device are cleared.
    Warning: Now clearing the configuration in the device.                          
    Info: Succeeded in clearing the configuration in the device. 
  2. Run the reboot command in the user view to restart the device.
    <HUAWEI> reboot
    Info: The system is now comparing the configuration, please wait.................                                                   
    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  //If you enter n, the configuration file is not saved.
    Info: If want to reboot with saving diagnostic information, input 'N' and then execute 'reboot save diagnostic-information'.        
    System will reboot! Continue?[Y/N]:y  //If you enter y, the device restarts.

After the Factory Settings Are Restored

After the switch is restored to factory settings, you can log in to the switch through the console port to perform basic configurations.

# Configure an IP address for the Ethernet management port of the switch. The following assumes that the IP address of the Ethernet management port is 10.1.1.2/24.
<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

If a switch does not have an Ethernet management port, configure a management IP address for a VLANIF interface. For details, see Configuring an IP Address for a Management Interface on the S5700.

# Configure a default route on the switch. The following assumes that the gateway address of the switch is 10.10.10.10.
[HUAWEI] ip route-static 0.0.0.0 0 10.10.10.10

# Configure CLI-based device login. The following uses STelnet as an example to describe how to log in to the CLI. For details about other login modes, see CLI Login Configuration.

[HUAWEI] user-interface vty 0 4
[HUAWEI-ui-vty0-4] authentication-mode aaa  //Set the authentication mode on VTY interfaces to AAA authentication.
[HUAWEI-ui-vty0-4] protocol inbound ssh     //Set the protocol supported on VTY interfaces.
[HUAWEI-ui-vty0-4] user privilege level 15  //Set the privilege level of VTY interfaces to 15.
[HUAWEI-ui-vty0-4] quit
[HUAWEI] stelnet server enable //Enable the STelnet server function.
[HUAWEI] ssh user client002    //Create an SSH user.
[HUAWEI] ssh user client002 service-type stelnet   //Configure a service type for the SSH user.
[HUAWEI] ssh user client002 authentication-type password  //Configure password authentication for the SSH user.
[HUAWEI] aaa
[HUAWEI-aaa] local-user client002 password irreversible-cipher Abcd@1234  //Create a local user with the same name as the SSH user and set the login password.
[HUAWEI-aaa] local-user client002 privilege level 15  //Set the privilege level for the local user.
[HUAWEI-aaa] local-user client002 service-type ssh    //Set the service type of the local user.
[HUAWEI-aaa] quit  
[HUAWEI] ecc local-key-pair create  //Generate a local ECC host key pair.

# To restore the original configuration file, restore it through FTP, TFTP, FTPS, SFTP, or SCP. For details, see Restoring the Configuration File.

Translation
Favorite
Download
Update Date:2023-07-25
Document ID:EDOC1100088109
Views:23419
Downloads:350
Average rating:4.5Points

Digital Signature File

digtal sigature tool