01-Fundamentals Configuration Guide

HomeSupportSwitchesH3C S9500E Switch SeriesConfigure & DeployConfiguration GuidesH3C S9500E Configuration Guide-Release1728-6W17001-Fundamentals Configuration Guide
05-Configuration File Management Configuration
Title Size Download
05-Configuration File Management Configuration 138.39 KB

Managing configuration files

The switch provides the configuration file management function. You can manage configuration files at the command-line interface (CLI).

 

 

NOTE:

The switch operates in Intelligent Resilient Framework (IRF) or standalone (the default) mode. For more information about the IRF mode, see IRF Configuration Guide.

 

Configuration file overview

A configuration file saves the switch configurations in command lines in text format. You can view the configuration information conveniently through configuration files.

A configuration file contains a set of commands. You can save the current configuration to a configuration file so that the configuration can take effect after a switch reboot. In addition, you can view the configuration information, or upload or download the configuration file to or from another switch.

Types of configuration

The switch maintains the following types of configuration: factory defaults, startup configuration, and running configuration.

Factory defaults

Switches are shipped with some basic settings, which are called factory defaults. These default settings make sure that a switch can start up and run normally when it has no configuration file or the configuration file is damaged.

To view the factory defaults of the switch, you can use the display default-configuration command.

 

 

NOTE:

Factory defaults may differ from the default settings of commands and vary with switch models.

 

Startup configuration

Use startup configuration for initialization when the switch boots. If this file does not exist, the system boots using the factory defaults.

You can view the startup configuration in either of the following ways:

·           Use the display startup command to view the currently using startup configuration file, and use the more command to view the content of the configuration file.

·           After the reboot of the switch and before configuring the switch, use the display current-configuration command to view the startup configuration.

Running configuration

The currently running configuration may include the startup configuration if the startup configuration has not been modified during system operation. It also includes any new configurations added during the system operation. The running configuration is stored in a temporary storage medium. You must save a setting you have made so it can survive a reboot.

You can use the display current-configuration command to view the current configuration.

Format and content of a configuration file

A configuration file is saved as a text file. It is saved following these rules:

·           A configuration file contains complete commands.

·           Commands in a configuration file are listed in sections by views, usually in the order of system view, interface view, routing protocol view, and user interface view. Sections are separated with one or multiple blank lines or comment lines that start with a pound sign #.

·           A configuration file ends with a return.

 

 

NOTE:

A configuration file must obey some strict rules in content and format. To make sure that a configuration file can be used normally, H3C recommends using a configuration file generated by the switch. For example, you can use a configuration file generated by using the save command.

 

Coexistence of multiple configuration files

The switch can save multiple configuration files on its storage medium. You can save the configuration used in different networking environments as different configuration files. When the switch moves between these networking environments, specify the corresponding configuration file as the configuration file to be used at the next startup of the switch and restart the switch. Multiple configuration files allow the switch adapt to the network rapidly, saving the configuration workload.

A switch starts up using only one configuration file. However, you can specify two startup configuration files, main startup configuration file and backup startup configuration file as needed if the switch supports main and backup configuration files. The switch starts up using the main startup configuration file. If the main startup configuration file is corrupted or lost, the switches starts up using the backup startup configuration file. Switches supporting main and backup startup configuration files are more secure and reliable.

At a moment, there are at most one main startup configuration file and one backup startup configuration file. You can specify neither of the two files (displayed as NULL).

You can specify main and backup startup configuration files to be used at the next startup of the switch in two methods:

·           Specify them when saving the running configuration. For more information, seeSaving the running configuration.

·           Specify them when specifying the startup configuration file to be used at the next system startup. For more information, seeSpecifying a startup configuration file.

Startup with the configuration file

The switch takes the following steps when it boots:

1.      If you have specified a startup configuration file to be used at the next startup, and this file exists, the switch starts up with this startup configuration file.

2.      If the specified startup configuration file does not exist, the switch starts up with factory defaults.

