- Table of Contents
-
- 01-Fundamentals Configuration Guide
- 00-Preface
- 01-CLI Configuration
- 02-Login Management Configuration
- 03-FTP and TFTP Configuration
- 04-File System Management
- 05-Configuration File Management Configuration
- 06-Software Upgrade Configuration
- 07-ISSU Configuration
- 08-Device Management Configuration
- 09-Automatic Configuration
- 10-Management with BootWare
- Related Documents
-
Title | Size | Download |
---|---|---|
05-Configuration File Management Configuration | 127.43 KB |
Contents
Configuration file content organization and format
Startup with a configuration file
Saving the running configuration
Enabling configuration auto-update
Saving configuration by using different methods
Using automatic configuration backup after a software upgrade
Configuring configuration rollback
Configuring configuration archive parameters
Enabling automatic configuration archiving
Manually archiving running configuration
Specifying a configuration file for the next startup
Backing up the next-startup configuration file to a TFTP server
Restoring the next-startup configuration file from a TFTP server
Deleting the next-startup configuration file
Displaying and maintaining configuration files
You can use the CLI or the BootWare menus to manage configuration files. This chapter describes only managing configuration files from the CLI.
Overview
A configuration file saves configurations as a set of text commands. You can save the running configuration to a configuration file so the configuration takes effect after you reboot the switch. You can also back up the configuration file on to a host and download the file to the device as needed.
Configuration types
The switch has the following types of configuration: factory defaults, startup configuration, and running configuration.
Factory defaults
The switch is shipped with some basic settings called "factory defaults." These default settings make sure the switch can start up and run correctly when it has no configuration file or the configuration file is corrupted.
Factory defaults vary with device models and might differ from the default settings of commands.
To view the factory defaults of the switch, use the display default-configuration command.
Startup configuration
The switch uses startup configuration to configure software features during startup. After the switch starts up, you can specify a different configuration file to be loaded at the next startup. This configuration file is called the "next-startup configuration file." The configuration file that has been loaded is called the "current startup configuration file."
If no next-startup configuration file exists, the switch boots with the factory defaults.
You can view the startup configuration in either of the following ways:
· Execute the display startup command. To view detailed file contents, use the more command.
· After the switch reboots, execute the display current-configuration command before making any configuration.
Running configuration
Running configuration includes startup settings that have not been changed and new settings you have made. It is stored in a volatile storage medium and takes effect while the device is operating.
A new setting takes effect immediately after it is made but must be saved to a configuration file to survive a reboot.
To view the running configuration, use the display current-configuration command.
Configuration file content organization and format
|
IMPORTANT: To run on the switch, a configuration file must meet the content and format requirements of the switch. To ensure a successful configuration load at startup, use a configuration file created on the switch. If you edit the configuration file, make sure all edits are compliant with the requirements of the switch. |
A configuration file must meet the following requirements:
· All commands are saved in their complete form.
· Commands are sorted in sections by view, typically in this order: system view, interface view, protocol views, and user interface view.
· Sections are separated with one or multiple blank lines or comment lines that start with a pound sign (#).
· The configuration file ends with the word return.
You can execute the save command to save the running configuration to a configuration file. To make sure the configuration file can be loaded, H3C recommends that you not edit the content and format of the configuration file.
Startup with a configuration file
The switch selects the configuration file to load at startup, as follows:
1. If you have specified a startup configuration file that already exists on the storage media, the switch starts up with this startup configuration file.
2. If the specified startup configuration file does not exist, the switch starts up with the factory defaults.
FIPS compliance
The switch supports the FIPS mode that complies with NIST FIPS 140-2 requirements. Support for features, commands, and parameters might differ in FIPS mode and non-FIPS mode. For more information about FIPS mode, see Security Configuration Guide.
Saving the running configuration
To make configuration changes take effect at the next startup of the switch, save the running configuration to the next-startup configuration file before the switch reboots.
Complete the following tasks to save the running configuration:
Task |
Remarks |
Optional. Perform this task to ensure configuration consistency across MPUs. |
|
Required. |
The task described in "Using automatic configuration backup after a software upgrade" is automatically performed the first time you use the save command to save the running configuration to the next-startup configuration file that contains settings incompatible with the software version after a software upgrade.
Enabling configuration auto-update
In standalone mode:
The configuration auto-update function enables the standby MPU to automatically save the running configuration as the active MPU does when you execute the save [ safely ] [ force ] command or the save filename all command. If this function is disabled, only the active MPU saves the configuration.
In IRF mode:
The configuration auto-update function enables all MPUs in the IRF fabric to automatically save the running configuration as the active MPU on the master device does when you execute the save [ safely ] [ force ] command or the save filename all command. If this function is disabled, only the active MPU on the master device saves the configuration.
|
NOTE: The save command executed with only the filename argument saves the running configuration only to the specified path, regardless of whether the configuration auto-update function has been enabled. |
To ensure configuration consistency, H3C recommends enabling the function.
To enable configuration auto-update:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enable configuration auto-update. |
slave auto-update config |
By default, this function is enabled. |
Saving configuration by using different methods
When saving the running configuration to a configuration file, you can specify the file as the next-startup configuration file.
If you are specifying the file as the next-startup configuration file, use one of the following methods to save the configuration:
· Fast mode—Use the save command without the safely keyword. In this mode, the switch directly overwrites the target next-startup configuration file. If a reboot or power failure occurs during this process, the next-startup configuration file is lost. You must re-specify a new startup configuration file after the switch reboots (see "Specifying a configuration file for the next startup").
· Safe mode—Use the save command with the safely keyword. Safe mode is slower than fast mode, but it is more secure. In safe mode, the system saves configuration in a temporary file and starts overwriting the target next-startup configuration file after the save operation is complete. If a reboot or power failure occurs during the save operation, the next-startup configuration file is still retained.
Use the safe mode if the power source is not reliable or you are remotely configuring the switch.
The configuration file extension must be .cfg.
To save the running configuration, perform either of the following tasks in any view:
Task |
Command |
Remarks |
Save the running configuration to a configuration file, without specifying the configuration file as the next-startup configuration file. |
·
In standalone mode: · In IRF mode: · save filename [ all | chassis chassis-number slot slot-number ] |
The save filename [ slot slot-number ] command saves the configuration only to the specified path, regardless of whether the configuration auto-update function has been enabled. |
Save the running configuration to a configuration file in the root directory of the storage medium (flash memory or CF card), and specify the file as the next-startup configuration file. |
save [ safely ] [ force ] |
If the force keyword is specified, the command saves the configuration to the next-startup configuration file that has been specified. If the force keyword is not specified, you can choose to re-specify a next-startup configuration file as instructed by the system. |
In standalone mode, if configuration auto-update is enabled, the save filename all command and the save [ safely ] [ force ] command save the configuration to both MPUs. If the function is disabled, the commands save the configuration only to the active MPU.
In IRF mode, if configuration auto-update is enabled, the save filename all command and the save [ safely ] [ force ] command save the configuration to all MPUs in the IRF fabric. If the function is disabled, the commands save the configuration only to the active MPU on the master device.
Using automatic configuration backup after a software upgrade
After a software upgrade, the system by default starts up with the next-startup configuration file created on the old software version, but the system does not load settings that are incompatible with the new software version to the current configuration.
In case a future downgrade is needed, the system automatically checks for configuration incompatibility and backs up the old next-startup configuration file the first time you use the save command to save the running configuration to the file.
The backup file is named in the _old-filename_bak.cfg format. For example, if the old configuration file is named config.cfg, the backup file is named _config_bak.cfg.
In standalone mode, the overwrite and backup operations are performed on both active MPU and standby MPU, regardless of whether configuration auto-update is enabled.
In IRF mode, the overwrite and backup operations are performed on all MPUs in the IRF fabric, regardless of whether configuration auto-update is enabled.
If the backup attempt fails on a standby MPU, choose one of the following failure handling actions at prompt:
· Give up saving the configuration—The system does not save the running configuration on any MPU.
· Overwrite the configuration file—The system uses the running configuration to overwrite the old configuration file on the MPU without backing up the file. In standalone mode, you can copy the backup configuration file from the active MPU to the standby MPU for future rollback. In IRF mode, you can copy the backup configuration file from the global active MPU to the standby MPU for future rollback.
Make sure each MPU has enough space for the backup configuration file and the new next-startup configuration file.
To load the backup configuration file after a software downgrade, specify the backup file as the next-startup configuration file on each MPU.
Configuring configuration rollback
To replace the running configuration with the configuration in a configuration file without rebooting the device, use the configuration rollback function. This function helps you revert to a previous configuration state or adapt the running configuration to different network environments.
The configuration rollback function compares the running configuration against the specified replacement configuration file and handles configuration differences as follows:
· If a command in the running configuration is not in the replacement file, the rollback function executes the undo form of the command.
· If a command in the replacement file is not in the running configuration, the rollback function adds the command to the running configuration.
· If a command has different settings in the running configuration and the configuration file, the rollback function replaces the running command setting with the setting in the configuration file.
To facilitate configuration rollback, the configuration archive function was developed. This function enables the system to save the running configuration automatically at regular intervals as checkpoint references.
Configuration task list
Task |
Remarks |
Required. |
|
Required. Use either method. |
|
Required. |
Configuring configuration archive parameters
Before archiving the running configuration, either manually or automatically, you must configure a file directory and file name prefix for configuration archives.
Configuration archives are saved with the file name format prefix_serial number.cfg, for example, 20080620archive_1.cfg and 20080620archive_2.cfg. The serial number is automatically assigned from 1 to 1000, increasing by 1. After the serial number reaches 1000, it restarts from 1.
After you change the file directory or file name prefix, or reboot the device, the old configuration archives are regarded as common configuration files, the configuration archive counter resets, and the display archive configuration command does not display them. The serial number for new configuration archives starts from 1.
After the maximum number of configuration archives is reached, the system deletes the oldest archive for the new archive.
Configuration guidelines
In standalone mode, the configuration archive function saves running configuration only on the active MPU. In IRF mode, the function saves running configuration only on the active MPU in the master device.
To make sure the system can archive running configuration after an active/standby or master/subordinate switchover, create the configuration archive directory on all MPUs.
Configuration procedure
To configure configuration archive parameters:
Step |
Command |
Remarks |
1. Create the configuration archive directory. |
See "Managing the file system." |
In standalone mode, create the directory at least on the active MPU. In an IRF fabric, create the directory at least on the active MPU of the master. H3C recommends creating the directory on all MPUs. |
2. Enter system view. |
system-view |
N/A |
3. Configure the directory and file name prefix for archiving the running configuration. |
archive configuration location directory filename-prefix filename-prefix |
In standalone mode, do not include slot information in the directory name. In IRF mode, do not include member ID or slot information in the directory name. By default, no path or file name prefix is set for configuration archives, and the system does not regularly save configuration.
The undo form of this command disables both manual and automatic configuration archiving, restores the default settings for the archive configuration interval and archive configuration max commands, and deletes all saved configuration archives. |
4. Set the maximum number of configuration archives. |
archive configuration max file-number |
Optional. The default number is 5. Change the setting depending on the available storage space. |
Enabling automatic configuration archiving
To avoid decreasing system performance, follow these guidelines when you configure automatic configuration archiving:
· If the switch configuration does not change frequently, manually save the running configuration manually as needed.
· If a low-speed storage medium (such as a flash memory) is used, archive the running configuration manually, or configure automatic archiving with an interval longer than 1440 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.
Make sure you have set an archive path and file name prefix before performing this task.
To enable automatic configuration archiving:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enable automatic configuration archiving, and set the archiving interval. |
archive configuration interval minutes |
By default, this function is disabled. To view configuration archive names and their archiving time, use the display archive configuration command. |
Manually archiving running configuration
To save system resources, disable automatic configuration archiving and manually archive configuration if the configuration will not be changed very often. You can also manually archive configuration before performing complicated configuration tasks so you can use the archive for configuration recovery after the configuration attempt fails.
Make sure you have set an archive path and file name prefix before performing this task.
Perform the following task in user view:
Task |
Command |
Manually archive the running configuration. |
archive configuration |
Rolling back configuration
To ensure a successful rollback, follow these guidelines:
· Do not remove or install a card while the system is executing the configuration replace file command.
· Make sure the replacement configuration file is created by using the configuration archive function or the save command on the current device.
· If the configuration file is not created on the current device, make sure the configuration file content format is fully compatible with the current device.
· The replacement configuration file is not encrypted.
To roll back configuration:
Step |
Command |
1. Enter system view. |
system-view |
2. Perform configuration rollback. |
configuration replace file filename |
The configuration rollback function might fail to reconfigure some commands in the running configuration for one of the following reasons:
· A command cannot be undone, because prefixing the undo keyword to the command does not result in a valid undo command. For example, if the undo form designed for the A [B] C command is undo A C, the configuration rollback function cannot undo the A B C command, because the system does not recognize the undo A B C command.
· A command (for example, a hardware-dependent command) cannot be deleted, overwritten, or undone due to system restrictions.
· The commands in different views are dependent on each other.
· Commands or command settings that the device does not support cannot be added to the running configuration.
· The rollback operation does not take effect on the enhanced IRF mode setting (the irf mode enhanced command or its undo form). The enhanced mode setting in the current running configuration continues to run after the rollback. For more information about the irf mode enhanced or undo irf mode enhanced command, see IRF Command Reference.
Specifying a configuration file for the next startup
You can specify a .cfg configuration file as the startup configuration file to be used at the next startup when you use the save command to save the running configuration.
Alternatively, perform the following task in user view to specify the next-startup configuration file:
Task |
Command |
Remarks |
Specify the next-startup configuration file. |
startup saved-configuration cfgfile |
In standalone mode, the setting applies to both active MPU and standby MPU. In IRF mode, the setting applies to all MPUs in the IRF fabric.
The configuration file must use the .cfg extension and be saved in the root directory of the flash memory or CF card. If the storage medium has been partitioned, save the file on the first partition. Do not save the startup configuration file to a USB disk. |
Backing up the next-startup configuration file to a TFTP server
Before performing this task, make sure the following requirements are met:
· The server is reachable and enabled with TFTP service.
· You have read and write permissions.
To back up the next-startup configuration file to a TFTP server:
Task |
Command |
Remarks |
1. Verify that a next-startup configuration file has been specified in user view. |
display startup |
Optional. If no next-startup configuration file has been specified, the backup operation will fail. |
2. Back up the next-startup configuration file to a TFTP server in user view. |
backup startup-configuration to dest-addr [dest-filename ] |
This command is not supported in FIPS mode. |
Restoring the next-startup configuration file from a TFTP server
To download a configuration file from a TFTP server and specify the file as the next-startup configuration file, perform the task in this section.
The configuration file is automatically saved to the root directory of the default storage medium on each MPU. (The default storage medium is user configurable. For more information, see "Managing the file system.")
Before restoring the next-startup configuration file, make sure the following requirements are met:
· The server is reachable and enabled with TFTP service.
· You have read and write permissions.
To restore the next-startup configuration file from a TFTP server:
Task |
Command |
Remarks |
1. Restore the next-startup configuration file from a TFTP server in user view. |
restore startup-configuration from src-addr src-filename |
This command is not supported in FIPS mode. |
2. Verify that the specified configuration file has been set as the next-startup configuration file. |
display startup |
Optional. |
3. Verify that the specified configuration file exists on the switch. |
dir |
Optional. |
Deleting the next-startup configuration file
|
CAUTION: This task permanently deletes the next-startup configuration file from each MPU. Before performing this task, back up the file as needed. |
Delete the next-startup configuration file if one of the following occurs:
· After you upgrade system software, the file does not match the new system software.
· The file is corrupted or not fully compatible with the device.
After the file is deleted, the switch uses factory defaults at next startup.
Perform the following task in user view:
Task |
Command |
Delete the next-startup configuration file. |
reset saved-configuration |
Displaying and maintaining configuration files
Task |
Command |
Remarks |
Display information about configuration rollback. |
display archive configuration [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display the running configuration. |
display current-configuration [ configuration [ configuration ] | interface [ interface-type [ interface-number ] ] | exclude modules ] [ by-linenum ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display the next-startup configuration file. |
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 names of the configuration files used at this startup and next startup. |
display startup [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display the valid configuration in the current view. |
display this [ by-linenum ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |