• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 关于我们

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

03-配置文件管理命令

本章节下载  (121.5 KB)

03-配置文件管理命令


第1章  配置文件管理命令

1.1  配置文件管理命令

1.1.1  display current-configuration

【命令】

display current-configuration [ [ controller | interface [ interface-type [ interface-number ] ] | configuration [ configuration ] ] [ | { begin | exclude | include } text ] ] | [ vlan [ vlan-id ] ]

【视图】

任意视图

【参数】

controller:查看controller配置。

interface:查看端口配置。

interface-type:端口类型,可以为Aux、Ethernet、GigabitEthernet、Loopback、NULL、Vlan-interface、M-Ethernet。

interface-number:端口编号。

configuration configuration:查看配置信息,主要指除端口以外的配置信息。configuration取值为交换机的配置的关键字,例如:

l              acl-adv:查看高级访问控制列表的配置。

l              ospf:查看OSPF的配置。

l              system:查看主机名。

l              timerange:查看时间范围的配置。

可选的配置关键字只有配置了相关功能之后才能出现。

vlan [ vlan-id ]:查看系统中VLAN的配置。不使用vlan-id参数表示查看系统中所有VLAN的配置;使用vlan-id参数表示查看指定VLAN的配置。

|:使用正则表达式过滤输出的配置信息。

begin:显示以指定文字开头的配置。

exclude:显示不含指定文字的配置。

include:显示包含指定文字的配置。

text:配置项中包含的文本,用正则表达式表示。

表1-1 正则表达式中的特殊字符含义及使用说明

特殊字符

含义

使用说明

_

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

(^|$|[,(){}])

空格、起始符、结束符

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

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

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

(

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

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

.

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

*

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

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

+

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

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

 

【描述】

display current-configuration命令用来显示交换机当前生效的配置参数。

对于某些正在生效的配置参数,如果与缺省工作参数相同,则不显示。

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

当配置信息比较多时,可以使用正则表达式对输出信息进行过滤。

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

【举例】

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

<H3C> display current-configuration

#

 sysname H3C

#

radius scheme system

 primary authentication 127.0.0.1 1645

 primary accounting 127.0.0.1 1646

 user-name-format without-domain

 

domain system

 radius-scheme system

 access-limit disable

 state active

 idle-cut disable

 

 domain default enable system

#

 local-server nas-ip 127.0.0.1 key h3c

#

 router id 2.2.2.2

#

 stp timer hello 500

#

vlan 1

#

vlan 2

#

interface Vlan-interface1

#

interface Vlan-interface2

 ip address 10.1.1.2 255.255.255.0

#

interface Aux0/0/0

#

interface M-Ethernet0/0/0

#

interface Ethernet3/0/1

 duplex full

 speed 1000

 port access vlan 2

#

interface Ethernet3/0/2

#

interface Ethernet3/0/3

#

interface Ethernet3/0/4

#

interface Ethernet4/0/1

 port access vlan 2

#

interface Ethernet4/0/2

#

interface Ethernet4/0/3

#

interface Ethernet4/0/4

#

interface NULL0

#

ospf

 #

 area 0.0.0.0

  network 10.1.1.0 0.0.0.255

#

user-interface aux 0

user-interface vty 0 4

#

return

# 显示交换机当前生效的VLAN 1上的配置信息。

<H3C> display current-configuration vlan 1

#

vlan 1

 description TestVlan1

 igmp-snooping enable

#

return 

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

<H3C> display current-configuration | include 10*

 primary authentication 127.0.0.1 1645

 primary accounting 127.0.0.1 1646

 local-server nas-ip 127.0.0.1 key h3c

vlan 1

interface Vlan-interface1

 ip address 10.1.1.2 255.255.255.0

interface Ethernet3/0/1

 speed 1000

interface Ethernet4/0/1

  network 10.1.1.0 0.0.0.255

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

<H3C> display current-configuration | include ^user

user-interface aux 0

user-interface vty 0 4

# 查看除端口配置外的配置信息。

<H3C> display current-configuration configuration

#

 sysname H3C

#

radius scheme system

 primary authentication 127.0.0.1 1645

 primary accounting 127.0.0.1 1646

 user-name-format without-domain

 

domain system

 radius-scheme system

 access-limit disable

 state active

 idle-cut disable

 

 domain default enable system

#

 local-server nas-ip 127.0.0.1 key h3c

#

 router id 2.2.2.2

#

 stp timer hello 500

#

ospf

 #

 area 0.0.0.0

  network 10.1.1.0 0.0.0.255

#

user-interface aux 0

user-interface vty 0 4

#

return

1.1.2  display saved-configuration

【命令】

display saved-configuration

【视图】

任意视图

【参数】

【描述】

display saved-configuration命令用来显示保存于交换机的Flash Memory中的配置文件。

如果以太网交换机启动之后不能正常工作,可以执行display saved-configuration命令查看以太网交换机的启动配置。

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

【举例】

# 显示Flash Memory中以太网交换机配置文件。

<H3C> display saved-configuration

#

 sysname H3C

#

radius scheme system

 primary authentication 127.0.0.1 1645

 primary accounting 127.0.0.1 1646

 user-name-format without-domain

 

domain system

 radius-scheme system

 access-limit disable

 state active

 idle-cut disable

 

 domain default enable system

#

 local-server nas-ip 127.0.0.1 key h3c

#

 router id 2.2.2.2

#

 stp timer hello 500

#

vlan 1

#

vlan 2

#

interface Vlan-interface1

#

interface Vlan-interface2

 ip address 10.1.1.2 255.255.255.0

#

interface Aux0/0/0

#

interface M-Ethernet0/0/0

#

interface Ethernet3/0/1

 duplex full

 speed 1000

 port access vlan 2

#

interface Ethernet3/0/2

#

interface Ethernet3/0/3

#

interface Ethernet3/0/4

#

interface Ethernet4/0/1

 port access vlan 2

#

interface Ethernet4/0/2

#

interface Ethernet4/0/3

#

interface Ethernet4/0/4

#

interface NULL0

#

ospf

 #

 area 0.0.0.0

  network 10.1.1.0 0.0.0.255

#

user-interface aux 0

user-interface vty 0 4

#

return

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

1.1.3  display this

【命令】

display this

【视图】

任意视图

【参数】

【描述】

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

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

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

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

【举例】

# 显示系统视图下生效的运行配置参数。

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] display this