Saving the running configuration

To make configuration changes take effect at the next startup of the switch, you can save the running configuration to the startup configuration file to be used at the next startup before the switch reboots.

Complete these tasks to save the current configuration:

 

Task

Remarks

Enabling configuration file auto-save

Optional

Modes in saving the configuration

Required

 

Enabling configuration file auto-save

·           Standalone mode

¡  When the configuration file auto-save function is enabled, and you save the current configuration by executing the save [ safely ] [ force ] command or by executing the save filename all command and then pressing Enter, the active main board (AMB) and standby main board (SMB) automatically save the current configuration to the specified configuration file, and use the file as the configuration file at the next startup, thus keeping the consistency of the configuration files on the AMB and SMB.

¡  When the configuration file auto-save function is not enabled, and you save the current configuration by executing the save [ safely ] [ force ] command or by executing the save filename all command and then pressing Enter, only the AMB automatically saves the current configuration to the specified configuration file, and uses the file as the configuration file at its next startup; the SMB neither saves the configuration file nor configures the file as the file to be used at the next startup.

·           IRF mode

¡  When the configuration file auto-save function is enabled, and you save the current configuration by executing the save [ safely ] [ force ] command or by executing the save filename all command and then pressing Enter, each main board of the IRF fabric automatically saves the current configuration to the specified configuration file, and uses the file as the configuration file at its next startup, thus keeping the consistency of the configuration files on the AMB and SMBs of the IRF fabric.

¡  When the configuration file auto-save function is not enabled, and you save the current configuration by executing the save [ safely ] [ force ] command or by executing the save filename all command and then pressing Enter, only the AMB of the IRF fabric automatically saves the current configuration to the specified configuration file, and uses the file as the configuration file at the next startup; the SMBs of the IRF fabric neither save the configuration file nor reconfigure the file as the startup configuration file to be used at the next startup.

To enable the configuration file auto-save function:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enable configuration file auto-save.

slave auto-update config

Optional.

Enabled by default.

 

 

NOTE:

If you execute the save filename command and press Enter, the system saves the current configuration to the specified path, but the SMB does not save the configuration.

 

Modes in saving the configuration

You can save the current configuration in either of the following ways:

·           Fast saving mode. Execution of the save command without the safely keyword. This mode saves the file more quickly but is likely to lose the existing configuration file if the switch reboots or the power fails during the process.

·           Safe mode. Execution of the save command with the safely keyword. This mode saves the file more slowly but can retain the configuration file in the switch even if the switch reboots or the power fails during the process.

The fast saving mode is suitable for environments where power supply is stable. The safe mode, however, is preferred in environments where stable power supply is unavailable or remote maintenance is involved.

To save the current running configuration:

 

Task

Command

Remarks

Save the current running configuration to the specified file, but the configuration file will not be set as the file to be used at the next startup (standalone mode).

save file-url [ all | slot slot-number ]

Available in any view.

Save the current running configuration to the specified file, but the configuration file will not be set as the file to be used at the next startup (IRF mode).

save [ file-url [ all | chassis chassis-number slot slot-number ] ]

Save the current running configuration to the root directory of the storage media, and specify the file as the startup configuration file to be used at the next system startup.

save [ safely ] [ force ]

 

 

NOTE:

·       A configuration must include the extension .cfg.

·       If the configuration file auto-save function is enabled, and you save the current configuration by executing the save command or executing the save file-url all command and then pressing Enter, the AMB and SMB automatically save the current configuration to the specified configuration file. If the configuration file auto-save function is not enabled, and you save the current configuration by executing the save command or executing the save filename all command and then pressing Enter, only the AMB automatically saves the current configuration to the specified configuration file. For the configuration file auto-save function, see Enabling configuration file auto-save.

·       During the execution of the save [ safely ] command, the startup configuration file to be used at the next system startup may be lost if the switch reboots or the power supply fails. In this case, the switch boots with the factory defaults. After the switch reboots, you need to re-specify a startup configuration file to be used at the next system startup (see “Backing up startup configuration files).

 

