• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

H3C S3600系列以太网交换机 命令手册-RELEASE 1510(V1.04)

03-配置文件管理命令

本章节下载  (184.59 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S3600/S3600-SI/Command/Command_Manual/S3600-SI_CM(V1.04)/200711/317198_30005_0.htm

03-配置文件管理命令

目  录

第1章 配置文件管理命令... 1-1

1.1 文件属性配置命令.. 1-1

1.1.1 display current-configuration. 1-1

1.1.2 display saved-configuration. 1-6

1.1.3 display startup. 1-9

1.1.4 display this. 1-10

1.1.5 reset saved-configuration. 1-11

1.1.6 save. 1-12

1.1.7 startup saved-configuration. 1-13

 


第1章  配置文件管理命令

&  说明:

用户可以采用下面三种形式来表示文件的路径和名称:

l      如果输入文件的URL形式以“unit [No.]>flash:/”开头([No.]是交换机的Unit ID),则表示指定Unit上的文件。例如,如果交换机的Unit ID为1,交换机根路径下的text.txt文件的URL就是“unit1>flash:/text.txt”;

l      如果输入文件的URL形式以“flash:/”开头,则表示当前Unit的Flash中的文件;

l      如果用户直接输入路径名或者文件名,则表示当前工作路径下的路径或者文件。

 

1.1  文件属性配置命令

1.1.1  display current-configuration

【命令】

display current-configuration [ configuration [ configuration-type ] | interface [ interface-type ] [ interface-number ] | vlan [ vlan-id ] ] [ by-linenum ] [ | { begin | include | exclude } regular-expression ]

【视图】

任意视图

【参数】

configuration:显示指定的配置。

configuration-type:配置类型。根据用户的具体配置而定,可以是acl-advacl-basicacl-ethernetframeacl-user, hwpingispradius-templatesystemuser-interface等。

interface:显示接口的配置。

interface-type:接口类型,可以是Aux、Ethernet、GigabitEthernet、LoopBack、NULL、Vlan-interface。

interface-number:接口编号。

vlan:显示VLAN的配置。

vlan-id:VLAN编号。

by-linenum:显示每一行的编号。

|:使用正则表达式过滤显示设备的配置。

begin:显示以指定文字(regular-expression)开头的配置。

include:显示包含指定文字(regular-expression)的配置。

exclude:显示不含指定文字(regular-expression)的配置。

regular-expression:正则表达式。

表1-1 正则表达式中的特殊字符

特殊字符

含义

使用说明

^

匹配以后面的子表达式开始的字符串

^user匹配以user开始的配置

$

匹配以前面的子表达式开始的字符串

user$匹配以user结尾的配置

_

下划线,类似于一个通配符,可以代表如下字符:

(^|$|[,(){}])、空格、起始符、结束符

如果表达式的第一个字符不是”_”,则对”_”字符的个数不作限制;(受命令行长度的限制)

如果第一个字符是”_”,那么连续的”_”字符个数应小于5个;

如果”_”字符不是连续的,以第一组”_”作为输出信息的过滤规则,对后续的”_”不作处理

(

左括号,程序中代表进栈标志

建议用户不要使用该字符建立正则表达式

.

句点,通配符,匹配任何一个字符,包括空格

-

*

星号,匹配前面的子表达式零次或多次

zo*能匹配 "z" 以及 "zoo"

+

加号,匹配前面的子表达式一次或多次

zo+能匹配"zo"以及"zoo",但不能匹配 "z"

 

【描述】

display current-configuration命令用来显示设备当前的配置。

对于某些当前配置的参数,如果与缺省参数相同,则不显示。

当用户完成一组配置之后,需要验证是否配置正确,则可以执行display current-configuration命令来查看当前生效的参数。对于某些参数,虽然用户已经配置,但如果这些参数对应的功能没有生效,则不予显示。

相关配置可参考命令save,reset saved-configuration,display saved-configuration。

【举例】

# 显示以太网交换机当前生效的配置参数。

<H3C> display current-configuration

#

 sysname H3C

#

 gvrp

#

 MAC-authentication

#

 queue-scheduler strict-priority

#

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

#

 undo irf-fabric authentication-mode

#

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

# 查看配置信息中包含字符串10*的行,“*”表示它前面的“0”可以出现零次或连续多次。

<H3C> display current-configuration | include 10*

line-rate inbound 128

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

# 查看以“user”开始的配置信息。

<H3C> display current-configuration | include ^user

user-interface aux 0

user-interface vty 0 4

1.1.2  display saved-configuration

【命令】

display saved-configuration [ unit unit-id ] [ by-linenum ]

【视图】

任意视图

【参数】

unit unit-id:交换机的Unit ID。

by-linenum:显示每一行的编号。

【描述】

display saved-configuration命令用来显示以太网交换机Flash中的主配置文件。

相关配置可参考命令save,reset saved-configuration,display current-configuration

【举例】

# 显示Flash中的主配置文件。

<H3C>display saved-configuration

#

 sysname H3C

#

 gvrp

#

 MAC-authentication

#

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

#

 undo irf-fabric authentication-mode

#GLBCFG. 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

所列的配置依次是全局配置、端口配置、用户接口配置。

1.1.3  display startup

【命令】

display startup [ unit unit-id ]

【视图】

任意视图

【参数】

unit unit-id:交换机的Unit ID。

【描述】

display startup命令用来显示设备的启动配置信息,包括当前启动的配置文件名、下一次主启动配置文件名和下一次备份启动配置文件名等。

相关配置可参考命令startup saved-configuration

【举例】

# 显示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                   

1.1.4  display this

【命令】

display this [ by-linenum ]

【视图】

任意视图

【参数】

by-linenum:显示每一行的编号。

【描述】

display this命令用来显示系统当前视图的运行配置。当用户在某一视图下完成一组配置之后,需要验证是否配置正确,则可以执行display this命令来查看所在视图下当前生效的参数。

对于某些正在生效的配置参数,如果与缺省配置相同,则不显示;对于某些参数,虽然用户已经配置,但如果这些参数对应的功能没有生效,则不予显示。

在不同接口视图下使用该命令,将直接显示相应接口下的配置;在不同协议视图下使用该命令,将显示相应协议视图的配置;在协议子视图下使用该命令,将显示此协议子视图下的全部配置。

相关配置可参考命令savereset saved-configurationdisplay saved-configurationdisplay current-configuration

【举例】

# 显示系统在AUX 0接口视图下生效的配置参数。

[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

【命令】

reset saved-configuration [ backup | main ]

【视图】

用户视图

【参数】

backup:文件备属性。

main:文件主属性。

【描述】

reset saved-configuration命令用来擦除Flash中的以太网交换机配置文件。

reset saved-configuration命令不使用backupmain参数时,表示擦除Flash中主属性的配置文件。

reset saved-configuration命令一般在以下几种情况使用:

l              以太网交换机软件升级之后,Flash中配置文件可能与新版本软件不匹配,这时可以使用reset saved-configuration命令擦除旧的配置文件。

l              将一台已经使用过的以太网交换机应用于新的环境,原有的配置文件不能适应新环境的需求,需要对以太网交换机重新配置,这时可以擦除原配置文件,重新配置以太网交换机。

  注意:

l      请用户慎用reset saved-configuration命令,最好在技术支持人员指导下使用;

l      以太网交换机在上电初始化时,如果发现Flash中没有配置文件,则采用缺省值进行初始化;

l      如果要被删除的文件不存在,则系统会提示错误信息。

 

相关配置可参考命令save

【举例】

# 删除下次启动时的主配置文件。

<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

【命令】

save [ cfgfile | [ safely ] [ backup | main ] ]

【视图】

任意视图

【参数】

cfgfile:Flash中配置文件的路径名或文件名,长度取值为5~56位字符。

safely:采用安全方式保存配置文件,虽然使用安全模式时速度比较慢,但是若保存过程中出现设备重启动、断电等问题,配置文件仍然会保存到Flash中,不会丢失。

backup:文件备属性。

main:文件主属性。

【描述】

save命令用来把当前配置文件保存到Flash中。

save命令不使用backupmain参数时,表示把当前配置文件保存为主属性。

系统提供两种保存当前配置文件的方式:

l              如果不输入safely参数,系统采用快速保存方式保存配置文件。这种方式保存速度快,但是保存过程中如果出现设备重启动、断电等问题,配置文件会丢失。

l              如果输入safely参数,系统采用安全模式保存配置文件。这种方式保存速度慢,即使保存过程中出现设备重启动、断电等问题,配置文件仍然会保存到Flash中,不会丢失。

在电源稳定程度较好的环境中,推荐用户使用快速保存方式保存配置文件,在电源环境恶劣或者远程维护等情况,推荐用户使用安全模式保存配置文件。

&  说明:

l      保存当前配置文件时,文件名取本次启动配置文件名,如果本次是以缺省配置启动,文件名取设备缺省配置文件名。

l      为了保证设备重启之后能够使用与当前相同的配置,在重启设备之前,建议用户使用save命令保存配置。

l      配置文件的显示格式与保存格式相同。

 

【举例】

# 保存当前运行配置,并作为下次启动时的主配置文件。

<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.                                                                    

# 保存当前运行配置到Unit 1中,配置文件名为234.cfg。

<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.  

1.1.7  startup saved-configuration

【命令】

startup saved-configuration cfgfile [ backup | main ]

undo startup saved-configuration [ unit unit-id ]

【视图】

用户视图

【参数】

cfgfile:Flash中配置文件的路径名或文件名,长度取值为5~56位字符。目前的配置文件以“.cfg”作为扩展名,存放在Flash的根目录下。

backup:文件备属性。

main:文件主属性。

unit unit-id:交换机的Unit ID。

【描述】

startup saved-configuration命令用来配置设备下次启动时使用的配置文件,该配置文件可以是主配置文件或备份配置文件。undo startup saved-configuration命令用来设置设备下次启动时以空配置文件启动。

startup saved-configuration命令不使用backupmain参数时,设备默认设置配置文件的主属性。

如果不输入unit参数,undo startup saved-configuration命令将指定堆叠Fabric中所有设备以空配置启动。用户可以跨设备指定Fabric中某个Unit以空配置启动。

  注意:

如果用户需要设置设备下次启动时以空配置文件启动,则执行完undo startup saved-configuration命令后,不能再执行save命令。

 

相关配置可参考命令display startup。

【举例】

# 设置Fabric的主启动配置文件为config.cfg。

<H3C> startup saved-configuration config.cfg main

Please wait......Done!                                                         

%Apr  2 02:55:10:025 2000 H3C CFM/3/CFM_LOG:- 1 -Unit1 set the configuration

 successfully.                                                                 

<H3C>                                                                       

%Apr  2 02:55:10:134 2000 H3C CFM/3/CFM_LOG:- 1 -Unit2 set the configuration

 successfully.

# 设置Unit 1的备份启动配置文件为123.cfg。

<H3C> startup saved-configuration unit1>flash:/123.cfg backup

Please wait......Done!                                                         

%Apr  2 02:55:54:797 2000 H3C CFM/3/CFM_LOG:- 1 –Unit1 set the configuration

 successfully.                            

 

 

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们