- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
06-Configuration file management commands | 262.90 KB |
Configuration file management commands
archive configuration interval
archive configuration location
archive configuration server password
archive configuration server user
configuration replace server file
configuration replace server password
configuration replace server user
display configuration replace server
display current-configuration diff
save current-configuration interval
Configuration file management commands
archive configuration
Use archive configuration to manually archive the running configuration to the configuration archive directory.
Syntax
archive configuration
Views
User view
Predefined user roles
network-admin
Usage guidelines
Operating mechanism
This command saves the running configuration to the specified configuration archive directory with file names generated from the specified name prefix.
Restrictions and guidelines
Before executing this command, you must use one of the following methods to specify a directory and a name prefix for the configuration archives:
· For local archiving, use the archive configuration location command to specify a local configuration archive directory and a name prefix.
· For remote archiving, use the archive configuration server command to configure server parameters.
Examples
# Archive the running configuration.
<Sysname> archive configuration
Save the running configuration to an archive file. Continue? [Y/N]: Y
The archive configuration file myarchive_1.cfg is saved.
Related commands
archive configuration interval
archive configuration location
archive configuration max
archive configuration server
archive configuration server password
archive configuration server user
display archive configuration
archive configuration interval
Use archive configuration interval to enable automatic running-configuration archiving and set the archiving interval for local archiving.
Use undo archive configuration interval to disable automatic running-configuration archiving for local archiving.
Syntax
archive configuration interval interval
undo archive configuration interval
Default
The automatic running-configuration archiving feature is disabled for local archiving.
Views
System view
Predefined user roles
network-admin
Parameters
interval: Specifies the interval for automatically saving the running configuration. The value range is 10 to 525600, in minutes.
Usage guidelines
Operating mechanism
Automatic configuration archiving enables the system to periodically save the running configuration to the archive directory. After the system finishes an automatic archive, it resets the archiving interval timer.
Restrictions and guidelines
Before enabling automatic configuration archiving, you must use the archive configuration location command to specify a directory and a name prefix for the configuration archives.
Examples
# Set the system to archive the running configuration every 60 minutes.
<Sysname> system-view
[Sysname] archive configuration interval 60
Archive file will be saved every 60 minutes.
Related commands
archive configuration
archive configuration location
archive configuration max
display archive configuration
archive configuration location
Use archive configuration location to specify a local 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 local directory or file name prefix is specified on the device for archiving the running configuration.
Views
System view
Predefined user roles
network-admin
Parameters
directory: Specifies the archive directory, a string of 1 to 63 characters. The value for this argument must take the format of storage-medium-name:/folder-name. The 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
Operating mechanism
The configuration archives are named in the format of prefix_serial number.cfg, for example, archive_1.cfg and archive_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.
If you change the file directory or file name prefix, the following events occur:
· The old configuration archives change to common configuration files.
· The configuration archive counter is reset. The serial number for new configuration archives starts at 1.
· The display archive configuration command no longer displays the old configuration archives.
The configuration archive counter does not restart when you delete configuration archives from the archive directory. However, if the device reboots after all configuration archives have been deleted, the configuration archive counter restarts. The serial number for new configuration archives starts at 1.
Restrictions and guidelines
Before archiving the running configuration, either manually or automatically, you must specify a directory and file name prefix for configuration archives.
The undo archive configuration location command removes the local configuration archive directory and file name prefix settings. The command also performs the following operations:
· Disables the configuration archive feature (both manual and automatic methods).
· Restores the default settings of the archive configuration interval and archive configuration max commands.
· Clears the configuration archive information displayed by using the display archive configuration command.
Examples
# Set the configuration archive directory as flash:/archive and the archive file name prefix as my_archive.
<Sysname> mkdir flash:/archive
Creating directory flash:/archive... Done.
<Sysname> system-view
[Sysname] archive configuration location flash:/archive filename-prefix my_archive
Related commands
archive configuration
archive configuration interval
archive configuration max
display archive configuration
archive configuration max
Use archive configuration max to set the maximum number of configuration archives that can be saved on the device.
Use undo archive configuration max to restore the default.
Syntax
archive configuration max file-number
undo archive configuration max
Default
The maximum number is 5.
Views
System view
Predefined user roles
network-admin
Parameters
file-number: Specifies the maximum number of configuration archives that can be saved on the device. The value range is 1 to 10. Adjust the setting depending on the amount of storage space available.
Usage guidelines
Operating mechanism
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 excess archives. Instead, the configuration archive feature deletes the oldest n files when a new archive is manually or automatically saved, where n = current archive count – new archive limit + 1. For example, 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.
Restrictions and guidelines
Before you execute this command, use the archive configuration location command to specify a configuration archive directory and archive file name prefix on the device.
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
archive configuration location
archive configuration interval
display archive configuration
archive configuration server
Use archive configuration server to configure the parameters for archiving the running configuration to a remote server.
Use undo archive configuration server to restore the default.
Syntax
archive configuration server { ftp | tftp | scp | sftp } { ipv4-address | ipv6 ipv6-address } [ port port-number ] [ directory directory ] filename-prefix filename-prefix [ interval interval ]
undo archive configuration server
Default
No parameters are configured for archiving the running configuration to a remote server.
Views
System view
Predefined user roles
network-admin
Parameters
ftp: Specifies a remote FTP server.
tftp: Specifies a remote TFTP server.
scp: Specifies a remote SCP server.
sftp: Specifies a remote SFTP server.
ipv4-address: Specifies the IPv4 address of the remote server.
ipv6 ipv6-address: Specifies the IPv6 address of the remote server.
port port-number: Specifies the TCP port number of the remote server, in the range of 1 to 65535. By default, the FTP port number is 21, the TFTP port number is 69, and the SCP or SFTP port number is 22.
directory directory: Specifies the remote archive directory, a case-insensitive string. If you do not specify this option, the archive directory is the root directory of the remote server.
filename-prefix 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 (-).
interval interval: Enables automatic running-configuration remote archiving and sets the archiving interval. The value range for the interval argument is 10 to 525600 minutes.
Usage guidelines
Operating mechanism
After you configure the remote archiving parameters, you can use the archive configuration command to manually archive the running configuration.
By default, automatic running-configuration remote archiving is disabled. To enable automatic running-configuration remote archiving, specify the interval interval option when you use the archive configuration server command. To disable automatic running-configuration remote archiving, use the undo archive configuration server command.
On the specified remote server, configuration archives are named in the format of filename-prefix_YYYYMMDD_HHMMSS.cfg (for example, archive_20170526_203430.cfg).
Restrictions and guidelines
Local archiving (the archive configuration location command) and remote archiving (the archive configuration server command) are mutually exclusive. You cannot use the two features at the same time.
If you use a remote FTP, SCP, or SFTP server, make sure the device is consistent with that server in FTP or SCP settings. If a login username and password is configured on the server, you must use the archive configuration server user and archive configuration server password commands to specify that login username and password on the device.
If you use the archive configuration server command multiple times to configure parameters for remote archiving, the most recent configuration takes effect.
Examples
# Set the configuration archive directory as archive/ on the server at 192.168.1.1 and configure the archive file name prefix as my_archive.
<Sysname> system-view
[Sysname] archive configuration server ftp 192.168.1.1 port 22 directory /archive/ filename-prefix my_archive
Related commands
archive configuration
archive configuration location
archive configuration server password
archive configuration server user
display archive configuration
archive configuration server password
Use archive configuration server password to configure the password for accessing the FTP, SCP, or SFTP server that stores the configuration archives.
Use undo archive configuration server password to restore the default.
Syntax
archive configuration server password { cipher | simple } string
undo archive configuration server password
Default
No password is configured for accessing the FTP, SCP, or SFTP server that stores the configuration archives.
Views
System view
Predefined user roles
network-admin
Parameters
cipher: Specifies a password in encrypted form.
simple: Specifies a password in plaintext form. For security purposes, the password specified in plaintext form will be stored in encrypted form.
string: Specifies the password. Its plaintext form is a case-sensitive string of 1 to 63 characters. Its encrypted form is a case-sensitive string of 33 to 117 characters.
Examples
# Set the password to admin in plaintext form for accessing the FTP, SCP, or SFTP server that stores the configuration archives.
<Sysname> system-view
[Sysname] archive configuration server password simple admin
Related commands
archive configuration server
archive configuration server user
display archive configuration
archive configuration server user
Use archive configuration server user to configure the username for accessing the FTP, SCP, or SFTP server that stores the configuration archives.
Use undo archive configuration server user to restore the default.
Syntax
archive configuration server user user-name
undo archive configuration server user
Default
No username is configured for accessing the FTP, SCP, or SFTP server that stores the configuration archives.
Views
System view
Predefined user roles
network-admin
Parameters
user-name: Specifies the username, a case-sensitive string of 1 to 63 characters.
Usage guidelines
If no username is configured, the username will be anonymous.
Examples
# Set the username to admin for accessing the FTP, SCP, or SFTP server that stores the configuration archives.
<Sysname> system-view
[Sysname] archive configuration server user admin
Related commands
archive configuration server
archive configuration server password
display archive configuration
backup startup-configuration
Use backup startup-configuration to back up the main next-startup configuration file to a TFTP server.
Syntax
backup startup-configuration to { ipv4-server | ipv6 ipv6-server } [ dest-filename ]
Views
User view
Predefined user roles
network-admin
Parameters
ipv4-server: Specifies a TFTP server by its IPv4 address or host name. The host name is a case-insensitive string of 1 to 253 characters. Valid characters include letters, digits, hyphens (-), underscores (_), and dots (.).
ipv6 ipv6-server: Specifies a TFTP server by its IPv6 address or host name. The host name is a case-insensitive string of 1 to 253 characters. Valid characters include letters, digits, hyphens (-), underscores (_), and dots (.).
dest-filename: Specifies the name of the target file used for saving the file on the server. The file must be a .cfg file. The file name is a case-insensitive string of up to 255 characters. If you do not specify a target file name, the source file name is used.
Examples
# Back up the main next-startup configuration file to the IPv4 TFTP server at 2.2.2.2 in the public network, 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
Backing up the main startup configuration file to 2.2.2.2...
Done.
# Back up the main next-startup configuration file to the IPv6 TFTP server at 2001::2 in the public network, and set the target file name to 192-168-1-26.cfg.
<Sysname> backup startup-configuration to ipv6 2001::2 192-168-1-26.cfg
Backing up the main startup configuration file to 2001::2...
Done.
Related commands
restore startup-configuration
batch-configuration
Use batch-configuration to bulk deploy configuration.
Syntax
batch-configuration text
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
text: Specifies the command line set to be deployed in the format of command1 # command2 { command21 # command22 #...# quit } command3 # …. Command lines in the same view are separated by pound signs (#). Command lines enclosed by a pair of braces ({}) are executed in the subviews of the command before the left brace ({). The ellipsis (…) represents other command lines in the same view. A space must exist between a separator and a command line. The total length of the batch-configuration command cannot exceed 2048 characters. Whether the content of a command line is case sensitive depends on whether the content itself is case sensitive.
Usage guidelines
Operating mechanism
After executing this command, the system will sequentially deploy the command lines from the command line set starting from the current view. After the command is executed, the system will return to the current view. When editing the command line set, you must consider the logical relationship between the command lines and the current view, and avoid deploying command lines that do not exist in the current view. To exit the current view, use the quit command.
When the system bulk deploy configuration, the following rules apply:
· The system does not deploy the repeat command. It skips the repeat command and proceeds to deploy the next command line. For more information about the repeat command, see "CLI commands."
· For an interactive command line, you must input the interactive information before the next command line can be deployed. If no interactive information is input within the timeout period, the service module will automatically determine whether the command line has failed to be deployed.
· If a command line fails to be deployed, the configuration will be rolled back to the state before the bulk deployment. In addition, the system generates the following message: Rolling back the configuration. Please wait.
· You can press Ctrl+C to interrupt the command line deployment process. This operation also rolls back the configuration to the state before the bulk deployment and generates the following message: Rolling back the configuration. Please wait.
Restrictions and guidelines
Pound signs (#) and braces ({}) are used as separators between command lines for bulk deployment. A space must exist between a separator and a command line. To ensure correct command line deployment, do not use the separators in the command lines to be deployed. If you use the separators in the command lines, the system might falsely identify them as separators rather than parameters.
Examples
# Bulk deploy configure to configure free-authentication Telnet login.
<Sysname> system-view
[Sysname] batch-configuration telnet server enable # line vty 0 4 { authentication-mode none # user-role network-admin }
configuration encrypt
Use configuration encrypt to enable configuration encryption.
Use undo configuration encrypt to disable configuration encryption.
Syntax
configuration encrypt
undo configuration encrypt
Default
Configuration encryption is disabled.
Views
System view
Predefined user roles
network-admin
Usage guidelines
Operating mechanism
Configuration encryption enables the device to use the master key to encrypt a startup configuration file automatically when it saves the running configuration. For more information about the master key, see public key management in Security Configuration Guide.
Restrictions and guidelines
After a configuration file is encrypted by using this feature on the device, only devices that use the same master key as the device can decrypt the encrypted configuration file.
Examples
# Enable configuration encryption.
<Sysname> system-view
[Sysname] configuration encrypt
configuration execute file
Use configuration execute file to execute the configuration in a configuration file on the device.
Syntax
configuration execute file filename
Views
System view
Predefined user roles
network-admin
Parameters
Filename: Specifies the path of the replacement configuration file, a string of up to 255 characters. The file must be a .cfg file. The file and file path must be valid and on the local system.
Usage guidelines
Application scenarios
When the device executes the configuration replace file command, it checks the settings in the replacement configuration file specified by using this command. If the replacement configuration file contains a large number of settings, the configuration rollback operation will take a long time. In this case, if only specific settings in the file need to be deployed, you can save these settings in another file and execute the configuration execute file command to deploy only these settings to reduce the configuration rollback time.
Operating mechanism
The configuration execute file command allows you to deploy the settings in the specified configuration file to the device without rebooting the device.
If the settings in the specified configuration file conflict with the current configuration or fail to be executed, the device will skip them and not deploy them.
Prerequisites
Prepare the specified configuration file. Make sure the configuration file is created by using the configuration archive feature or the save command on the device. If the configuration file is not created on the device, make sure the command lines in the configuration file are fully compatible with the device. As a best practice, use a configuration file created by using the configuration archive feature.
Verify that the configuration in the specified configuration file is correct and compatible with the device. Commands or command settings that the device does not support cannot be added to the running configuration.
Restrictions and guidelines
The replacement configuration file must be stored unencrypted on the device.
The configuration execute file command might cause running configuration lost. As a best practice to avoid running configuration loss, back up the running configuration before you execute this command.
The configuration execute file command might cause service interruption. When you execute this command, make sure you fully understand its impact on your network.
Examples
# Execute the configuration in configuration file test.cfg on the device.
<Sysname> system-view
[Sysname] configuration execute file flash:/test.cfg
Current configuration will be modified. Do you want to save the current configuration? [Y/N]:Y
Please input the file name (*.cfg)[flash:/startup.cfg]
(To leave the existing filename unchanged, press Enter):
Validating file. Please wait...
Saved the current configuration successfully.
Now executing configuration file flash:/test.cfg...
Successfully executed configuration file flash:/test.cfg.
configuration replace file
Use configuration replace file to roll the running configuration back by using a local replacement configuration file.
Syntax
configuration replace file filename
Views
System view
Predefined user roles
network-admin
Parameters
filename: Specifies the path of the replacement configuration file, a string of up to 255 characters. The file must be a .cfg file. The file and file path must be valid and on the local system.
Usage guidelines
Prerequisites
Prepare the replacement configuration file. Make sure the replacement configuration file is created by using the configuration archive feature or the save command on the device.
If the configuration file is not created on the device, make sure the command lines in the configuration file are fully compatible with the device.
Operating mechanism
This command helps you revert to a previous configuration state or adapt the running configuration to different network environments without rebooting the device. Settings not in the replacement configuration file will be lost
Restrictions and guidelines
This operation might cause service interruption. When you perform configuration rollback, make sure you fully understand its impact on your network.
Make sure 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
Now replacing the current configuration. Please wait...
Succeeded in replacing current configuration with the file my_archive_1.cfg.
configuration replace server
Use configuration replace server to roll the running configuration back by using a configuration file on a remote server.
Use undo configuration replace server to restore the default.
Syntax
configuration replace server { ftp | tftp } { ipv4-address | ipv6 ipv6-address } [ port port-number ] [ directory directory ] { file filename }
undo configuration replace server
Default
No parameters are configured for remote configuration rollback.
Views
System view
Predefined user roles
network-admin
Parameters
ftp: Specifies a remote FTP server.
tftp: Specifies a remote TFTP server.
ipv4-address: Specifies the IPv4 address of the remote server.
ipv6 ipv6-address: Specifies the IPv6 address of the remote server.
port port-number: Specifies the TCP port number of the remote server, in the range of 1 to 65535. By default, the FTP port number is 21 and the TFTP port number is 69.
directory directory: Specifies the remote rollback directory. The directory argument is a case-insensitive string. If you do not specify this option, the rollback directory is the root directory of the remote server.
file filename: Specifies the default replacement configuration file for running-configuration remote rollback. The filename argument is a case-insensitive string. The file must be a .cfg file.
Usage guidelines
If you use a remote FTP server, make sure the device is consistent with that FTP server in FTP settings. If a login username and password is configured on the FTP server, you must use the configuration replace server user and configuration replace server password commands to specify that login username and password on the device.
Examples
# Replace the running configuration with the configuration in the archive/ directory of the FTP server at 192.168.1.1.
<Sysname> system-view
[Sysname] configuration replace server ftp 192.168.1.1 port 22 directory /archive/ file my_archive_2017-05-09.cfg
Related commands
configuration replace server file
configuration replace server password
configuration replace server user
display configuration replace server
configuration replace server file
Use configuration replace server file to enable remote configuration rollback.
Use undo configuration replace server file to disable remote configuration rollback.
Syntax
configuration replace server file [ filename ] [ at time [ date ] ]
undo configuration replace server file
Default
Remote configuration rollback is disabled.
Views
System view
Predefined user roles
network-admin
Parameters
filename: Specifies a replacement configuration file by its name, a string of up to 255 characters. The file must be a .cfg file. If you do not specify a replacement configuration file, this command uses the default replacement configuration file specified by using the configuration replace server command for a rollback.
at time: Specifies the time at which the system downloads the replacement configuration file and performs configuration rollback. The time argument is in the format of HH:MM. HH represents the hours, in the range of 0 to 23. MM represents the minutes, in the range of 0 to 59.
date: Specifies the date on which the system downloads the replacement configuration file and performs configuration rollback. This argument is in the format of MM/DD/YYYY or YYYY/MM/DD. YYYY represents the year, in the range of 2000 to 2035. MM represents the month, in the range of 1 to 12. DD represents the day, in the range of 1 to N. The value for N depends on the month.
Usage guidelines
Operating mechanism
This command enables the device to perform the following operations:
1. Downloads the replacement configuration file from the remote rollback server.
2. Saves the downloaded file as a temporary file.
3. Replaces the running configuration with the configuration in the temporary file.
4. Deletes the temporary file after the configuration rollback finishes.
The remote configuration rollback feature replaces the running configuration with the configuration in a remote configuration file without rebooting the device. This operation will cause settings not in the replacement configuration file to be lost.
To perform an immediate configuration rollback, do not specify a rollback time or date. An immediate configuration rollback cannot be canceled.
To schedule a configuration rollback, specify a rollback time and optionally a date. A configuration rollback schedule can be canceled before the specified rollback time.
Restrictions and guidelines
This operation might cause service interruption. When you perform configuration rollback, make sure you fully understand its impact on your network.
When you schedule a rollback, follow these restrictions and guidelines:
· If you specify a rollback date with the rollback time, the specified date must be the same or later than the current system date. If the specified date is the same as the current system date, the specified time must be later than the current system time. After you create the rollback schedule, be careful with changing the system clock backward. The rollback schedule will be canceled automatically if it expires before it could be executed because the system date or time is changed backward.
· If you do not specify a rollback date with the rollback time, the device compares the specified rollback time with the current system time.
¡ If the specified rollback time is later than the current system time, the device performs a rollback at the specified time on the current day.
¡ If the specified rollback time is earlier than the current system time, the device performs a rollback at the specified time on the next day.
If you execute this command multiple times, the most recent configuration takes effect.
If you execute this command without specifying a configuration file, the device will use the default replacement configuration file specified by using the configuration replace server command for rollback.
Examples
# Roll back the running configuration immediately with the specified replacement configuration file on the remote server for configuration rollback.
<Sysname> system-view
[Sysname] configuration replace server file my_archive_2017-05-09.cfg
The running configuration will be lost. Do you want to save the running configuration? [Y/N]: N
Now replacing the running configuration...
Successfully replaced running configuration with file my_archive_2017-05-09.cfg.
Related commands
configuration replace server
configuration replace server password
configuration replace server user
configuration replace server password
Use configuration replace server password to configure the password for accessing the remote FTP server for configuration rollback.
Use undo configuration replace server password to restore the default.
Syntax
configuration replace server password { cipher | simple } string
undo configuration replace server password
Default
No password is configured for accessing the remote FTP server for remote configuration rollback.
Views
System view
Predefined user roles
network-admin
Parameters
cipher: Specifies a password in encrypted form.
simple: Specifies a password in plaintext form. For security purposes, the password specified in plaintext form will be stored in encrypted form.
string: Specifies the password. Its plaintext form is a case-sensitive string of 1 to 63 characters. Its encrypted form is a case-sensitive string of 33 to 117 characters.
Examples
# Set the password to admin in plaintext form for accessing the remote FTP server for configuration rollback.
<Sysname> system-view
[Sysname] configuration replace server password simple admin
Related commands
configuration replace server
configuration replace server file
configuration replace server user
configuration replace server user
Use configuration replace server user to specify the username for accessing the remote FTP server for configuration rollback.
Use undo configuration replace server user to restore the default.
Syntax
configuration replace server user user-name
undo configuration replace server user
Default
No username is configured for accessing the remote FTP server for configuration rollback.
Views
System view
Predefined user roles
network-admin
Parameters
user-name: Specifies the username, a case-sensitive string of 1 to 63 characters.
Usage guidelines
If no username is configured, the username will be anonymous.
Examples
# Set the username to admin for accessing the remote FTP server for configuration rollback.
<Sysname> system-view
[Sysname] configuration replace server user admin
Related commands
configuration replace server
configuration replace server file
configuration replace server password
display configuration replace server
display archive configuration
Use display archive configuration to display configuration archive information.
Syntax
display archive configuration
Views
Any view
Predefined user roles
network-admin
network-operator
Usage guidelines
If you use remote archiving, this command displays configuration archive information on the remote server. If you use local archiving, this command displays configuration archive information on the local device.
Examples
# Display information about the configuration archives. The sample output was created based on local archiving.
<Sysname> display archive configuration
Location: flash:/archive
Filename prefix: my_archive
Archive interval in minutes: 120
Maximum number of archive files: 10
Archive history:
No. TimeStamp FileName
1 Sat Oct 20 22:50:26 2018 my_archive_1.cfg
2 Sat Oct 20 22:50:31 2018 my_archive_2.cfg
# 3 Sat Oct 20 22:50:35 2018 my_archive_3.cfg
The pound sign (#) indicates the most recent archive file.
Next archive file to be saved: my_archive_4.cfg
# Display information about the configuration archives. The sample output was created based on remote archiving.
<Sysname> display archive configuration
Username: test
Location: ftp://192.168.21.21:21/archive
VPN instance: VPN1
Filename prefix: my_archive
Archive interval in minutes: 120
Archive history:
No. TimeStamp FileName
! 1 Thu Oct 18 14:23:51 2018 my_archive_20181018_142351.cfg
! 2 Sat Oct 20 22:46:44 2018 my_archive_20181020_224644.cfg
#! 3 Sat Oct 20 22:46:49 2018 my_archive_20181020_224649.cfg
The exclamation mark (!) indicates that the remote archiving attempt failed.
The pound sign (#) indicates the most recent archive file.
Table 1 Command output
Field |
Description |
Username |
Username for accessing the remote FTP or SCP server that stores the configuration archives. If the remote server is a TFTP server, this field is not available. |
Location |
Absolute path of the directory for saving running-configuration archives. |
VPN instance |
This field is not supported in the current software version. VPN instance to which the remote server belongs. |
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 archiving is disabled, this field is not available. |
Maximum number of archive files |
Maximum number of configuration archives that can be saved on the device. |
Archive history |
History configuration archive information. |
No. |
Number of a configuration archive. |
TimeStamp |
Time when the configuration archive was created. |
Related commands
archive configuration
archive configuration interval
archive configuration location
archive configuration max
archive configuration server
display configuration replace server
Use display configuration replace server to display information about remote configuration rollback.
Syntax
display configuration replace server
Views
Any view
Predefined user roles
network-admin
network-operator
Usage guidelines
The device stores only the most recent 10 remote rollback records.
Examples
# Display information about remote configuration rollback.
<Sysname> display configuration replace server
Username: test
Location: ftp://192.168.21.21:22/test/
VPN instance: VPN1
Next replacement file: my_archive_20180509_143018.cfg
Next replacement time: 22:00 2018/6/12
Replacement history:
No. Time FileName
! 1 20:21:09 2018/10/18 my_archive_20180509_142018.cfg
! 2 20:25:00 2018/10/18 my_archive_20180509_143018.cfg
#! 3 22:52:23 2018/10/20 my_archive_20180509_144018.cfg
The exclamation mark (!) indicates that the remote replacing attempt failed.
The pound sign (#) indicates the most recent replacement file.
Table 2 Command output
Field |
Description |
Username |
Username for accessing the remote server to download a configuration file for configuration rollback. |
Location |
Absolute path of the replacement configuration file. |
VPN instance |
This field is not supported in the current software version. VPN instance to which the remote server belongs. |
Next replacement file |
Configuration file for the next remote configuration rollback. If no remote configuration rollback schedule is waiting for execution, this field is not available. |
Next replacement time |
Time and date for the next remote configuration rollback. If no remote configuration rollback schedule is waiting for execution, this field is not available. |
Replacement history |
Remote configuration rollback history. |
No. |
Number of a configuration rollback. |
Time |
Time and date when the configuration rollback was performed. |
Filename |
Name of the replacement configuration file. |
Related commands
configuration replace server
configuration replace server file
configuration replace server password
configuration replace server user
display current-configuration
Use display current-configuration to display the running configuration.
Syntax
display current-configuration [ configuration [ module-name ] | interface [ interface-type [ interface-number ] ] ] [ by-section { begin | exclude | include } regular-expression ]
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
configuration [ module-name ]: Displays the feature configuration. The module-name argument specifies a feature module. If you do not specify a feature module, the command displays all feature settings you have made.
interface [ interface-type [ interface-number ] ]: Displays interface configuration, where the interface-type argument represents the interface type and the interface-number argument represents the interface number. If you do not specify the interface-type interface-number arguments, the command displays the running configuration for all interfaces. If you specify only the interface-type argument, the command displays the running configuration for all interfaces of this type.
by-section: Displays the running configuration by section. Each section contains the configuration in a command view and two adjacent sections are separated by a pound sign (#). If you do not specify this keyword, the command displays the running configuration by line.
begin: Displays the first configuration section that matches the specified regular expression and all subsequent configuration sections.
exclude: Displays all configuration sections not matching the specified regular expression.
include: Displays all configuration sections matching the specified regular expression.
regular-expression: Specifies a regular expression to filter the configuration sections, a case-sensitive string of 1 to 256 characters. A section matches the specified regular expression if it contains command lines that match the specified regular expression.
Usage guidelines
Application scenarios
Use this command to verify the configuration you have made.
If the system has automatically changed the setting you have made for a parameter, this command displays the effective setting instead of the configured one. An automatic change typically occurs because of system restrictions.
This command does not display parameters that are using the default settings.
Restrictions and guidelines
Examples
# Display local user configuration.
<Sysname> display current-configuration configuration local-user
#
local-user ftp class manage
password hash $h$6$D5A6pqcGpnZXxFUO$OJqnqffG7m1wTH3C6v+FBCjZZBzqgJjTZlbATl1dnKNlYwFMJcWDMbDn8HD1j4XzuKggDp2LrP40kGIOvQGYhQ==
service-type ftp
authorization-attribute user-role network-operator
#
local-user root class manage
password hash $h$6$GcTZyXO04qmom21z$GjeAeDMjP/xtknMLf9NHUNIvebNYR3tkd5aWS6sKbkFh/ECFJZOjh2FVUI0GW7u44fNK6Ke7ANE7dhhAFcytUQ==
service-type ssh telnet terminal
authorization-attribute user-role network-admin
#
return
# Display Ethernet interface configuration.
<Sysname> display current-configuration interface gigabitethernet
#
interface Ten-GigabitEthernet1/0/1
port link-mode route
#
return
# Display the local user configuration.
<Sysname> display current-configuration by-section include local-user
#
local-user ftp
password hash $h$6$GcTZyXO04qmom21z$GjeAeDMjP/xtknMLf9NHUNIvebNYR3tkd5aWS6sKbkFh/ECFJZOjh2FVUI0GW7u44fNK6Ke7ANE7dhhAFcytUQ==
service-type ftp
authorization-attribute user-role network-operator
#
local-user root
password hash $h$6$D5A6pqcGpnZXxFUO$OJqnqffG7m1wTH3C6v+FBCjZZBzqgJjTZlbATl1dnKNlYwFMJcWDMbDn8HD1j4XzuKggDp2LrP40kGIOvQGYhQ==
service-type ssh telnet terminal
authorization-attribute user-role network-admin
#
return
display current-configuration diff
Use display current-configuration diff to display the differences that the running configuration has as compared with the next-startup configuration.
Syntax
display current-configuration diff
Views
Any view
Predefined user roles
network-admin
network-operator
Usage guidelines
This command searches for the next-startup configuration in the following order:
1. The .cfg main next-startup configuration file.
2. The .cfg backup next-startup configuration file if the .cfg main next-startup configuration file is unavailable.
If both configuration files are unavailable, the system displays a message indicating that no next-startup configuration files exist.
Examples
# Display the differences that the running configuration has as compared with the next-startup configuration.
<Sysname> display current-configuration diff
--- Startup configuration
+++ Current configuration
@@ -5,7 +5,7 @@
#
sysname Sysname
#
-alias dhc display history-command
+alias dh display hotkey
<Sysname>
Field |
Description |
- - - A +++ B |
· A represents the source configuration for comparison, which can be Startup configuration, Current configuration, or the name of the source configuration file with its directory information. · B represents the target configuration for comparison, which can be Current configuration, Startup configuration, or the name of the target configuration file with its directory information. In this example, the startup configuration and the current configuration are the source and target, respectively. |
@@ -linenumber1,number1 +linenumber2,number2 @@ |
Location information for identifying the command line differences: · -linenumber1,number1—Source configuration section that contains differences. The linenumber1 argument represents the start line of the section. The number1 argument represents the number of lines between the start line and the end line of the section. · +linenumber2,number2—Target configuration section that contains differences. The linenumber2 argument represents the start line of the section. The number2 argument represents the number of lines between the start line and the end line of the section. |
cmd1 - cmd2 + cmd3 cmd4 |
Displays command differences. · cmd1 and cmd4—Command lines are contained in both source and target configurations if they are not prefixed with a minus (-) or plus (+) sign. They provide a context for locating command line differences. · - cmd2—Command lines are prefixed with a minus sign if they are contained in the source configuration but not in the target configuration. · + cmd3—Command lines are prefixed with a plus sign if they are contained in the target configuration but not in the source configuration. In this example, the sample output shows that the alias dhc display history-command command is contained only in the source configuration, and the alias dh display hotkey command is contained only in the target configuration. |
Related commands
display current-configuration
display diff
display saved-configuration
display default-configuration
Use display default-configuration to display the factory defaults.
Syntax
display default-configuration
Views
Any view
Predefined user roles
network-admin
network-operator
Usage guidelines
Factory defaults are custom basic settings that came with the device. Factory defaults vary by device models and might differ from the initial default settings for the commands.
The device starts up with the factory defaults if no next-startup configuration files are available.
Examples
# Display the factory defaults.
<Sysname> display default-configuration
display diff
Use display diff to display differences between configurations.
Syntax
display diff configfile file-name-s { configfile file-name-d | current-configuration | startup-configuration }
display diff current-configuration { configfile file-name-d | startup-configuration }
display diff startup-configuration { configfile file-name-d | current-configuration }
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
configfile file-name-s: Specifies the source configuration file for comparison.
configfile file-name-d: Specifies the target configuration file for comparison.
current-configuration: Specifies the running configuration. In the display diff current-configuration command, this keyword specifies the source configuration for comparison. In the display diff configfile file-name-s and display diff startup-configuration commands, this keyword specifies the target configuration.
startup-configuration: Specifies the next-startup configuration. In the display diff startup-configuration command, this keyword specifies the source configuration for comparison. In the display diff configfile file-name-s and display diff current-configuration commands, this keyword specifies the target configuration.
Usage guidelines
If you specify the startup-configuration keyword, the system searches for the next-startup configuration in the following order:
1. The .cfg main next-startup configuration file.
2. The .cfg backup next-startup configuration file if the .cfg main next-startup configuration file is unavailable.
If both configuration files are unavailable, the system displays a message indicating that no next-startup configuration files exist.
Examples
# Display the differences between startup.cfg and test.cfg.
<Sysname> display diff configfile startup.cfg configfile test.cfg
--- flash:/startup.cfg
+++ flash:/test.cfg
@@ -5,7 +5,7 @@
#
sysname Sysname
#
-alias dhc display history-command
+alias dh display hotkey
#
system-working-mode standard
<Sysname>
The output shows that the alias dhc display history-command command is contained only in startup.cfg, and the alias dh display hotkey command is contained only in test.cfg.
# Display the differences between the running configuration and the next-startup configuration.
<Sysname> display diff current-configuration startup-configuration
--- Current configuration
+++ Startup configuration
@@ -5,7 +5,7 @@
#
sysname Sysname
#
-alias dhc display history-command
+alias dh display hotkey
#
system-working-mode standard
<Sysname>
The output shows that the alias dhc display history-command command is contained only in the running configuration, and the alias dh display hotkey command is contained only in the next-startup configuration.
For the command output description, see Table 3.
Related commands
display current-configuration
display current-configuration diff
display saved-configuration
display saved-configuration
Use display saved-configuration to display the contents of the configuration file for the next system startup.
Syntax
display saved-configuration [ by-section { begin | exclude | include } regular-expression | filename ]
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
by-section: Displays the configuration used at the next startup by section. Each section contains the configuration in a command view and two adjacent sections are separated by a pound sign (#). If you do not specify this keyword, the command displays the configuration used at the next startup by line.
begin: Displays the first configuration section that matches the specified regular expression and all subsequent configuration sections.
exclude: Displays all configuration sections not matching the specified regular expression.
include: Displays all configuration sections matching the specified regular expression.
regular-expression: Specifies a regular expression to filter the configuration sections, a case-sensitive string of 1 to 256 characters. A section matches the specified regular expression if it contains command lines that match the specified regular expression.
filename: Specifies a configuration file by its path and name, a string of up to 255 characters. The file must be a .cfg file. The file and file path must be valid and on the local system. If you do not specify this argument, the command displays the contents of the configuration file for the next system startup.
Usage guidelines
Application scenarios
Use this command to verify that important settings have been saved to the configuration file for the next system startup.
Operating mechanism
This command selects the configuration file to display in the following order:
1. If the main startup configuration file is available, this command displays the contents of the main startup configuration file.
2. If only the backup startup configuration file is available, this command displays the contents of the backup file.
3. If both the main and backup startup configuration files are not available, this command does not display anything.
Examples
# Display the contents of the configuration file for the next system startup.
<Sysname> display saved-configuration
#
version 7.1.064, ESS 2580
#
sysname WA6526E-Oasis
#
clock timezone Beijing add 08:00:00
#
wlan global-configuration
#
telnet server enable
#
port-security enable
#
dhcp enable
#
dns proxy enable
ip host myap.h3c.com 10.40.94.1
ip host wlan.h3c.com 10.40.94.1
#
lldp global enable
lldp hold-multiplier 8
#
password-recovery enable
#
...
# Display the contents of configuration file test_1.cfg.
<Sysname> display saved-configuration flash:/test_1.cfg
#
version 7.1.070, Release 1201
#
sysname Sysname
#
ftp server enable
#
telnet server enable
#
domain default enable system
#
vlan 1
#
domain system
#
...
Related commands
reset saved-configuration
save
display startup
Use display startup to display the names of the current startup configuration file and the next-startup configuration files.
Syntax
display startup
Views
Any view
Predefined user roles
network-admin
network-operator
Examples
# Display names of 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 4 Command output
Field |
Description |
Current startup saved-configuration file |
Configuration file that the device has started up with. |
Next main startup saved-configuration file |
Primary 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. |
Related commands
startup saved-configuration
display this
Use display this to display the running configuration in the current view.
Syntax
display this [ by-section { begin | exclude | include } regular-expression ]
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
by-section: Displays the running configuration in the current view by section. Each section contains the configuration in a command view and two adjacent sections are separated by a pound sign (#). If you do not specify this keyword, the command displays the running configuration in the current view by line.
begin: Displays the first configuration section that matches the specified regular expression and all subsequent configuration sections.
exclude: Displays all configuration sections not matching the specified regular expression.
include: Displays all configuration sections matching the specified regular expression.
regular-expression: Specifies a regular expression to filter the configuration sections, a case-sensitive string of 1 to 256 characters. A section matches the specified regular expression if it contains command lines that match the specified regular expression.
Usage guidelines
Application scenarios
Use this command to verify the configuration you have made in a certain view.
Restrictions and guidelines
This command does not display parameters that are using the default settings.
Some parameters can be successfully set even if their dependent features are not enabled. For these parameters, this command displays their settings after the dependent features are enabled.
This command can be executed in any user line view to display the running configuration of all user lines.
Examples
# Display the running configuration on Ten-GigabitEthernet 1/0/1.
<Sysname> system-view
[Sysname] interface ten-gigabitethernet 1/0/1
[Sysname-Ten-GigabitEthernet1/0/1] display this
#
interface Ten-GigabitEthernet1/0/1
#
return
reset saved-configuration
Use reset saved-configuration to delete a next-startup configuration file.
Syntax
reset saved-configuration [ backup | main ]
Views
User view
Predefined user roles
network-admin
Parameters
backup: Specifies the backup next-startup configuration file.
main: Specifies the main next-startup configuration file.
Usage guidelines
Application scenarios
If a next-startup configuration file is no longer in use, you can delete it.
Parameter description
If you do not specify a configuration file attribute, the reset saved-configuration command deletes the main next-startup configuration file.
Restrictions and guidelines
CAUTION: This command permanently deletes the specified next-startup configuration file from the device. As a best practice, make sure you have a configuration backup before you use this command. |
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 sets the target file attribute to NULL instead of deleting the file.
Examples
# Delete the main 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.
Related commands
display saved-configuration
restore startup-configuration
Use restore startup-configuration to download a configuration file from a TFTP server and specify it as the main next-startup configuration file.
Syntax
restore startup-configuration from { ipv4-server | ipv6 ipv6-server } src-filename
Views
User view
Predefined user roles
network-admin
Parameters
ipv4-server: Specifies a TFTP server by its IPv4 address or host name. The host name is a case-insensitive string of 1 to 253 characters. Valid characters include letters, digits, hyphens (-), underscores (_), and dots (.).
ipv6 ipv6-server: Specifies a TFTP server by its IPv6 address or host name. The host name is a case-insensitive string of 1 to 253 characters. Valid characters include letters, digits, hyphens (-), underscores (_), and dots (.).
src-filename: Specifies the name of the configuration file to be downloaded. The file must be a .cfg file. The file name is a case-insensitive string of up to 255 characters.
Usage guidelines
Prerequisites
Before restoring the configuration file for the next startup, make sure the following requirements are met:
· The server is reachable.
· The server is enabled with TFTP service.
· You have read and write permissions to the server.
Operating mechanism
Restrictions and guidelines
Examples
# Download test.cfg from the IPv4 TFTP server at 2.2.2.2 in the public network, and specify the file as the main next-startup configuration file.
<Sysname> restore startup-configuration from 2.2.2.2 test.cfg
Restoring the next startup-configuration file from 2.2.2.2...
Done.
# Download test.cfg from the IPv6 TFTP server at 2001::2 in the public network, and specify the file as the main next-startup configuration file.
<Sysname> restore startup-configuration from ipv6 2001::2 test.cfg
Restoring the next startup-configuration file from 2001::2...
Done.
Related commands
backup startup-configuration
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 ] [ changed ] to save the running configuration to a file in the root directory of the storage medium. This command automatically specifies the file as a next-startup configuration file.
Syntax
save file-url
save [ safely ] [ backup | main ] [ force ] [ changed ]
Views
Any view
Predefined user roles
network-admin
Parameters
file-url: Specifies a file path, a string of up to 255 characters. The file must be a .cfg file.
safely: Saves the configuration file in safe mode. If you do not specify this keyword, the device saves the configuration file in fast mode.
backup: Saves the running configuration to a configuration file, and specifies the file as the backup next-startup configuration file. If you do not specify this keyword or the main keyword, the command specifies the saved file as the main next-startup configuration file.
main: Saves the running configuration to a configuration file, and specifies the file as the main next-startup configuration file. If you do not specify this keyword or the backup keyword, the command specifies the saved file as the main next-startup configuration file.
force: Saves the running configuration to the existing next-startup configuration file without prompting for confirmation. If you do not specify this keyword, the system prompts you to confirm the operation. If you do not confirm the 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 target file name during the process.
changed: Overwrites the target configuration file with the running configuration if an inconsistency is detected between the settings in the configuration file and the running configuration. The save command does not take effect if no inconsistency is detected. If you do not specify this keyword, the save command always overwrites the target configuration file with the running configuration.
Usage guidelines
Operating mechanism
This command saves the running configuration to an .mdb binary file as well as a .cfg text file. The two files use the same file name. An .mdb file takes less time to load than a .cfg file.
Restrictions and guidelines
Use the save command with caution. This command will overwrite the settings in the target configuration file. When you execute this command, carefully read the messages displayed by the system and make sure you fully understand the impact of this command on services.
If the file specified for this command does not exist, the system creates the file before saving the configuration. If the file already exists, the system prompts you to confirm whether to overwrite the file. If you choose to not overwrite the file, the system cancels the save operation.
When you use the save [ safely ] [ backup | main ] [ force ] [ changed ] command, follow these guidelines:
· 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, power failure, or out of memory or storage space event occurs during the save operation, the next-startup configuration file is retained.
· In fast mode, the device directly overwrites the target next-startup configuration file. If a reboot, power failure, or out of memory or storage space event occurs during this process, all settings in the next-startup configuration file are lost.
Safe mode is slower than fast mode, but more secure. As a best practice, specify the safely keyword for reliable configuration saving.
Examples
# Save the running configuration to backup.cfg, without specifying the file as a next-startup configuration file.
<Sysname> save backup.cfg
The current configuration will be saved to flash:/backup.cfg. Continue? [Y/N]:y
Now saving current configuration to the device.
Saving configuration flash:/backup.cfg. Please wait...
Configuration is saved to device successfully.
# Save the running configuration to the main next-startup configuration file without any confirmation required.
<Sysname> save force
Validating file. Please wait....
Saved the current configuration to mainboard device successfully.
# Save the running configuration to a file in the root directory of the default storage medium, and specify the file as the main next-startup configuration file.
<Sysname> save
The current configuration will be written to the device. Are you sure? [Y/N]:y
Please input the file name(*.cfg)[flash:/backup.cfg]
(To leave the existing filename unchanged, press the enter key):test.cfg
Validating file. Please wait............
Saved the current configuration to mainboard device successfully.
Related commands
display current-configuration
display saved-configuration
save current-configuration interval
Use save current-configuration interval to enable the automatic configuration saving feature and set the automatic saving interval.
Use undo save current-configuration interval to restore the default.
Syntax
save current-configuration interval interval
undo save current-configuration interval
Default
The automatic configuration saving feature is disabled.
Views
System view
Predefined user roles
network-admin
Parameters
interval: Sets the automatic saving interval, in minutes. The value range is 10 to 525600.
Usage guidelines
Operating mechanism
This feature enables the device to automatically save the running configuration to both the .cfg and .mdb main next-startup configuration files at intervals. At each interval, the device performs an automatic saving operation only if the running configuration contains different settings than the main next-startup configuration files.
If no main next-startup configuration files exist, this feature automatically creates configuration files startup.cfg and startup.mdb to save the running configuration and specifies the files as the main next-startup configuration files.
Operating mechanism
Examples
# Enable the device to automatically save the running configuration to the .cfg and .mdb main next-startup configuration files every 60 minutes.
<Sysname> system-view
[Sysname] save current-configuration interval 60
startup saved-configuration
Use startup saved-configuration to specify a file as a next-startup configuration file.
Use undo startup saved-configuration to configure the system to start up with the factory defaults at the next startup.
Syntax
startup saved-configuration cfgfile [ backup | main ]
undo startup saved-configuration
No next-startup configuration files are specified.
Views
Predefined user roles
network-admin
Parameters
cfgfile: Specifies the path of a configuration file, a string of up to 255 characters. The file must be a .cfg file. The file path can include only the file name, or the storage medium information and file name. If the file is not on the default storage medium, you must specify the file name with storage medium information.
backup: Specifies the configuration file as the backup next-startup configuration file.
main: Specifies the configuration file as the main next-startup configuration file. This is the primary configuration file that the device attempts to load at startup. If the loading attempt fails, the device tries the backup next-startup configuration file.
Usage guidelines
Prerequisites
Recommended configuration
As a best practice, specify different files as the main and backup next-startup configuration files.
Parameter description
If you do not specify the backup or main keyword, the startup saved-configuration command specifies the main next-startup configuration file.
Restrictions and guidelines
The undo startup saved-configuration command changes the file attribute of the main and backup next-startup configuration files to NULL. However, the command does not delete the two configuration files.
You can also specify a configuration file as a next startup file when you use the save command to save the running configuration.
Examples
# Specify the main next-startup configuration file.
<Sysname> startup saved-configuration testcfg.cfg
Please wait ....... Done.
Related commands
display startup