Setting configuration rollback

Configuration rollback

Configuration rollback allows you to revert to a previous configuration state based on a specified configuration file. The specified configuration file must be a valid .cfg file generated by using either the backup function or the save command, or, if a configuration file is generated by another switch, the configuration file must comply with the format of the configuration file on the current switch. H3C recommends that you use the configuration file that is generated by using the backup function. Configuration rollback can be applied in the following situations:

·           Running configuration error. Rolling back the running configuration to a correct one is needed.

·           The application environment has changed and the switch has to run in a configuration state based on a previous configuration file without being rebooted.

Before setting configuration rollback, perform the following steps:

1.      Specify the filename prefix and path for saving the running configuration.

2.      Save the running configuration with the specified filename (filename prefix + serial number) to the specified path. The running configuration can be saved automatically or manually.

When you enter the configuration replace file command, the system compares the current running configuration and the specified replacement configuration file. The configuration replace file command performs the following actions:

·           Preserves all commands present in both the replacement configuration file and the current running configuration.

·           Removes commands from the current running configuration that are not present in the replacement configuration file.

·           Applies the commands from the replacement configuration file that are not present in the current running configuration.

·           Applies the commands from the replacement configuration file that have different configurations in the current running configuration.

 

 

NOTE:

·       In standalone mode, the running configuration is only saved to the AMB, and only the configuration on the AMB can be rolled back. However, the related configuration will be synchronized to the SMB to ensure the rollback of the configuration after an active/standby switchover.

·       In IRF mode, the current running configuration is only saved to the AMB of the IRF fabric, and only the configuration on the AMB can be rolled back. However, the related configuration is synchronized to the SMBs of the IRF fabric to ensure the rollback of the configuration after the AMB of the IRF fabric is changed.

 

Configuration task list

Complete these tasks to configure the configuration rollback:

 

Task

Remarks

Configuring parameters for saving the current running configuration

Required.

Enabling automatic saving of the running configuration

Required.

Use either approach.

Manually saving the current running configuration

Setting configuration rollback

Required.

 

Configuring parameters for saving the current running configuration

Before the running configuration is saved manually or automatically, you must configure the file path and filename prefix. The system will save the running configuration with the specified filename (filename prefix_serial number.cfg) to the specified path. The filename of a saved configuration file is like 20080620archive_1.cfg, or 20080620archive_2.cfg. The saved configuration files are numbered automatically, from 1 to 1,000 (with an increment of 1). If the serial number reaches 1,000, it restarts from 1. If you change the path or filename prefix, or reboot the switch, the saved file serial number restarts from 1, and the system recounts the saved configuration files. If you change the path of the saved configuration files, the files in the original path become common configuration files, and are not processed as saved configuration files, and are not displayed when you view saved configuration files.

The number of saved configuration files has an upper limit. After the maximum number of files is saved, the system deletes the oldest files when the next configuration file is saved.

To configure parameters for saving the current running configuration:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Configure the path and filename prefix for saving configuration files.

archive configuration location directory filename-prefix filename-prefix

By default, the path and filename for saving configuration files are not configured, and the system does not save the configuration file at a specified interval.

3.     Set the maximum number of configuration files that can be saved.

archive configuration max file-number

Optional.

The default number is 5.

 

 

NOTE:

·       In standalone mode, you can only execute the saving and rollback operations on the AMB. To make the configuration rollback take effect on the new AMB after an active/standby switchover, execute the archive configuration location command to specify the path and filename prefix for saving configuration files on both the AMB and SMB. Therefore, before the execution of this command, make sure that the specified path is available on both the AMB and SMB, and the path cannot include any slot number.

