Chapter 1 Configuration File Management Commands
File path and file
name can be represented in one of the following ways:
l
Universal resource locator (URL) starting with
“unit [No.]>flash:/” ( [No.] represents the unit ID of the switch).
This method is used to specify a file on a specified unit. For example, if the unit
ID of the switch is 1, the URL of the file named text.txt in the root directory
of the switch is unit1>flash:/text.txt;
l
URL starting with “flash:/”. This
method can be used to specify the files saved in the flash of the current unit;
l
Inputting the path name or file name directly.
This method can be used to specify the path to go to or a file in the current
work directory.
1.1.1 display current-configuration
Syntax
display current-configuration [ configuration [ configuration-type ] | interface
[ interface-type ] [ interface-number ] | vlan [ vlan-id
] ] [ by-linenum ] [ | { begin | include | exclude
} regular-expression ]
View
Any view
Parameter
configuration: Displays the specified configuration.
l
configuration-type: Configuration type, It depends
on the specific configuration, which can be one of the following: acl-adv, acl-basic,
acl-ethernetframe, acl-user, hwping, isp, radius-template, system, and
user-interface.
interface:
Displays port configuration.
interface-type: Port/interface type, which can be one of the following: Aux,
Ethernet, GigabitEthernet, Loopback, NULL and VLAN-interface.
interface-number: Port/interface number.
vlan:
Displays VLAN configuration.
vlan-id:
VLAN ID.
by-linenum: Displays
line numbers.
|: Uses a regular
expression to filter the configuration of the device to be displayed.
begin:
Displays the configuration starting with the string specified by the regular-expression
argument.
include:
Displays the configuration including the string specified by the regular-expression
argument.
exclude:
Displays the configuration not including the string specified by the regular-expression
argument.
regular-expression: A regular expression.
Table 1-1 Special characters used in a regular expression
|
Character
|
Meaning
|
Description
|
|
^
|
Matches the strings starting with the
sub-expressions following “^”
|
^user matches configuration files
starting with “user”.
|
|
$
|
Matches the strings starting with the
sub-expressions before “$”
|
user$ matches the configuration ending
with “user”
|
|
_
|
Underline, which can represent the
following characters: (^|$|[,{}]), space, starting character, and ending
character.
|
If the first character of a regular
expression is not “_”, the number of the underline characters in
a regular expression is only limited by the length of a command line.
If the first character of a regular
expression is “_”, there can be up to four other successive
underline characters following it.
If the underline characters are not
successive, only the first underline character group is matched. The subsequent
underline groups are ignored.
|
|
(
|
Left parenthesis, push-in-stack signal
|
You are not recommended to use this
character in a regular expression.
|
|
.
|
Period. A wildcard, it can represent any single
character, including spaces.
|
—
|
|
*
|
Asterisk. It means that the preceding
sub-expression can be matched for zero or multiple times.
|
zo* matches “z” and
“zoo”.
|
|
+
|
Plus sign. It means that the preceding
sub-expression can be matched for one or multiple times.
|
zo+ matches "zo" and
“zoo”, but not "z".
|
Description
Use the display current-configuration
command to display the current configuration of a switch.
Parameters that are the same as the default
are not displayed.
As the display current-configuration
command can be used to view the currently valid parameters, you can use this
command to verify a group of configurations. The configured parameter whose
corresponding function does not take effect is not displayed.
Related command: save, reset
saved-configuration, and display saved-configuration.
Example
# Display the currently valid configuration
parameters of the Ethernet switch.
<H3C> display
current-configuration
#
sysname H3C
#
gvrp
#
MAC-authentication
#
queue-scheduler strict-priority
#
vlan 1
#
interface Vlan-interface1
ip address 192.168.0.39 255.255.255.0
#
interface Aux1/0/0
#
interface Ethernet1/0/1
priority 7
webcache address 1.1.1.1 mac
0000-0000-0001 vlan 1
traffic-limit inbound ip-group 3001
rule 1 640 exceed remark-dscp 4
traffic-priority inbound ip-group
2000 rule 0 dscp ef
line-rate inbound 128
#
interface Ethernet1/0/2
voice vlan enable
#
interface Ethernet1/0/3
port link-type hybrid
port hybrid vlan 1 3 untagged
voice vlan enable
port hybrid
protocol-vlan vlan 3 1
port hybrid protocol-vlan vlan 3 2
#
interface Ethernet1/0/4
mirroring-group 1 monitor-port
#
interface Ethernet1/0/5
port link-type trunk
port trunk permit vlan 1 25
#
interface Ethernet1/0/6
#
interface Ethernet1/0/7
#
interface Ethernet1/0/8
#
interface Ethernet1/0/9
voice vlan enable
#
interface Ethernet1/0/10
port link-type hybrid
port hybrid vlan 1 3 to 4 untagged
port hybrid protocol-vlan vlan 4 0
lacp enable
#
interface Ethernet1/0/11
#
interface Ethernet1/0/12
#
interface Ethernet1/0/13
#
interface Ethernet1/0/14
#
interface Ethernet1/0/15
#
interface Ethernet1/0/16
#
interface Ethernet1/0/17
#
interface Ethernet1/0/18
#
interface Ethernet1/0/19
#
interface Ethernet1/0/20
port access vlan 2
#
interface Ethernet1/0/21
#
interface Ethernet1/0/22
#
interface Ethernet1/0/23
#
interface Ethernet1/0/24
#
interface GigabitEthernet1/1/1
#
interface GigabitEthernet1/1/2
#
interface GigabitEthernet1/1/3
#
interface GigabitEthernet1/1/4
#
interface NULL0
#
user-interface aux 0 4
idle-timeout 0 0
user-interface aux 5 7
user-interface vty 0 4
authentication-mode none
user privilege level 3
set authentication password simple 1
#
return
# Display the lines that include the stings
matching “10*” in the configuration information. (The character “*”
means that the character 0 in the string before it can appear multiple times or
does not appear.)
<H3C> display
current-configuration | include 10*
line-rate inbound 128
vlan 1
interface Vlan-interface1
ip address 192.168.0.39
255.255.255.0
interface Aux1/0/0
interface Ethernet1/0/1
interface Ethernet1/0/2
interface Ethernet1/0/3
port hybrid vlan 1 3 untagged
port hybrid protocol-vlan vlan 3 1
interface Ethernet1/0/4
mirroring-group 1 monitor-port
interface Ethernet1/0/5
port trunk permit vlan 1 25
interface Ethernet1/0/6
interface Ethernet1/0/7
interface Ethernet1/0/8
interface Ethernet1/0/9
interface Ethernet1/0/10
port hybrid vlan 1 3 to 4 untagged
interface Ethernet1/0/11
interface Ethernet1/0/12
interface Ethernet1/0/13
interface Ethernet1/0/14
interface Ethernet1/0/15
interface Ethernet1/0/16
interface Ethernet1/0/17
interface Ethernet1/0/18
interface Ethernet1/0/19
interface Ethernet1/0/20
interface Ethernet1/0/21
interface Ethernet1/0/22
interface Ethernet1/0/23
interface Ethernet1/0/24
interface GigabitEthernet1/1/1
interface GigabitEthernet1/1/2
interface GigabitEthernet1/1/3
interface GigabitEthernet1/1/4
route-policy song permit node 1
set authentication password simple 1
# Display the configuration information starting
with the string “user”.
<H3C> display
current-configuration | include ^user
user-interface aux 0 7
user-interface vty 0 4
Syntax
display saved-configuration
[ unit unit-id ] [ by-linenum ]
View
Any view
Parameter
unit unit-id:
Specifies the unit ID of a switch.
by-linenum:
Displays line numbers.
Description
Use the display saved-configuration
command to display the content of the primary configuration file in the Flash
of a switch.
Related command: save, reset
saved-configuration, and display current-configuration.
Example
# Display the content of the primary configuration
file in the Flash.
<H3C> display
saved-configuration
#
sysname H3C
#
gvrp
#
MAC-authentication
#
vlan 1
#
interface Vlan-interface1
ip address 192.168.0.39
255.255.255.0
#LOCCFG. MUST NOT DELETE
#
interface Aux1/0/0
#
interface Ethernet1/0/1
priority 7
webcache address 1.1.1.1 mac
0000-0000-0001 vlan 1
traffic-limit inbound ip-group 3001
rule 1 640 exceed remark-dscp 4
traffic-priority inbound ip-group
2000 rule 0 dscp ef
line-rate inbound 128
#
interface Ethernet1/0/2
voice vlan enable
#
interface Ethernet1/0/3
port link-type hybrid
port hybrid vlan 1 3 untagged
voice vlan enable
port hybrid
protocol-vlan vlan 3 1
port hybrid protocol-vlan vlan 3 2
#
interface Ethernet1/0/4
mirroring-group 1 monitor-port
#
interface Ethernet1/0/5
port link-type trunk
port trunk permit vlan 1 25
#
interface Ethernet1/0/6
#
interface Ethernet1/0/7
#
interface Ethernet1/0/8
#
interface Ethernet1/0/9
voice vlan enable
#
interface Ethernet1/0/10
port link-type hybrid
port hybrid vlan 1 3 to 4 untagged
port hybrid protocol-vlan vlan 4 0
lacp enable
#
interface Ethernet1/0/11
#
interface Ethernet1/0/12
#
interface Ethernet1/0/13
#
interface Ethernet1/0/14
#
interface Ethernet1/0/15
#
interface Ethernet1/0/16
#
interface Ethernet1/0/17
#
interface Ethernet1/0/18
#
interface Ethernet1/0/19
#
interface Ethernet1/0/20
#
interface Ethernet1/0/21
#
interface Ethernet1/0/22
#
interface Ethernet1/0/23
#
interface Ethernet1/0/24
#
interface GigabitEthernet1/1/1
#
interface GigabitEthernet1/1/2
#
interface GigabitEthernet1/1/3
#
interface GigabitEthernet1/1/4
#TOPOLOGYCFG. MUST NOT DELETE
#
interface NULL0
#
user-interface aux 0 4
idle-timeout 0 0
user-interface aux 5 7
user-interface vty 0 4
authentication-mode none
user privilege level 3
set authentication password simple 1
#
return
The configurations are listed in this order:
global configuration, port configuration, and user interface configuration.
Syntax
display startup
[ unit unit-id ]
View
Any view
Parameter
unit unit-id: Specifies the unit ID of a switch.
Description
Use the display startup command to
display the startup configuration of a switch, including the name of the
current startup configuration file, the names of the primary startup
configuration file and secondary startup configuration file to be used when the
switch starts the next time, and so on.
Related command: startup
saved-configuration.
Example
# Display the startup configuration of unit
1.
<H3C> display startup unit 1
MainBoard:
Current Startup saved-configuration
file: NULL
Next main startup
saved-configuration file: flash:/123.cfg
Next backup startup
saved-configuration file: flash:/back.cfg
Bootrom-access enable
state: enabled
Syntax
display this
[ by-linenum ]
View
Any view
Parameter
by-linenum:
Displays line numbers.
Description
Use the display this command to
display the current configuration performed in the current view. To verify the
configuration performed in a view, you can use this command to display the
parameters that are valid in the current view.
Parameters that are the same as the default
are not displayed. And parameters corresponding to the functions that do not
take effect are not displayed either.
When you execute this command in different
interface views, the configurations performed in the corresponding interfaces are
displayed. When you execute this command in different protocol views, the configurations
performed in the corresponding protocol views are displayed. And when you execute
this command in different protocol sub-views, the configurations performed in
the corresponding protocol sub-views are displayed.
Related command: save, reset saved-configuration,
display saved-configuration, and display current-configuration.
Example
# Display the configuration parameters that
take effect in AUX 0 interface view.
[H3C-ui-aux0] display this
#
user-interface aux 0 4
idle-timeout 0 0
user-interface aux 5 7
user-interface vty 0
authentication-mode none
user privilege level 3
set authentication password simple
123
idle-timeout 0 0
user-interface vty 1 4
authentication-mode none
user privilege level 3
set authentication password simple 1
idle-timeout 0 0
#
return
1.1.5 reset saved-configuration
Syntax
reset saved-configuration
[ backup | main ]
View
User view
Parameter
backup: Specifies
the secondary configuration file.
main: Specifies
the primary configuration file.
Description
Use the reset saved-configuration
command to remove a specified configuration file from the Flash.
If you execute this command with neither the
backup nor the main keyword specified, the primary configuration
file is removed.
The reset saved-configuration
command is usually used when:
l
The configuration files in the Flash are not
compatible with the system software. (This may occur after you upgrade the
software of the switch.)
l
The network where the switch operates changes.
In this case, the existing configuration files may conflict with the new
network. You can remove the existing configuration files and configure the
switch again.
Caution:
l
Execute the reset saved-configuration
command with caution or with the presence of the technicians.
l
Upon powered on, a switch performs initialization
using the default parameters if the Flash contains no configuration file.
l
An error occurs when you execute this command if
the configuration file to be removed does not exist.
Related command: save.
Example
# Remove the primary configuration file to
be used in the next startup.
<H3C> reset saved-configuration
main
The saved configuration will be
erased.
Are you sure?[Y/N]y
Configuration in flash memory is
being cleared.
Please wait ...
....
Unit1 reset saved-configuration
successfully.
1.1.6 save
Syntax
save [ cfgfile
| [ safely ] [ backup | main ] ]
View
Any view
Parameter
cfgfile:
Path name or file name of a configuration file in the Flash, a string comprising
5 to 56 characters.
safely: Saves
the current configuration in the safe mode. Although the saving process in the
safe mode is slow, the configuration can be saved to the Flash even if the
device restarts or is powered off when the saving operation is being processed.
backup: Saves
the configuration to the secondary configuration file.
main: Saves
the configuration to the primary configuration file.
Description
Use the save command to save the
current configuration to a configuration file in the Flash.
If you execute this command with neither the
backup nor the main keyword specified, the current configuration is
saved in the primary configuration file.
The safely keyword determines the
way to save the current configuration, as described in the following.
l
If you execute this command with the safely
keyword not specified, the system saves the current configuration in the fast
mode. In this mode, the configuration gets lost if the device restarts or is
powered off when the saving operation is being processed.
l
If you execute this command with the safely
keyword specified, the system saves the current configuration in the safe mode.
Although this mode takes more time than the fast mode, the configuration can be
saved to the Flash even if the device restarts or is powered off when the
saving operation is being processed.
The fast mode is recommended under the
circumstances where the power systems are reliable, while the safe mode is
recommended when power system is unreliable or you are performing a remote
maintenance operation.
l
If you execute the save command with the cfgfile
argument not specified, the current configuration is saved in the configuration
file with which the device latest starts. If the device starts using the
default configuration, the current configuration is saved in the default
configuration file.
l
To make a switch to adopt the current
configuration when it starts the next time, save the current configuration
using the save command before restarting the switch.
l
The displayed format of the configuration file
is the same as the format in which it is saved.
Example
# Save the current configuration to the primary
configuration file.
<H3C> save main
The configuration will be written to
the device.
Are you
sure?[Y/N]y
Please input the file name(*.cfg)(To
leave the existing filename
unchanged press the enter
key):123.cfg
Now saving current configuration to
the device.
Saving configuration. Please
wait...
............
Unit1 save configuration
flash:/123.cfg successfully
%Apr 2 02:58:01:682 2000 H3C
CFM/3/CFM_LOG:- 1 -Unit1 save configuration
successfully.
# Save the current configuration to 234.cfg
in unit 1.
<H3C> save
unit1>flash:/234.cfg
The current configuration will be
saved to unit1>flash:/234.cfg [Y/N]:y
Now saving current configuration to
the device.
Saving configuration. Please wait...
...........
Unit1 save configuration
unit1>flash:/234.cfg successfully
<H3C>
%Apr 2 04:07:21:805 2000 5500-EI
CFM/3/CFM_LOG:- 1 -Unit1 save configuration successfully.
Syntax
startup saved-configuration
cfgfile [ backup | main ]
undo startup
saved-configuration [ unit unit-id ]
View
User view
Parameter
cfgfile:
Path name or file name of a configuration file in the Flash, a string
comprising 5 to 56 characters. Note that the current configuration file is
saved in the root directory of the Flash, with the extension being .cfg.
backup:
Specifies the configuration file to be the secondary configuration file.
main:
Specifies the configuration file to be the primary configuration file.
unit unit-id: Specifies the unit ID of a switch.
Description
Use the startup saved-configuration
command to specify a configuration file to be the primary configuration file or
the secondary configuration file.
Use the undo startup saved-configuration
command to specify a switch to start without loading the configuration
file.
If you execute the startup saved-configuration
command with neither the backup nor the main keyword specified, the
configuration file identified by the cfgfile argument is specified as
the primary configuration file.
Caution:
To make a switch to start without loading the configuration file, do
not execute the save command after executing the undo startup
saved-configuration command.
Related command: display startup.
Example
# Configure the file named congfig.cfg to
be the main configuration file for the switch to start the next time.
<H3C> startup
saved-configuration congfig.cfg main
Please wait......Done!