- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
05-Configuration File Management Commands | 123.66 KB |
Configuration file management commands
archive configuration interval
archive configuration location
archive configuration
Syntax
archive configuration
View
User view
Default level
3: Manage level
Parameters
None
Description
Use archive configuration to manually archive the running configuration to the configuration archive directory.
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 is a function that facilitates configuration rollback. It provides the manual and automatic approaches to saving the running configuration as checkpoint references. For more information about the archiving mechanism, see the section about configuration rollback in Fundamentals Configuration Guide.
To avoid decreasing system performance, follow these guidelines:
· If the device configuration does not change frequently, manually archive the running configuration as needed.
· If a low-speed storage media (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 media (such as a CF card) is used and the device configuration changes frequently, set a shorter saving interval.
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.
archive configuration interval
Syntax
archive configuration interval minutes
undo archive configuration interval
View
System view
Default level
3: Manage level
Parameters
minutes: Specifies the interval (in minutes) for automatically saving the running configuration. The value ranges from 10 to 525,600 (365 days).
Description
Use archive configuration interval to enable automatic running configuration archiving and set the archiving interval.
Use undo archive configuration interval to restore the default.
By default, the system does not automatically archive the running configuration.
efore 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 is a function that facilitates configuration rollback. It provides the manual and automatic approaches to 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.
To avoid decreasing system performance, follow these guidelines:
· If the device configuration does not change frequently, manually archive the running configuration as needed.
· If a low-speed storage media (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 media (such as a CF card) is used and the device configuration changes frequently, set a shorter saving interval.
· Change the archiving interval depending on the available 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.
archive configuration location
Syntax
archive configuration location directory filename-prefix filename-prefix
undo archive configuration location
View
System view
Default 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-media-name:/[folder name]/subfolder name. The folder must be created before the configuration.
filename-prefix: Specifies a file name prefix for configuration archives, a case-insensitive string of 1 to 30 characters. Valid characters include letters, numbers, underscores (_), and hyphens (-).
Description
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.
By default, no configuration archive directory or configuration archive file name prefix has been set. The system does not archive the configuration file periodically.
Before archiving the running configuration, either manually or automatically, you must configure a directory and file name prefix for configuration archives.
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 approaches), 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 cfa0:/archive/ and my_archive:
1. Create the directory.
<Sysname> mkdir archive
%Created dir cfa0:/archive.
2. Specify the directory as the configuration archive directory, and configure an archive file name prefix.
<Sysname> system-view
[Sysname] archive configuration location cfa0:/archive filename-prefix my_archive
archive configuration max
Syntax
archive configuration max file-number
undo archive configuration max
View
System view
Default 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 storage space.
Description
Use archive configuration max to set the maximum number of configuration archives.
Use undo archive configuration max to restore the default.
By default, a maximum of five configuration archives can be saved.
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
backup startup-configuration
Syntax
backup startup-configuration to dest-addr [ dest-filename ]
View
User view
Default level
2: System level
Parameters
dest-addr: Specifies a TFTP server's IPv4 address or name. The address cannot be an IPv6 address.
dest-filename: Specifies the target file name used for saving the next-startup configuration 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.
Description
Use backup startup-configuration to back up the next-startup configuration file to a TFTP server. If you do not specify this filename, the original filename is used.
Before performing this task, make sure the server is reachable, the server is enabled with TFTP service, and you have read and write permissions.
Examples
# Back up the next-startup configuration file to the TFTP server with IP address 2.2.2.2, and set the target file name to 192-168-1-26.cfg.
<Sysname> display startup
Current startup saved-configuration file: cfa0:/config.cfg
Next startup saved-configuration file: cfa0:/test.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!
<Sysname>
After the above operation, the device backs up file test.cfg to TFTP server 2.2.2.2, where the file is saved as 192-168-1-26.cfg.
configuration encrypt
Syntax
configuration encrypt { private-key | public-key }
undo configuration encrypt
View
System view
Default level
3: Manage level
Parameters
private-key: Encrypts a configuration file with a private key. The encrypted configuration file can only be decrypted and recognized by the local device.
public-key: Encrypts a configuration file with a public key. The encrypted configuration file can be decrypted and recognized by all devices supported the configuration file encryption function.
Description
Use configuration encrypt to enable configuration file encryption.
Use undo configuration encrypt to restore the default.
By default, configuration file encryption is disabled. The running configuration is saved to a configuration file without encryption.
With this feature enabled, a configuration file is encrypted every time before it is saved (by the save command).
|
NOTE: Support for this command may vary depending on the device model. For more information, see About the WX Series Access Controllers Command References. |
Examples
# Encrypt the configuration file with a public key before saving it.
<Sysname> system-view
[Sysname] configuration encrypt public-key
configuration replace file
Syntax
configuration replace file filename
View
System view
Default level
3: Manage level
Parameters
filename: Specifies the name of the replacement configuration file for configuration rollback.
Description
Use configuration replace file to set configuration rollback.
When this command is executed, the running configuration rolls back to the configuration state based on the specified configuration file (filename).
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.
Examples
# Roll back from the running configuration to a previous configuration state based on a saved configuration file my_archive_1.cfg.
<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
Syntax
display archive configuration [ | { begin | exclude | include } regular-expression ]
View
Any view
Default 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.
Description
Use display archive configuration to display information about configuration rollback.
Examples
# Display information about configuration rollback.
<Sysname> display archive configuration
Location: cfa0:/archive
Filename prefix: my_archive
Archive interval in minutes: 120
Maximum number of archive files: 10
Saved archive files:
No. TimeStamp FileName
1 Aug 05 2010 20:24:54 my_archive_1.cfg
2 Aug 05 2010 20:34:54 my_archive_2.cfg
# 3 Aug 05 2010 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 |
Absolute path of the saved configuration files. |
Filename prefix |
Filename prefix of the saved configuration files. |
Archive interval in minutes |
Configuration file saving interval, in minutes. If the automatic saving is disabled, this field is not displayed. |
Filename |
Filename of the saved configuration files, with path excluded. |
display current-configuration
Syntax
display current-configuration [ [ configuration [ configuration ] | interface [ interface-type ] [ interface-number ] | exclude modules ] [ by-linenum ] [ | { begin | exclude | include } regular-expression ] ]
View
Any view
Default level
2: System level
Parameters
configuration [ configuration ]: Displays non-interface configuration. If the argument is not provided, all the non-interface configuration is displayed; if parameters are used, display the specified information. For example:
· isp: Displays the ISP configuration.
· post-system: Displays the post-system configuration.
· radius-template: Displays the RADIUS scheme configuration.
· system: Displays the system configuration.
· user-interface: Displays the user interface configuration.
interface [ interface-type ] [ interface-number ]: Displays the interface configuration, where interface-type represents the interface type and interface-number represents the interface number.
exclude modules: Excludes the configuration of the specified 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.
Description
Use display current-configuration to display the running configuration of the device.
A parameter is not displayed if it adopts the default setting. If the validated parameter is changed, although you have configured it, the validated parameter is displayed. For example, IP address 11.11.11.11 24 has been configured on a Loopback interface. If you execute the display current-configuration command, IP address 11.11.11.11 255.255.255.255 is displayed, meaning the validated subnet mask is 32 bits.
Related commands: display saved-configuration, reset saved-configuration, and save.
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 on the device.
<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
Syntax
display saved-configuration [ by-linenum ] [ | { begin | exclude | include } regular-expression ]
View
Any view
Default 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.
Description
Use display saved-configuration to display the contents of the configuration file saved for the next startup of the device.
During device management and maintenance, you can use this command to check whether important configurations are saved to the configuration file to be used at the next startup of the device.
If the system is not specified with a configuration file to the used at the next startup or the specified configuration file does not exist, the display saved-configuration command displays the default configuration file of the device. If the default configuration file does not exist, the system prompts "The config file does not exist!".
Related commands: display current-configuration, reset saved-configuration, and save.
Examples
# Display the configuration file saved for the next startup of the device.
<Sysname> display saved-configuration
#
version 5.20, Test 5310
#
sysname Sysname
#
domain default enable system
#
telnet server enable
#
port-security enable
#
vlan 1
#
vlan 999
#
domain system
access-limit disable
state active
idle-cut disable
self-service-url disable
#
interface NULL0
#
---- More ----
The configurations are displayed in the order of global, port, and user interface. The More prompt indicates that there are more line that the screen can display. Pressing Enter displays the next line; pressing Space displays the next screen; pressing Ctrl+C or any other key exits the display.
# Display the contents of the configuration file saved for the next startup of the device with a number identifying each line.
<Sysname> display saved-configuration by-linenum
1: #
2: version 5.20, Test 5310
3: #
4: sysname Sysname
5: #
6: domain default enable system
7: #
8: telnet server enable
9: #
10: port-security enable
11: #
12: vlan 1
13: #
14: vlan 999
15: #
16: domain system
17: access-limit disable
18: state active
19: idle-cut disable
20: self-service-url disable
21: #
22: interface NULL0
23: #
---- More ----
The More prompt indicates that there are more line that the screen can display. Pressing Enter displays the next line; pressing Space displays the next screen; pressing Ctrl+C or any other key exits the display.
display startup
Syntax
display startup [ | { begin | exclude | include } regular-expression ]
View
Any view
Default 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.
Description
Use display startup to display the configuration files for the system startup and the configuration files for the next system startup.
Related commands: startup saved-configuration.
Examples
# Display the startup configuration file used at the current system startup and the one to be used at the next system startup.
<Sysname> display startup
Current startup saved-configuration file: cfa0:/testcfg.cfg
Next startup saved-configuration file: cfa0:/testcfg.cfg
Table 2 Command output
Field |
Description |
Current Startup saved-configuration file |
Configuration file used at the current startup. |
Next startup saved-configuration file |
Configuration file to be used at the next startup. |
display this
Syntax
display this [ by-linenum ] [ | { begin | exclude | include } regular-expression ]
Any view
Default 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.
Use display this to display the valid configuration information under the current view.
To check whether your configuration takes effect, use the display this command.
The valid configuration that is the same as the default is not displayed.
The invalid configuration is not displayed.
Execution of this command in any user interface view displays the valid configuration in all the user interfaces.
Execution of this command in any VLAN view displays the configurations of all the created VLANs.
Examples
# Display the valid configuration information on interface GigabitEthernet 1/0/1.
<Sysname> system-view
[Sysname] interface gigabitethernet 1/0/1
[Sysname-GigabitEthernet1/01] display this
#
interface GigabitEthernet1/01
port link-type hybrid
undo port hybrid vlan 1
port hybrid vlan 2 to 4 untagged
port hybrid pvid vlan 2
#
Return
# Display the valid configuration information of all 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
Syntax
reset saved-configuration
View
User view
Default level
3: Manage level
Parameters
None
Description
Use reset saved-configuration to delete the startup configuration file saved on the storage media of the device.
This command permanently deletes the startup configuration file from the device. Use it with caution.
Related commands: display saved-configuration and save.
Examples
# Delete the startup configuration file to be used at the next startup from the storage media of the device.
<Sysname> reset saved-configuration
The saved configuration file will be erased. Are you sure? [Y/N]:y
Configuration file in cfa0 is being cleared.
Please wait ...........
Configuration file is cleared.
restore startup-configuration
Syntax
restore startup-configuration from src-addr src-filename
View
User view
Default level
3: Manage level
Parameters
src-addr: IP address or name of a TFTP server. The address cannot be an IPv6 address.
src-filename: Filename of the configuration file to be downloaded from the specified server.
Description
Use restore startup-configuration to download a configuration file from the specified TFTP server to the device and specify it as the startup configuration file for the next system startup.
Examples
# Download configuration file test.cfg from the TFTP server whose IP address is 2.2.2.2, and the configuration file is to be used at the next startup of the device.
<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
Syntax
save file-url
save [ safely ] [ force ]
View
Any view
Default level
2: System level
Parameters
file-url: File path, where the extension of the file name must be .cfg.
safely: Sets the configuration saving mode to safe. If this argument is not specified, the configuration file is saved in fast mode.
force: Saves the running configuration to the configuration file for the next startup of the device, and the system does not output any interaction information. By default, when you execute the save command, the system asks you to input Y or N to confirm your operation. If you do not confirm your operation within 30 seconds, the system automatically quits the operation. If you provide the force keyword when executing the save command, the system directly saves the running configuration, not requiring any confirmation.
Description
Use the save file-url command to save the running configuration to the specified configuration file, but the system does not specify the file as the startup configuration file to be used at the next system startup. If the file specified by file-url does not exist, the system creates the file and then saves the configuration to the file.
Use the save [ safely ] [ force ] command to save the 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.
Related commands: display current-configuration, display saved-configuration, and reset saved-configuration.
Examples
# Save the running configuration file to the specified directory, but do not specify the configuration file as the startup configuration file to be used at the next startup.
<Sysname> save test.cfg
The current configuration will be saved to cfa0:/test.cfg. Continue? [Y/N]:y
Now saving current configuration to the device.
Saving configuration cfa0:/test.cfg. Please wait...
............
Configuration is saved to cfa0 successfully.
# Save the running configuration file to the root directory of the storage media, and specify the configuration file as the startup configuration file to be used at the next startup.
<Sysname> display startup
Current startup saved-configuration file: cfa0:/hmr.cfg
Next startup saved-configuration file: cfa0:/aa.cfg
// The output shows that the main startup configuration file to be used at the next system startup is aa.cfg.
<Sysname> save
The current configuration will be written to the device. Are you sure? [Y/N]:y
Please input the file name(*.cfg)[cfa0:/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: cfa0:/test.cfg
Next startup saved-configuration file: cfa0:/startup.cfg
// The output shows that the startup configuration file to be used at the next system startup is changed to startup.cfg.
# Save the running configuration to the configuration file to be used at the next startup of the device, without any confirmation required.
<Sysname> save force
Validating file. Please wait....
Configuration is saved to device successfully.
startup saved-configuration
Syntax
startup saved-configuration cfgfile
undo startup saved-configuration
View
User view
Default level
3: Manage level
Parameters
cfgfile: Configuration file name. The file must be a file with an extension .cfg stored in the root directory of the storage media.
Description
Use startup saved-configuration to specify a startup configuration file to be used at the next system startup.
Use undo startup saved-configuration to configure the system to start up with the factory configuration.
Related commands: display startup.
Examples
# Specify a startup configuration file to be used at the next system startup.
<Sysname> startup saved-configuration testcfg.cfg
Please wait ....