- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
05-Configuration File Management Commands | 64.03 KB |
Configuration file management commands
The device supports the FIPS mode that complies with NIST FIPS 140-2 requirements. Support for features, commands, and parameters might differ in FIPS mode and non-FIPS mode. For more information about FIPS mode, see Security Configuration Guide.
backup startup-configuration
Use backup startup-configuration to back up the next-startup configuration file to a TFTP server.
Syntax
backup startup-configuration to dest-addr [ dest-filename ]
Views
User view
Default command level
2: System level
Parameters
dest-addr: Specifies a TFTP server's IPv4 address or name, a string of 1 to 20 characters.
dest-filename: Specifies the target file name used for saving the file on the server. The file extension must be .cfg. If you do not specify a target file name, the source file name is used.
Usage guidelines
Before performing this task, make sure the server is reachable, the server is enabled with TFTP service, and you have read and write permissions.
This command is not supported in FIPS mode, because the device does not support TFTP in FIPS mode.
Examples
# Back up the next-startup configuration file to the TFTP server at 2.2.2.2, and set the target file name to 192-168-1-26.cfg.
<Sysname> backup startup-configuration to 2.2.2.2 192-168-1-26.cfg
Backup next startup-configuration file to 2.2.2.2, please wait…finished!
configuration encrypt
Use configuration encrypt to enable configuration encryption.
Use undo configuration encrypt to restore the default.
Syntax
configuration encrypt { private-key | public-key }
undo configuration encrypt
Default
Configuration encryption is disabled. The running configuration is saved to a configuration file without encryption.
Views
System view
Default command level
3: Manage level
Parameters
private-key: Encrypts configuration with a private key. Only the current device can decrypt the encrypted configuration file.
public-key: Encrypts configuration with a public key. Any device that supports the configuration encryption function can decrypt the encrypted configuration file.
Usage guidelines
Configuration encryption enables the device to automatically encrypt a configuration file when saving the current configuration to it.
To view encrypted configuration, use the display saved-configuration command instead of the more command. If you use the more command, the system displays a failure message or garbled text.
Examples
# Enable the public-key method for configuration encryption.
<Sysname> system-view
[Sysname] configuration encrypt public-key
display current-configuration
Use display current-configuration to display the running configuration.
Syntax
display current-configuration [ configuration [ configuration ] | interface [ interface-type [ interface-number ] ] | exclude modules ] [ by-linenum ] [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
2: System level
Parameters
configuration [ configuration ]: Displays feature configuration. The configuration argument specifies a feature module. If no feature module is specified, this command displays all feature settings you have made. Available feature modules depend on your configuration. For example:
· system: Displays the system configuration.
· user-interface: Displays the user interface configuration.
interface [ interface-type [ interface-number ] ]: Displays interface configuration, where interface-type represents the interface type and interface-number represents the interface number.
exclude modules: Excludes the configuration of specific modules. The modules argument can be acl, acl6, or both separated by a space.
· acl: Excludes the IPv4 ACL configuration.
· acl6: Excludes the IPv6 ACL configuration.
by-linenum: Displays the number of each line.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
Use this command to verify the configuration you have made.
Typically, this command does not display parameters that are set to their default settings.
If the system has automatically changed the setting you have made for a parameter, for example, due to a system restriction, this command displays the effective setting rather than the configured one. For example, assign IP address 11.11.11.11 24 to a Loopback interface. However, the display current-configuration command displays 11.11.11.11 255.255.255.255, because the subnet mask for a Loopback interface must be 32 bits, and the system has automatically corrected the subnet mask.
Examples
# Display the configuration from the line containing "user-interface" to the last line in the running configuration.
<Sysname> display current-configuration | begin user-interface
user-interface con 0
user-interface aux 0
user-interface vty 0 4
authentication-mode none
user privilege level 3
#
return
# Display the running SNMP configuration.
<Sysname> display current-configuration | include snmp
snmp-agent
snmp-agent local-engineid 800063A203000FE240A1A6
snmp-agent community read public
snmp-agent community write private
snmp-agent sys-info version all
· display saved-configuration
· reset saved-configuration
· save
display saved-configuration
Use display saved-configuration to display the contents of the configuration file to be used at the next startup.
Syntax
display saved-configuration [ by-linenum ] [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
2: System level
Parameters
by-linenum: Identifies each line of displayed information with a line number.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
Use this command to verify that important settings have been saved to the next-startup configuration file.
If no next-startup configuration file has been specified, or the specified next-startup configuration does not exist, this command displays the error message "The config file does not exist!"
Examples
# Display the next-startup configuration file.
<Sysname> display saved-configuration
#
version 5.20, 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 ----
At the prompt of More, press Enter to display the next line, press Space to display the next screen of configuration, or press Ctrl+C or any other key to stop displaying the configuration.
# Display the next-startup configuration file and number each line.
<Sysname> display saved-configuration by-linenum
1: #
2: version 5.20, 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 ----
· display current-configuration
· reset saved-configuration
· save
display startup
Use display startup to display the current startup configuration file and the next-startup configuration file.
Syntax
display startup [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
Current startup configuration file is the configuration file used at this startup. Next-startup configuration file is the configuration file used at the next startup.
Examples
# Display the startup configuration files.
<Sysname> display startup
Current startup saved-configuration file: cfa0:/testcfg.cfg
Next startup saved-configuration file: cfa0:/testcfg.cfg
Table 1 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. |
(This file does not exist.) |
If the specified next-startup configuration file has been deleted, this comment appears next to the file name. |
startup saved-configuration
display this
Use display this to display the running configuration in the current view.
Syntax
display this [ by-linenum ] [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
1: Monitor level
Parameters
by-linenum: Displays the number of each line.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
Use this command to verify the configuration you have made in a certain view.
Typically, this command does not display parameters that are set to their default settings.
For some parameters that can be successfully configured even if their dependent features are not enabled, this command displays their settings after the dependent features are enabled.
When executed in any user interface view, this command displays the running configuration of all user interfaces.
When executed in any VLAN view, this command displays the running configuration of all VLANs.
Examples
# Display the running configuration on interface GigabitEthernet 1/0/1.
<Sysname> system-view
[Sysname] interface gigabitethernet 1/0/1
[Sysname-GigabitEthernet1/0/1] display this
#
interface GigabitEthernet 1/0/1
port link-type hybrid
undo port hybrid vlan 1
port hybrid vlan 2 to 4 untagged
port hybrid pvid vlan 2
#
return
# Display the running configuration on user interfaces.
<Sysname> system-view
[Sysname] user-interface vty 0
[Sysname-ui-vty0] display this
#
user-interface con 0
user-interface vty 0
history-command max-size 256
user-interface vty 1 4
#
return
reset saved-configuration
Use reset saved-configuration to delete the next-startup configuration file.
Syntax
reset saved-configuration
Views
User view
Default command level
3: Manage level
Usage guidelines
Delete the next-startup configuration file if it does not match the software version or has been corrupted.
Use this command with caution. This command permanently deletes the next-startup configuration file.
Examples
# Delete the next-startup configuration file.
<Sysname> reset saved-configuration
The saved configuration file will be erased. Are you sure? [Y/N]:y
Configuration file in cfa0 is being cleared.
Please wait ...........
Configuration file is cleared.
· display saved-configuration
· save
restore startup-configuration
Use restore startup-configuration to download a configuration file from a TFTP server and specify it as the next-startup configuration file.
Syntax
restore startup-configuration from src-addr src-filename
Views
User view
Default command level
3: Manage level
Parameters
src-addr: Specifies a TFTP server's IPv4 address or name. The server name is a string of 1 to 20 characters.
src-filename: Specifies the file name of the configuration file to be downloaded.
Usage guidelines
Before restoring the configuration file for the next startup, make sure the following requirements are met:
· The server is reachable.
· The server is enabled with TFTP service.
· You have read and write permissions to the server.
This command provides an easy method for configuration file restoration by automatically performing all operations required for restoring the next-startup configuration file.
This command is not supported in FIPS mode, because the device does not support TFTP in FIPS mode.
Examples
# Download test.cfg from the TFTP server at 2.2.2.2, and specify the file as the startup configuration file for the next startup.
<Sysname> restore startup-configuration from 2.2.2.2 test.cfg
Restore next startup-configuration file from 2.2.2.2. Please wait..............
finished!
save
Use save file-url to save the running configuration to a configuration file, without specifying the file as the next-startup configuration file.
Use save [ safely ] [ force ] to save the running configuration to the root directory of the storage medium, and specify the file as the next startup configuration file.
Syntax
save file-url
save [ safely ] [ force ]
Views
Any view
Default command level
2: System level
Parameters
file-url: Specifies a file path, where the file extension must be .cfg.
safely: Saves the configuration file in safe mode. If this keyword is not specified, the system saves the configuration file in fast mode. Safe mode is slower than fast mode, but more secure. In safe mode, the system saves configuration in a temporary file and starts overwriting the target next-startup configuration file after the save operation is complete. If a reboot or power failure occurs during the save operation, the next-startup configuration file is still retained. In fast mode, the device directly overwrites the target next-startup configuration file. If a reboot or power failure occurs during this process, the next-startup configuration file is lost.
force: Saves the running configuration to the next-startup configuration file already specified in the system. Without this keyword, the system asks you to confirm your operation. If you do not confirm your operation within 30 seconds, the system automatically aborts the operation. If you enter Y within the time limit, you can continue the save process and change the next-startup configuration file during this process.
Usage guidelines
If the file specified for file-url does not exist, the system creates the file before saving the configuration.
Examples
# Save the running configuration to test.cfg, without specifying the file as the next-startup configuration file.
<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 to startup.cfg in the root directory of the storage medium, and specify the configuration file as the next-startup configuration file.
<Sysname> display startup
Current startup saved-configuration file: cfa0:/hmr.cfg
Next startup saved-configuration file: cfa0:/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:/hmr.cfg
Next startup saved-configuration file: cfa0:/startup.cfg
The output shows that the next-startup configuration file has changed from aa.cfg to startup.cfg.
# Save the running configuration to the next-startup configuration file without any confirmation required.
<Sysname> save force
Validating file. Please wait....
Configuration is saved to device successfully.
· display current-configuration
· display saved-configuration
· reset saved-configuration
startup saved-configuration
Use startup saved-configuration to specify the configuration file to be used at the next startup.
Use undo startup saved-configuration to configure the system to start up with factory defaults at the next startup.
Syntax
startup saved-configuration cfgfile
undo startup saved-configuration
Views
User view
Default command level
3: Manage level
Parameters
cfgfile: Specifies a configuration file name with the extension .cfg. The file must be stored in the root directory of the storage medium.
Usage guidelines
You can also specify a configuration file as the next-startup configuration file when you use the save command to save the running configuration.
Examples
# Specify the next-startup configuration file.
<Sysname> startup saved-configuration testcfg.cfg
Please wait ....
... Done!
display startup