- Table of Contents
-
- 01-Fundamentals Configuration Guide
- 00-Preface
- 01-CLI configuration
- 02-RBAC configuration
- 03-Login management configuration
- 04-FTP and TFTP configuration
- 05-File system management configuration
- 06-Configuration file management configuration
- 07-Software upgrade configuration
- 08-ISSU configuration
- 09-Emergency shell configuration
- 10-Automatic configuration
- 11-Device management configuration
- 12-MDC configuration
- 13-TCL configuration
- 14-License management
- Related Documents
-
Title | Size | Download |
---|---|---|
06-Configuration file management configuration | 122.67 KB |
Next-startup configuration file redundancy
Startup configuration file selection
Configuration file content organization and format
Enabling configuration encryption
Saving the running configuration
Converting a Comware V5 configuration file to a Comware V7 configuration file
Configuring configuration rollback
Configuring configuration archive parameters
Enabling automatic configuration archiving
Manually archiving the running configuration
Performing a configuration rollback
Specifying a next-startup configuration file
Backing up the main next-startup configuration file to a TFTP server
Restoring the main next-startup configuration file from a TFTP server
Deleting a next-startup configuration file
Displaying and maintaining configuration files
You can use the CLI or the Boot menu to manage configuration files. This chapter describes the CLI approach to configuration file management.
Overview
A configuration file saves a set of commands for configuring software features on the device. You can save any configuration to a configuration file so they can survive a reboot. You can also back up configuration files to a host for future use.
Configuration types
The device has the following types of configurations: factory defaults, startup configuration, and running configuration.
Factory defaults
The device is shipped with some basic settings called "factory defaults." These default settings make sure the device can start up and run normally 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 factory defaults, use the display default-configuration command.
Startup configuration
The device uses startup configuration to configure software features during startup. After the device 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 device 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 device 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.
New settings take effect immediately, but they must be saved to a configuration file to survive a reboot.
To view the running configuration, use the display current-configuration command.
Next-startup configuration file redundancy
You can specify one main next-startup configuration file and one backup next-startup configuration file for redundancy.
At startup, the device tries to start up with the main configuration file. If the main configuration file is corrupted or unavailable, the device tries the backup configuration file. If the backup configuration file is corrupted or unavailable, the device starts up with the factory defaults.
For reliability, do not specify one configuration file as both the main and backup configuration files.
Configuration file formats
Configuration files you specify for saving configuration must use the .cfg extension. A .cfg configuration file is a human-readable text file. When you save configuration to a .cfg file, the device automatically saves the configuration to an .mdb user-inaccessible binary file that has the same name as the .cfg file. The device loads an .mdb file faster than loading a .cfg file.
Startup configuration file selection
At startup, the device uses the following procedure to identify the configuration file to load:
1. Searches for a valid .cfg next-startup configuration file.
2. If one is found, searches for an .mdb file that has the same name and content as the .cfg file.
3. If an .mdb file has the same name and content as the .cfg file, starts up with the .mdb file. If none is found, starts up with the .cfg file.
Unless otherwise stated, the term "configuration file" in this document refers to a .cfg configuration file.
Configuration file content organization and format
|
IMPORTANT: To run on the device, a configuration file must meet the content and format requirements of the device. To avoid any configuration loading problem at startup, use a configuration file created on the device. If you edit the configuration file, make sure all edits are compliant with the requirements of the device. |
A configuration file must meet the following requirements:
· All commands are saved in their complete form.
· Commands are sorted in sections by command view, typically in this order: system view, interface view, protocol views, and user interface view.
· Two adjacent sections are separated by a comment line that starts with a pound sign (#).
· The configuration file ends with the word return.
The following is a sample configuration file excerpt:
#
local-user root class manage
password simple admin
service-type ssh telnet terminal
authorization-attribute user-role network-admin
#
interface GigabitEthernet3/0/1
port link-mode route
ip address 1.1.1.1 255.255.255.0
#
Enabling configuration encryption
Configuration encryption enables the device to automatically encrypt a startup configuration file when saving the running configuration. This function has the following approaches:
· Private key approach—Only the encrypting MPU can decrypt the encrypted configuration file.
· Public key approach—Any H3C device running the same software version as the encrypting device can decrypt the encrypted configuration file.
|
IMPORTANT: Do not move or copy a private-key-encrypted configuration file between MPUs. Doing so can cause a decryption failure because the MPUs use different private keys. |
To enable configuration encryption:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enable configuration encryption. |
configuration encrypt { private-key | public-key } |
By default, configuration encryption is disabled. Configuration is saved unencrypted. |
Saving the running configuration
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 device 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 specify a new startup configuration file after the device reboots (see "Specifying a next-startup configuration file").
· Safe mode—Use the save command with the safely keyword. Safe mode is slower than fast mode, but 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 device.
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 file as the next-startup configuration file. |
save file-url |
N/A |
Save the running configuration to a configuration file in the root directory of each MPU's storage medium and specify the file as the next-startup configuration file. |
save [ safely ] [ backup | main ] [ force ] |
If you execute the save [ safely ] command without specifying any other keyword, the command saves the configuration to the main startup configuration file. 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 may choose to re-specify a next-startup configuration file as instructed by the system. |
Converting a Comware V5 configuration file to a Comware V7 configuration file
To use a configuration file that has been created for a Comware V5 platform on a Comware V7 platform, perform the following task in user view:
Task |
Command |
Convert a Comware V5 configuration file to a Comware V7 configuration file. |
convert configuration srcfile to desfile |
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, executes its undo form.
· If a command in the replacement file is not in the running configuration, adds it to the running configuration.
· If a command has different settings in the running configuration and the configuration file, replaces its running configuration with the setting in the configuration file.
To facilitate configuration rollback, the configuration archive function is developed. This function enables the system to automatically save the running configuration at regular intervals as checkpoint references.
Configuration task list
Tasks at a glance |
(Required.) Configuring configuration archive parameters |
(Required.) Perform either task: |
(Required.) Performing a configuration rollback |
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 no longer displays them. The serial number for new configuration archives starts at 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 the running configuration only on the active MPU. In IRF mode, the function saves the running configuration only on the active MPU in the master device.
To make sure the system can archive the 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. Enter system view. |
system-view |
N/A |
2. 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. |
1. (Optional.) Set the maximum number of configuration archives. |
archive configuration max file-number |
The default number is 5. Change the setting depending on the amount of storage available on the device. |
Enabling automatic configuration archiving
To avoid decreasing system performance, follow these guidelines when you configure automatic configuration archiving:
· If the device configuration does not change frequently, manually archive the running configuration as needed.
· If a low-speed storage medium (such as a Flash) 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 device configuration changes frequently, set a shorter saving interval.
· H3C recommends not deleting the configuration files archived by the system when the automatic configuration archiving is enabled.
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 the running configuration
To save system resources, disable automatic configuration archiving and manually archive the 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 |
Performing a configuration rollback
To avoid a rollback failure, 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 local device.
· If the configuration file is not created on the local device, make sure the configuration file content format is fully compatible with the local device.
· The replacement configuration file is not encrypted.
To perform a configuration rollback:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Roll the running configuration back to the configuration defined by a configuration file. |
configuration replace file filename |
The specified configuration file must not be encrypted. |
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.
Specifying a next-startup configuration file
|
CAUTION: In an IRF fabric, use the undo startup saved-configuration command with caution. This command can cause an IRF split after the IRF fabric or an IRF member reboots. |
You can specify a .cfg configuration file as a main or backup next-startup configuration file when using the save [ safely ] [ backup | main ] [ force ] command to save the running configuration.
Alternatively, you can execute the startup saved-configuration cfgfile [ backup | main ] command to specify a configuration file as the main or backup next-startup configuration file. When performing this task, follow these guidelines:
· In standalone mode, make sure the specified configuration file is valid and saved to the root directory of both the active and standby MPUs' storage media.
· In IRF mode, make sure the specified configuration file is valid and saved to the root directory of all MPUs' storage media in the IRF fabric.
· If neither backup nor main is specified, this command sets the configuration file as the main next-startup configuration file.
· Even though the main and backup next-startup configuration files can be the same one, specify them as separate files for high availability.
· The undo startup saved-configuration command changes the attribute of the main or backup next-startup configuration file to NULL instead of deleting the file.
To specify a next-startup configuration file, perform the following task in user view:
Task |
Command |
Remarks |
Specify the next-startup configuration file. |
startup saved-configuration cfgfile [ backup | main ] |
Use the display startup command and the display saved-configuration command in any view to verify the configuration. |
Backing up the main next-startup configuration file to a TFTP server
Before performing this task, make sure the server is reachable and enabled with TFTP service, and you have read and write permissions.
To back up the main next-startup configuration file to a TFTP server:
Step |
Command |
Remarks |
1. (Optional.) Verify that a next-startup configuration file has been specified in user view. |
display startup |
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 ] |
N/A |
Restoring the main next-startup configuration file from a TFTP server
To download a configuration file from a TFTP server and specify the file as the main 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 server is reachable, the server is enabled with TFTP service, and you have read and write permissions.
To restore the main next-startup configuration file from a TFTP server:
Step |
Command |
1. Restore the main next-startup configuration file from a TFTP server in user view. |
restore startup-configuration from src-addr src-filename |
2. (Optional.) Verify that the specified configuration file has been set as the main next-startup configuration file. |
display startup display saved-configuration |
Deleting a 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. |
You can delete the main, the backup, or both.
To delete a file that is set as both main and backup next-startup configuration files, you must execute both the reset saved-configuration backup command and the reset saved-configuration main command. Whichever command is executed first, the system removes the specific file attribute instead of deleting the file. For example, if the reset saved-configuration backup command is executed first, the backup next-startup configuration file setting is set to NULL, but the file is still used as the main file. To delete the file, you must execute the reset saved-configuration main command.
You may need to delete the next-startup configuration file for one of the following reasons:
· After you upgrade system software, the file no longer matches the new system software.
· The file has been corrupted or is not fully compatible with the device.
After the file is deleted, the device uses factory defaults at the next startup.
Perform the following task in user view:
Task |
Command |
Remarks |
Delete next-startup configuration files. |
reset saved-configuration [ backup | main ] |
If neither backup nor main is specified, this command deletes the main next-startup configuration file. |
Displaying and maintaining configuration files
Execute display commands in any view.
Task |
Command |
Display information about configuration rollback. |
display archive configuration |
Display the running configuration. |
display current-configuration [ configuration [ module-name ] | interface [ interface-type [ interface-number ] ] ] |
Display the factory defaults. |
display default-configuration |
Display the contents of the main next-startup configuration file. |
display saved-configuration |
Display names of the configuration files used at this startup and the next startup. |
display startup |
Display the valid configuration in the current view. |
display this |