·       In IRF mode, you can only execute the saving and rollback operations on the AMB of the IRF fabric. To make the configuration rollback take effect on the new AMB after an AMB change, execute the archive configuration location command to specify the path and filename prefix for saving configuration files on all the main boards of the IRF fabric. Therefore, before the execution of this command, make sure that the specified path is available on all the main boards of the IRF fabric, and the path cannot include any member ID and slot number.

·       If the undo archive configuration location command is executed, the current running configuration can neither be saved manually nor automatically, and the configuration by executing the archive configuration interval and archive configuration max commands restores to the default, meanwhile, the saved configuration files are cleared.

·       The value of the file-number argument is determined by the memory space. You are recommended to set a comparatively small value for the file-number argument if the available memory space is small.

 

Enabling automatic saving of the running configuration

You can configure the system to save the running configuration at a specified interval, and use the display archive configuration command to view the filenames and save time of the saved configuration files. This enables you to easily roll back the current configuration to a previous configuration state.

Configure an automatic save interval based on the storage media’s performance and the frequency of configuration modification in the following situations:

·           If the configuration of the switch does not change frequently, manually save the current running configuration manually as needed

·           If a low-speed storage medium (such as a Flash) is used, save the current running configuration manually, or configure automatic saving with an interval longer than 1,440 minutes (24 hours).

·           If a high-speed storage medium (such as a CF card) is used and the configuration of the switch changes frequently, set a shorter saving interval.

To enable automatic saving of the current running configuration:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enable the automatic saving of the current running configuration, and set the interval.

archive configuration interval minutes

Optional.

Disabled by default.

 

 

NOTE:

Specify the path and filename prefix of a saved configuration file before you configure the automatic saving period.

 

Manually saving the current running configuration

Automatic saving of the current running configuration occupies system resources, and frequent saving greatly affects system performance. Therefore, if the system configuration does not change frequently, disable the automatic saving of the current running configuration and save it manually.

In addition, automatic saving of the running configuration is performed periodically, while manual saving can immediately save the running configuration. Before performing complicated configuration, you can manually save the running configuration so that the switch can revert to the previous state if and when the configuration fails.

To manually save the current running configuration:

 

Task

Command

Remarks

Manually save the current running configuration.

archive configuration

Available in user view

 

 

NOTE:

Specify the path and filename prefix of a saved configuration file before you manually save the running configuration; otherwise, the operation fails.

 

Setting configuration rollback

To set configuration rollback:

 

Step

Command

1.     Enter system view.

system-view

2.     Replace the current running configuration with a specified configuration file.

configuration replace file filename

 

CAUTION

CAUTION:

Do not unplug and plug a card during configuration rollback (that is, the system is executing the configuration replace file command). In addition, configuration rollback may fail if one of the following situations is present (if a command cannot be rolled back, the system skips it and processes the next one):

·       The complete undo form of a command is not supported, meaning you cannot get the actual undo form of the command by simply putting the keyword undo in front of the command, so the complete undo form of the command cannot be recognized by the switch. For example, the undo form of the A [ B ] C command is undo A C. If you execute the undo A B C command, the system considers that the switch does not support the undo A B C command, so the configuration rollback fails.

·       The configuration cannot be removed, such as hardware-related commands.

·       Commands in different views are dependent on each other.

·       If the replacement configuration file is not a complete file generated by using the save or archive configuration command, or the file is copied from a different type of switch, the configuration cannot be rolled back. Make sure that the replacement configuration file is correct and compatible with the current switch.

·       The configuration file specified with the configuration replace file filename command can only be a configuration file in simple text. Otherwise, errors may occur in configuration rollback.

·       If the configuration file specified with the configuration replace file filename command contains the irf mode enhanced or undo irf mode enhanced command, the irf mode enhanced or undo irf mode enhanced command cannot take effect after the configuration rollback. For more information about the irf mode enhanced or undo irf mode enhanced command, see IRF Command Reference.

 

Specifying a startup configuration file

To specify a startup configuration file for the next system startup:

·           Use the save command. If you save the running configuration to the specified configuration file in the interactive mode, the system automatically sets the file as the main startup configuration file.

·           Use the command dedicated to specify a startup configuration file, which is described in the following table:

To specify a configuration file as the startup configuration file:

 

Task

Command

Remarks

Specify a startup configuration file.

startup saved-configuration cfgfile

Available in user view

 

CAUTION

CAUTION:

·       A configuration file must use .cfg as its extension name and the startup configuration file must be saved in the root directory of the storage medium. For a storage medium that has been partitioned, the file must be saved on the first partition.

·       During the switch boot process, the switch cannot read data from the USB disk. Therefore, do not save the boot file on the USB disk.

 

Backing up startup configuration files

The backup function allows you to copy startup configuration files for the next startup from the switch to the TFTP server.

The backup operation backs up startup configuration files to the TFTP server for switches supporting main and backup startup configuration files.

To back up startup configuration files for the next startup:

 

Task

Command

Remarks

Back up the startup configuration file for the next startup to the specified TFTP server.

backup startup-configuration to dest-addr [dest- filename ]

Available in user view

 

 

NOTE:

Before the backup operation, perform the following steps:

·       Make sure that the server is reachable, the server is enabled with TFTP service, and the client has the read and write permission.

·       Use the display startup command (in user view) to check whether you have specified a startup configuration files for the next startup. If the file is set as NULL or does not exist, the backup operation fails.

 

Deleting a startup configuration file

You can delete a startup configuration file  at the CLI. You may need to delete a startup configuration file  in the following cases:

·           After you upgrade system software, the existing startup configuration files does not match the new system software.

·           Startup configuration files are corrupted, which is often caused by loading an incorrect configuration file.

When startup configuration files are deleted, the switch uses factory defaults at the next startup.

To delete a startup configuration file for the next startup:

 

Task

Command

Remarks

Delete a startup configuration file for the next startup from the storage medium.

reset saved-configuration

Available in user view

 

CAUTION

CAUTION:

·       In standalone mode, this command permanently deletes startup configuration files for the next startup from the switch. Use it with caution.

·       In IRF mode, this command permanently deletes startup configuration files for the next startup from all main boards of the IRF fabric. Use it with caution.

 

Restoring a startup configuration file

In standalone mode, the restore function allows you to copy a configuration file from a TFTP server to the root directory of the storage media of both the AMB and SMB and specify the file as the startup configuration file.

In IRF mode, the restore function allows you to copy a configuration file from a TFTP server to the root directory of the storage medium of each main board in an IRF and specify the file as the startup configuration file.

To restore a startup configuration file:

 

Task

Command

Remarks

Restore the main startup configuration file.

restore startup-configuration from src-addr src-filename

Available in user view

 

 

NOTE:

·       Before restoring a configuration file, make sure that the server is reachable, the server is enabled with TFTP service, and the client has read and write permission.

·       After execution of the command, use the display startup command (in user view) to verify that the filename of the configuration file for the next system startup is the same as that specified by the filename argument, and use the dir command to verify that the restored startup configuration file exists.

 

Displaying and maintaining switch configuration

 

Task

Command

Remarks

Display the information about configuration rollback.

display archive configuration  [ | { begin | exclude | include } regular-expression ]

Available in any view

Display the current configuration.

display current-configuration [ [ configuration [ configuration ] | interface [ interface-type ] [ interface-number ] ] [ by-linenum ] [ | { begin | exclude | include } regular-expression ] ]

Available in any view

Display the current running configuration file saved on the storage medium of the switch.

display saved-configuration [ by-linenum ] [ | { begin | exclude | include } regular-expression ]

Available in any view

Display the factory defaults of the switch.

display default-configuration [ | { begin | exclude | include } regular-expression ]

Available in any view

Display the system startup configuration file.

display startup [ | { begin | exclude | include } regular-expression ]

Available in any view

Display the validated configuration in current view.

display this [ by-linenum ] [ | { begin | exclude | include } regular-expression ]

Available in any view

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网