- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
05-Configuration File Management Commands | 115.17 KB |
Configuration file management commands
archive configuration interval
archive configuration location
archive configuration
Use archive configuration to manually archive the running configuration to the configuration archive directory.
Syntax
archive configuration
Views
User view
Default command level
3: Manage level
Usage guidelines
Before manually archiving the running configuration, complete the following tasks:
1. Create a directory for saving configuration archives.
2. Use the archive configuration location command to specify the directory as the configuration archive directory and specify an archive name prefix.
Configuration archive facilitates configuration rollback. It provides manual and automatic methods for saving the running configuration as checkpoint references. For more information about the archiving mechanism, see the section about configuration rollback in Fundamentals Configuration Guide.
Examples
# Archive the running configuration.
<Sysname> archive configuration
Warning: Save the running configuration to an archive file. Continue? [Y/N]: Y
Please wait...
Info: The archive configuration file myarchive_1.cfg is saved.
Related commands
archive configuration location
archive configuration interval
Use archive configuration interval to enable automatic running-configuration archiving and set the archiving interval.
Use undo archive configuration interval to restore the default.
Syntax
archive configuration interval minutes
undo archive configuration interval
Default
The system does not automatically archive the running configuration.
Views
System view
Default command level
3: Manage level
Parameters
minutes: Specifies the interval (in minutes) for automatically saving the running configuration. Value range is 10 to 525600 (365 days).
Usage guidelines
Before enabling automatic configuration archiving, complete the following tasks:
1. Create a directory for saving configuration archives.
2. Use the archive configuration location command to specify the directory as the configuration archive directory and specify an archive name prefix.
Configuration archive facilitates configuration rollback. It provides manual and automatic methods for saving the running configuration as checkpoint references.
Automatic configuration archiving enables the system to automatically save the running configuration to the archive directory. For more information about the archiving mechanism, see the section about configuration rollback in Fundamentals Configuration Guide.
Change the archiving interval depending on the available amount of storage space. The shorter the interval, the more free storage space is required.
Examples
# Configure the system to archive the running configuration every 60 minutes.
<Sysname> system-view
[Sysname] archive configuration interval 60
Info: Archive files will be saved every 60 minutes.
Related commands
archive configuration location
archive configuration location
Use archive configuration location to configure the directory and file name prefix for archiving the running configuration.
Use undo archive configuration location to restore the default.
Syntax
archive configuration location directory filename-prefix filename-prefix
undo archive configuration location
Default
No configuration archive directory or configuration archive file name prefix has been set.
Views
System view
Default command level
3: Manage level
Parameters
directory: Specifies a configuration archive directory, a case-insensitive string of 1 to 63 characters. The directory must take the format storage-medium-name:/folder-name. This directory must already exist on the device.
filename-prefix: Specifies a file name prefix for configuration archives, a case-insensitive string of 1 to 30 characters. Valid characters are letters, digits, underscores (_), and hyphens (-).
Usage guidelines
Before archiving the running configuration, either manually or automatically, you must configure a directory and file name prefix for configuration archives.
Configuration archives take 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.
The undo archive configuration location command not only removes the configuration archive directory and file name prefix settings, but also disables the configuration archive function (both manual and automatic methods), restores the default settings of the archive configuration interval and archive configuration max commands, and clears all configuration archives.
Examples
# Configure the configuration archive directory and archive file name prefix as flash:/archive/ and my_archive:
1. Create the directory.
<Sysname> mkdir archive
.
%Created dir flash:/archive.
2. Specify the directory as the configuration archive directory, and configure an archive file name prefix.
<Sysname> system-view
[Sysname] archive configuration location flash:/archive filename-prefix my_archive
mkdir
archive configuration max
Use archive configuration max to set the maximum number of configuration archives.
Use undo archive configuration max to restore the default.
Syntax
archive configuration max file-number
undo archive configuration max
Default
A maximum of five configuration archives can be saved.
Views
System view
Default command level
3: Manage level
Parameters
file-number: Sets the maximum number of configuration archives that can be saved. Value range is 1 to 10. Change the setting depending on the available amount of storage space.
Usage guidelines
Before you can set a limit on configuration archives, use the archive configuration location command to specify a configuration archive directory and archive file name prefix.
After the maximum number of configuration archives is reached, the system deletes the oldest archive for the new archive.
Changing the limit setting to a lower value does not cause immediate deletion of exceeding archives. Instead, the configuration archive function deletes the oldest n files when a new archive is manually or automatically saved, where n = current archive count – new archive limit + 1. Suppose seven configuration archives have been saved before the archive limit is set to four. When saving a new configuration archive, the system first deletes the oldest four (7 – 4 + 1) archives.
If you execute the undo archive configuration location command, the default archive limit is restored.
Examples
# Set the maximum number of configuration archives to 10.
<Sysname> system-view
[Sysname] archive configuration max 10
Related commands
archive configuration location
backup startup-configuration
Use backup startup-configuration to back up the next-startup configuration file to a TFTP server.
Syntax
backup startup-configuration to dest-addr [ dest-filename ]
Views
User view
Default command level
2: System level
Parameters
dest-addr: Specifies a TFTP server's IPv4 address or name, a string of 1 to 20 characters.
dest-filename: Specifies the target file name used for saving the file on the server. The file extension must be .cfg. If you do not specify a target file name, the source file name is used.
Usage guidelines
Before performing this task, make sure the server is reachable, the server is enabled with TFTP service, and you have read and write permissions.
This command backs up only the main next-startup configuration file.
Examples
# Back up the next-startup configuration file to the TFTP server at 2.2.2.2, and set the target file name to 192-168-1-26.cfg.
<Sysname> backup startup-configuration to 2.2.2.2 192-168-1-26.cfg
Backup next startup-configuration file to 2.2.2.2, please wait…finished!
configuration replace file
Use configuration replace file to perform configuration rollback.
Syntax
configuration replace file filename
Views
System view
Default command level
3: Manage level
Parameters
filename: Specifies the name of the replacement configuration file for configuration rollback.
Usage guidelines
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.
To avoid rollback failure:
· 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.
Examples
# Replace the running configuration with the configuration in the my_archive_1.cfg configuration file.
<Sysname> system-view
[Sysname] configuration replace file my_archive_1.cfg
Current configuration will be lost, save current configuration? [Y/N]:n
Info: Now replacing the current configuration. Please wait...
Info: Succeeded in replacing current configuration with the file my_archive_1.cfg.
display archive configuration
Use display archive configuration to display configuration archive information, including the archive directory, archive prefix, archive interval, maximum number of archives, and saved archives.
Syntax
display archive configuration [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Examples
# Display configuration archive information.
<Sysname> display archive configuration
Location: flash:/archive
Filename prefix: my_archive
Archive interval in minutes: 120
Maximum number of archive files: 10
Saved archive files:
No. TimeStamp FileName
1 Jan 05 2012 20:24:54 my_archive_1.cfg
2 Jan 05 2012 20:34:54 my_archive_2.cfg
# 3 Jan 05 2012 20:44:54 my_archive_3.cfg
'#' indicates the most recent archive file.
Next archive file to be saved: my_archive_4.cfg
Table 1 Command output
Field |
Description |
Location |
Directory for saving running-configuration archives. |
Filename prefix |
File name prefix for configuration archives. |
Archive interval in minutes |
Interval (in minutes) for the system to automatically archive the running configuration. If automatic configuration saving is disabled, this field is not available. |
TimeStamp |
Time when the configuration archive was created. |
Filename |
Configuration archive file name, with the directory excluded. |
display current-configuration
Use display current-configuration to display the running configuration.
Syntax
display current-configuration [ configuration [ configuration ] | interface [ interface-type [ interface-number ] ] | exclude modules ] [ by-linenum ] [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
2: System level
Parameters
configuration [ configuration ]: Displays feature configuration. The configuration argument specifies a feature module. If you do not specify a feature module, this command displays all feature settings you have made. Available feature modules depend on your configuration. For example:
· system: Displays the system configuration.
· user-interface: Displays the user interface configuration.
interface [ interface-type [ interface-number ] ]: Displays interface configuration, where interface-type represents the interface type and interface-number represents the interface number.
exclude modules: Excludes the configuration of specific modules. The modules argument can be acl, acl6, or both separated by a space.
· acl: Excludes the IPv4 ACL configuration.
· acl6: Excludes the IPv6 ACL configuration.
by-linenum: Displays the number of each line.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
Use this command to verify the configuration you have made.
Typically, this command does not display parameters that are set to their default settings.
If the system has automatically changed the setting you have made for a parameter, for example, due to a system restriction, this command displays the effective setting rather than the configured one. For example, assign IP address 11.11.11.11 24 to a Loopback interface. However, the display current-configuration command displays 11.11.11.11 255.255.255.255, because the subnet mask for a Loopback interface must be 32 bits, and the system has automatically corrected the subnet mask.
Examples
# Display the configuration from the line containing "user-interface" to the last line in the running configuration.
<Sysname> display current-configuration | begin user-interface
user-interface con 0
user-interface vty 0 4
authentication-mode none
user privilege level 3
#
return
# Display the running SNMP configuration.
<Sysname> display current-configuration | include snmp
snmp-agent
snmp-agent local-engineid 800063A203000FE240A1A6
snmp-agent community read public
snmp-agent community write private
snmp-agent sys-info version all
· display saved-configuration
· reset saved-configuration
· save
display saved-configuration
Use display saved-configuration to display the contents of the configuration file to be used at the next startup.
Syntax
display saved-configuration [ by-linenum ] [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
2: System level
Parameters
by-linenum: Identifies each line of displayed information with a line number.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
Use this command to verify that important settings have been saved to the next-startup configuration file.
This command displays the main next-startup configuration file.
If no next-startup configuration file has been specified, or the specified next-startup configuration does not exist, this command displays the error message "The config file does not exist!".
Examples
# Display the next-startup configuration file.
<Sysname> display saved-configuration
#
version 5.20, Alpha 1101
#
sysname WA4620i-ACN
#
configure-user count 6
#
domain default enable ias
#
telnet server enable
#
dot1x
#
web idle-timeout 999
#
password-recovery enable
#
vlan 1
#
vlan 5
#
vlan 10
#
---- More ----
At the prompt of More, press Enter to display the next line, press Space to display the next screen of configuration, or press Ctrl+C or any other key to stop displaying the configuration.
# Display the next-startup configuration file and number each line.
<Sysname> display saved-configuration by-linenum
1: #
2: version 5.20, Alpha 1101
3: #
4: sysname WA4620i-ACN
5: #
6: configure-user count 6
7: #
8: domain default enable ias
9: #
10: telnet server enable
11: #
12: dot1x
13: #
14: web idle-timeout 999
15: #
16: password-recovery enable
17: #
18: vlan 1
19: #
20: vlan 5
21: #
22: vlan 10
23: #
---- More ----
· display current-configuration
· reset saved-configuration
· save
display startup
Use display startup to display the current startup configuration file and the next-startup configuration file.
Syntax
display startup [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
Current startup configuration file is the configuration file used at this startup. Next-startup configuration file is the configuration file used at the next startup.
Examples
# Display the startup configuration files.
<Sysname> display startup
Current startup saved-configuration file: flash:/startup.cfg
Next main startup saved-configuration file: flash:/startup.cfg
Next backup startup saved-configuration file: null
Table 2 Command output
Field |
Description |
Current startup saved-configuration file |
Configuration file used at the current startup. |
Next main startup saved-configuration file |
Main configuration file to be used at the next startup. |
Next backup startup saved-configuration file |
Backup configuration file to be used at the next startup. |
(This file does not exist.) |
If the specified next-startup configuration file has been deleted, this comment appears next to the file name. |
startup saved-configuration
display this
Use display this to display the running configuration in the current view.
Syntax
display this [ by-linenum ] [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
1: Monitor level
Parameters
by-linenum: Displays the number of each line.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
Use this command to verify the configuration you have made in a certain view.
Typically, this command does not display parameters that are set to their default settings.
For some parameters that can be successfully configured even if their dependent features are not enabled, this command displays their settings after the dependent features are enabled.
Executed in any user interface view, this command displays the running configuration of all user view interfaces.
Executed in any VLAN view, this command displays the running configuration of all VLANs.
Examples
# Display the running configuration on user interfaces.
<Sysname> system-view
[Sysname] user-interface vty 0
[Sysname-ui-vty0] display this
#
user-interface con 0
user-interface vty 0
history-command max-size 256
user-interface vty 1 4
#
return
reset saved-configuration
Use reset saved-configuration to delete next-startup configuration files.
Syntax
reset saved-configuration [ backup | main ]
Views
User view
Default command level
3: Manage level
Parameters
backup: Deletes the backup next-startup configuration file.
main: Deletes the main next-startup configuration file.
Usage guidelines
Delete the next-startup configuration file if it does not match the software version or has been corrupted.
You can delete the main file, the backup file, 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. Using only one of the commands removes the specified file attribute instead of deleting the file.
For example, if the reset saved-configuration backup command is executed, the backup next-startup configuration file setting is set to NULL. However, the file is still used as the main file. To delete the file, you must also execute the reset saved-configuration main command.
If no configuration file attribute is specified, the reset saved-configuration command deletes the main startup configuration file.
Examples
# Delete the next-startup configuration file.
<Sysname> reset saved-configuration
The saved configuration file will be erased. Are you sure? [Y/N]:y
Configuration file in flash is being cleared.
Please wait ...........
Configuration file is cleared.
· display saved-configuration
· save
restore startup-configuration
Use restore startup-configuration to download a configuration file from a TFTP server and specify it as the next-startup configuration file.
Syntax
restore startup-configuration from src-addr src-filename
Views
User view
Default command level
3: Manage level
Parameters
src-addr: Specifies a TFTP server's IPv4 address or name. The name can comprise 1 to 20 characters.
src-filename: Specifies the file name of the configuration file to be downloaded.
Usage guidelines
Before restoring the configuration file for the next startup, make sure the server is reachable, the server is enabled with TFTP service, and you have read and write permissions.
This command restores only the main next-startup configuration file.
This command provides an easy way to configuration file restoration by automatically performing all operations required for restoring the next-startup configuration file.
Examples
# Download the configuration file test.cfg from the TFTP server at 2.2.2.2, and specify the file as the startup configuration file for the next startup.
<Sysname> restore startup-configuration from 2.2.2.2 test.cfg
Restore next startup-configuration file from 2.2.2.2. Please wait..............
finished!
save
Use save file-url to save the running configuration to a configuration file, without specifying the file as a next-startup configuration file.
Use save [ safely ] [ backup | main ] [ force ] to save the running configuration to the root directory of the default storage medium, and specify the file as a next startup configuration file.
Syntax
save file-url
save [ safely ] [ backup | main ] [ force ]
Views
Any view
Default command level
2: System level
Parameters
file-url: Specifies a file path, where the file extension must be .cfg.
safely: Saves the configuration file in safe mode. If this keyword is not specified, the system saves the configuration file in fast mode. 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. In fast 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.
backup: Saves the running configuration to a configuration file, and specifies the file as the backup next-startup configuration file.
main: Saves the running configuration to a configuration file, and specifies the file as the main next-startup configuration file.
force: Saves the running configuration to the next-startup configuration file already specified in the system. Without this keyword, the system asks you to confirm your operation. If you do not confirm your operation within 30 seconds, the system automatically aborts the operation. If you enter Y within the time limit, you can continue the save process and change the next-startup configuration file during this process.
Usage guidelines
If the file specified for file-url does not exist, the system creates the file before saving the configuration.
If the backup or main keyword is not specified, the main keyword applies.
Examples
# Save the running configuration to the configuration file test.cfg, without specifying the file as the next-startup configuration file.
<Sysname> save test.cfg
The current configuration will be saved to flash:/test.cfg. Continue? [Y/N]:y
Now saving current configuration to the device.
Saving configuration flash:/test.cfg. Please wait...
............
Configuration is saved to flash successfully.
# Save the running configuration to the configuration file startup.cfg in the root directory of the default storage medium, and specify the configuration file as the next-startup configuration file.
<Sysname> display startup
Current startup saved-configuration file: flash:/hmr.cfg
Next main startup saved-configuration file: flash:/aa.cfg
Next backup startup saved-configuration file: NULL
<Sysname> save
The current configuration will be written to the device. Are you sure? [Y/N]:y
Please input the file name(*.cfg)[flash:/aa.cfg]
(To leave the existing filename unchanged, press the enter key):startup.cfg
Validating file. Please wait............
Configuration is saved to device successfully.
<Sysname> display startup
Current startup saved-configuration file: flash:/hmr.cfg
Next main startup saved-configuration file: flash:/startup.cfg
Next backup startup saved-configuration file: NULL
The output shows that the main next-startup configuration file has changed from aa.cfg to startup.cfg.
# Save the running configuration to the main next-startup configuration file without any confirmation required.
<Sysname> save force
Validating file. Please wait....
Configuration is saved to device successfully.
· display current-configuration
· display saved-configuration
· reset saved-configuration
startup saved-configuration
Use startup saved-configuration to specify the configuration file to be used at the next startup.
Use undo startup saved-configuration to configure the system to start up with factory defaults at the next startup.
Syntax
startup saved-configuration cfgfile [ backup | main ]
undo startup saved-configuration
Views
User view
Default command level
3: Manage level
Parameters
cfgfile: Specifies a configuration file name with the extension .cfg. The file must be stored in the root directory of the default storage medium.
backup: Sets the configuration file as the backup next-startup configuration file.
main: Sets the configuration file as the main next-startup configuration file.
Usage guidelines
If neither backup nor main is specified, the startup saved-configuration command specifies the main next-startup configuration file.
For high availability, specify separate files as the main and backup next-startup configuration files, even though they can be the same file.
The undo startup saved-configuration command changes the file attribute of the main and backup next-startup configuration files to NULL, but does not delete the two configuration files.
You can also specify a configuration file as a next- startup configuration file when you use the save command to save the running configuration to it.
Examples
# Specify a next-startup configuration file.
<Sysname> startup saved-configuration testcfg.cfg
Please wait ....
... Done!
display startup