#

 sysname H3C

#

 super password level 3 simple 1234567890

#

 ftp server enable

#

 domain default enable system

#

 dhcp-server 2 ip  1.1.1.1

#

 undo info-center enable

#

 router id 1.1.1.1

#

 temperature-limit 0 10 70

 temperature-limit 1 10 70

#

 poe power max-value 2400

#

 loopback-detection interval-time 40

#

 attack-protection

 bridgemactocpu enable

#

 multicast routing-enable

#

return

1.1.4  display startup

【命令】

display startup

【视图】

任意视图

【参数】

【描述】

display startup命令用来显示系统在本次及下次启动的配置文件名。

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

【举例】

# 显示系统在本次及下次启动的配置文件名。

<H3C> display startup

MainBoard:

  Startup saved-configuration file:          flash:/ config.cfg

  Next startup saved-configuration file:     flash:/ config.cfg

1.1.5  reset saved-configuration

【命令】

reset saved-configuration

【视图】

用户视图

【参数】

【描述】

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

请用户慎用该命令,最好在技术支持人员指导下使用。

该命令一般在以下几种情况使用:

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

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

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

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

【举例】

# 擦除Flash Memory中以太网交换机配置文件。

<H3C> reset saved-configuration

The saved configuration will be erased.

Are you sure?[Y/N]y

Configuration in flash memory is being cleared.

Please wait ...

....

Configuration in flash memory is cleared.

1.1.6  save

【命令】

save [ file-name | safely ]

【视图】

用户视图

【参数】

file-name:以“.cfg”为扩展名的文件名,取值为长度为5~56个字符的字符串。

safely:以安全模式把配置文件保存到Flash Memory。

【描述】

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

当用户完成一组配置,并且已经达到预定功能时,请及时将当前配置文件保存到Flash Memory中。

系统提供两种保存方式:

l              快速保存:保存速度快,但是如果保存过程中出现设备重启动、断电等问题,配置文件将会丢失。

l              安全模式保存:保存速度慢,但是即使保存过程中出现设备重启动、断电等问题,配置文件仍然存在,不会受到损坏。

在使用本命令保存配置文件时,如果不输入safely参数,系统采用快速保存方式保存配置文件;如果输入safely参数,系统采用安全模式保存配置文件。

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

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

【举例】

# 将当前配置文件保存到Flash Memory中。

<H3C> save

The configuration will be written to the device.

Are you sure?[Y/N]y

Now saving current configuration to the device.

Saving configuration flash:/ config.cfg. Please wait...

...........

Configuration is saved to flash memory successfully.

1.1.7  startup saved-configuration

【命令】

startup saved-configuration { cfgfile | device-name }

【视图】

用户视图

【参数】

cfgfile:配置文件的文件名,1~64个字符的字符串。

device-name:存储设备名称。

【描述】

startup saved-configuration命令用来配置系统下次启动时使用的配置文件。

目前的配置文件以“.cfg”作为扩展名,存放在存储设备的根目录下。

相关配置可参考命令display startup

【举例】

# 配置下次启动使用的配置文件为config.cfg。

<H3C> startup saved-configuration config.cfg

 

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

新华三官网
联系我们