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

01 基础配置命令参考

目录

05-配置文件管理命令

本章节下载 05-配置文件管理命令  (162.35 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/CE3000/CE3000-EI/Command/Command_Manual/H3C_CE3000-32F-EI_CR-Release_1211-6W100/01/201107/721203_30005_0.htm

05-配置文件管理命令


1 配置文件管理命令

1.1  配置文件管理命令

1.1.1  archive configuration

【命令】

archive configuration

【视图】

用户视图

【缺省级别】

3:管理级

【参数】

【描述】

archive configuration命令用来手工备份当前配置。

执行该命令后,系统会将当前的配置以指定的文件名(指定前缀+序号)保存到指定的路径。

需要注意的是:

l              执行archive configuration命令前必须先执行archive configuration location命令来设置备份文件的前缀和保存路径。

l              执行该命令后,只有Master会备份当前配置,Slave不进行备份操作。

【举例】

# 手工备份当前配置。

<Sysname> archive configuration

Warning: Save the running configuration to an archive file. Continue? [Y/N]: Y

Please wait...

Info: The archive configuration file myarchive_1.cfg is saved.

1.1.2  archive configuration interval

【命令】

archive configuration interval minutes

undo archive configuration interval

【视图】

系统视图

【缺省级别】

3:管理级

【参数】

minutes:表示自动备份当前配置的时间间隔,取值范围为10~525600(相当于365天),单位为分钟。

【描述】

archive configuration interval命令用来使能自动备份当前配置功能,并设置自动备份的间隔时间。undo archive configuration interval用来恢复缺省情况。

缺省情况下,系统不会自动备份当前配置。

成功执行本命令后,每隔指定时间(由minutes值决定)系统会把当前配置以指定文件名自动保存到指定路径。

使用该命令时应根据设备存储介质的性能和修改配置的频繁程度来设置minutes参数的具体值:

l              对于不会频繁修改配置的设备,建议按需手动备份当前配置(相关配置可参见命令archive configuration);

l              对于使用低速存储介质的设备,建议不要进行自动备份配置,或设置minutes大于1440(24小时);

l              对于使用高速存储介质,且配置经常修改的设备,可以设置较小的minutes值。

需要注意的是:

l              执行archive configuration interval命令前必须先执行archive configuration location命令来设置备份文件的前缀和保存路径。

l              执行该命令后,只有Master会备份当前配置,Slave不进行备份操作。但本命令会同步给Slave,以便Master变更后,新Master继续定时自动备份配置。

【举例】

# 设置每隔一小时自动备份当前配置。

<Sysname> system-view

[Sysname] archive configuration interval 60

Info: Archive files will be saved every 60 minutes.

1.1.3  archive configuration location

【命令】

archive configuration location directory filename-prefix filename-prefix

undo archive configuration location

【视图】

系统视图

【缺省级别】

3:管理级

【参数】

directory:表示保存备份配置文件的文件夹的路径,为1~63字节的字符串,格式为存储介质名:/[文件夹名]/子文件夹名,不区分大小写。该文件夹必须预先创建好。

filename-prefix:表示备份配置文件的文件名前缀,为1~30字节的字符串,只能包含字母、数字、“_”和“-”,不区分大小写。

【描述】

archive configuration location命令用来设置备份配置文件的保存路径和文件名前缀。undo archive configuration location命令用来恢复缺省情况。

缺省情况下,系统没有设置备份配置文件的保存路径和文件名前缀,也不会定时备份配置。

需要注意的是:

l              自动或手动备份当前配置前必须使用该命令设置备份配置文件的保存路径和文件名前缀。

l              执行undo archive configuration location命令后,用户将不能手工备份当前配置,系统也不再自动备份当前配置,archive configuration intervalarchive configuration max的配置也会恢复到缺省情况,已保存的备份配置文件记录也会被清除。

l              配置备份和配置回滚操作只在Master上执行。为了Master变更后,配置回滚功能能在新Master上继续生效,执行archive configuration location命令会在所有成员设备上同时设置备份配置文件的保存路径和文件名前缀,因此,该命令指定的路径应当在所有成员设备上均存在,且路径参数中不能包含成员编号。

【举例】

# 在flash:/archive目录下备份配置文件,文件名前缀为my_archive。

l              在Master上创建文件夹flash:/archive。

<Sysname> mkdir archive

 

%Created dir flash:/archive.

l              在Slave上创建文件夹flash:/archive(Slave的成员编号为2)。

<Sysname> mkdir slot2#flash:/archive

 

%Created dir slot2#flash:/archive.

l              设置备份配置文件的保存路径和文件名前缀。

<Sysname> system-view

[Sysname] archive configuration location flash:/archive filename-prefix my_archive

1.1.4  archive configuration max

【命令】

archive configuration max file-number

undo archive configuration max

【视图】

系统视图

【缺省级别】

3:管理级

【参数】

file-number:表示可保存的备份配置文件数目上限,取值范围为1~10。该参数的具体数值应根据设备存储介质的空间大小来决定。对于存储空间较小的设备,建议设置file-number为较小值。

【描述】

archive configuration max命令用来设置系统允许保存的备份配置文件的最大数。undo archive configuration max用来恢复缺省情况。

缺省情况下,系统最多允许保存5个备份配置文件。

备份配置文件数目过多会占用系统内存空间,通过该命令可以控制备份配置文件的数目。当备份配置文件数目到达上限后,下次备份配置文件(包括自动和手动两种触发方式)时,将删除保存时间最早的备份文件,以保存新的备份配置文件。修改备份配置文件数上限时并不删除多余文件,如果当前已有的备份配置文件数大于或等于新设置的上限值,则在备份新的配置时,系统将自动删除生成时间最早的(当前已有备份配置文件数-新设置的上限值+1)个备份配置文件。(比如,当前已有备份配置文件数为7,新设置的上限值为4,当有配置需要备份时,系统会先删除“7-4+1=4”个生成时间最早的备份配置文件)

在使用该命令前,必须先执行archive configuration location命令设置保存路径和文件名前缀,否则,本命令执行失败。

需要注意的是,执行undo archive configuration location,系统最多允许保存的备份配置文件数目也会恢复到缺省情况。

【举例】

# 设置系统最大允许保存10个备份配置文件。

<Sysname> system-view

[Sysname] archive configuration max 10

1.1.5  backup startup-configuration

【命令】

backup startup-configuration to dest-addr [ dest-filename ]

【视图】

用户视图

【缺省级别】

2:系统级

【参数】

dest-addrTFTP服务器的IP地址或主机名,不支持IPv6。

dest-filename:目的文件名。在服务器上将以该文件名保存设备的启动配置文件。

【描述】

backup startup-configuration命令用于将设备的下次启动配置文件备份到指定的TFTP服务器。

如果不指定目的文件名,则使用原文件名备份。执行该命令仅对主用下次启动配置文件进行备份。

目前设备通过TFTP传输协议来实现备份操作。

【举例】

# 将设备的下次启动配置文件备份到IP地址为2.2.2.2的TFTP服务器上,文件名为192-168-1-26.cfg。

<Sysname> display startup

MainBoard:

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

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

 Next backup startup saved-configuration file: flash:/startup.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!

<Sysname>

执行以上操作后,设备将文件test.cfg备份到TFTP服务器2.2.2.2上,在服务器上该文件的名称为192-168-1-26.cfg。

1.1.6  configuration replace file

【命令】

configuration replace file filename

【视图】

系统视图

【缺省级别】

3:管理级

【参数】

filename:指定用来回滚配置的配置文件名。

【描述】

configuration replace file命令用来进行配置回滚。

执行本命令后,系统当前配置将恢复到指定配置文件(filename)中的配置状态。

需要注意的是configuration replace file filename命令中指定的配置文件只能是明文配置文件,不能是被加密的配置文件。否则,会导致配置回滚出错。

【举例】

# 将当前配置回滚到配置文件my_archive_1.cfg中的配置状态。

<Sysname> system-view

[Sysname] configuration replace file my_archive_1.cfg

Info: Now replacing the current configuration. Please wait...

Info: Succeeded in replacing current configuration with the file my_archive_1.cfg.

1.1.7  display archive configuration

【命令】

display archive configuration [ | { begin | exclude | include } regular-expression ]

【视图】

任意视图

【缺省级别】

1:监控级

【参数】

|:使用正则表达式对显示信息进行过滤。有关正则表达式的详细介绍,请参见“基础配置指导”中的“CLI”。

begin:从包含指定正则表达式的行开始显示。

exclude:只显示不包含指定正则表达式的行。

include:只显示包含指定正则表达式的行。

regular-expression:表示正则表达式,为1~256个字符的字符串,区分大小写。

【描述】

display archive configuration命令用来显示配置回滚功能的相关信息。

【举例】

# 显示配置回滚功能的相关信息。

<Sysname> display archive configuration

Location: flash:/archive

Filename prefix: my_archive

Archive interval in minutes: 120

Maximum number of archive files: 10

Saved archive files:

  No. TimeStamp              FileName

  1   Aug 05 2007 20:24:54   my_archive_1.cfg

  2   Aug 05 2007 20:34:54   my_archive_2.cfg

# 3   Aug 05 2007 20:44:54   my_archive_3.cfg

‘#’ indicates the most recent archive file.

Next archive file to be saved: my_archive_4.cfg

表1-1 display archive configuration命令显示信息描述表

字段

描述

Location

保存备份配置文件的文件夹的绝对路径

Filename prefix

备份配置文件的文件名前缀

Archive interval in minutes

自动备份配置文件的时间间隔,以分钟为单位

若不自动备份配置文件,不显示此项

Maximum number of archive files

设备可保存的最大备份配置文件数目

Saved archive files

当前已保存的备份配置文件信息

No.

显示已保存的备份配置文件信息的行号

TimeStamp

备份配置文件的保存时间

FileName

备份配置文件名,不包含路径

‘#’ indicates the most recent archive file.

“#”表示该行描述的备份配置文件是最近一次备份的

Next archive file to be saved

下次保存备份配置文件将使用的文件名

 

1.1.8  display current-configuration

【命令】

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

【视图】

任意视图

【缺省级别】

2:系统级

【参数】

configuration [ configuration ]:显示非接口配置。如果不带参数,则显示所有的非接口配置;

interface [ interface-type ] [ interface-number ]:显示接口的配置。interface-type表示接口类型,interface-number表示接口编号。

exclude modules:不显示指定模块的配置。modules表示模块名,可以一次输入多个模块名,模块名之间用空格隔开,形如display current-configuration exclude a b,表示除了a和b模块的内容,其它生效的配置均显示。目前modules支持如下两个取值:

l              acl:表示不显示ACL模块的配置。

l              acl6:表示不显示IPv6 ACL模块的配置。

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

|:使用正则表达式对显示信息进行过滤。有关正则表达式的详细介绍,请参见“基础配置指导”中的“CLI”。

begin:从包含指定正则表达式的行开始显示。

exclude:只显示不包含指定正则表达式的行。

include:只显示包含指定正则表达式的行。

regular-expression:表示正则表达式,为1~256个字符的字符串,区分大小写。

【描述】

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

当用户完成一组配置之后,需要验证是否配置正确,则可以执行display current-configuration命令来查看当前生效的参数。对于某些当前配置的参数,如果与缺省参数相同,则不显示。对于某些参数,虽然用户已经配置,但如果实际生效的参数发生了改变,则显示实际生效的参数,如:在某Loopback接口下配置的“ip address 11.11.11.11 24”,这时,执行display current-configuration后看到的配置为“ip address 11.11.11.11 255.255.255.255”,实际生效的掩码为32位。

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

【举例】

# 查看当前生效的配置中,从包含“user-interface”字符串的行开始到最后一行的配置信息。

<Sysname> display current-configuration | begin user-interface

user-interface aux 0

user-interface vty 0 15

 authentication-mode none

 user privilege level 3

#

return

# 查看当前设备上生效的SNMP配置(该显示信息与设备型号以及用户的当前配置有关)。

<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

 undo snmp-agent trap enable ospf 100

1.1.9  display default-configuration

【命令】

display default-configuration [ | { begin | exclude | include } regular-expression ]

【视图】

任意视图

【缺省级别】

2:系统级

【参数】

|:使用正则表达式对显示信息进行过滤。有关正则表达式的详细介绍,请参见“基础配置指导”中的“CLI”。

begin:从包含指定正则表达式的行开始显示。

exclude:只显示不包含指定正则表达式的行。

include:只显示包含指定正则表达式的行。

regular-expression:表示正则表达式,为1~256个字符的字符串,区分大小写。

【描述】

display default-configuration命令用来显示设备的出厂配置。

使用display default-configuration命令可以查看到使用出厂配置启动设备时所有将执行的命令。

相关配置可参考命令display current-configuration(显示当前生效的配置)和display saved-configuration(显示保存的生效的配置)。

【举例】

# 显示设备的出厂配置(不同型号的设备出厂配置不同,请以设备的实际情况为准,具体显示信息略)。

<Sysname> display default-configuration

#

 domain default enable system

#

 telnet server enable

#

 undo ip redirects

 undo ip ttl-expires

 undo ip unreachables

#

vlan 1

#

radius scheme system

 server-type extended

 primary authentication 127.0.0.1 1645

 primary accounting 127.0.0.1 1646

 user-name-format without-domain

#

domain system

 access-limit disable

 state active

 idle-cut disable

 self-service-url disable

#

interface NULL0

#

interface GigabitEthernet1/0/1

#

interface GigabitEthernet1/0/2

#

interface GigabitEthernet1/0/3

#

interface GigabitEthernet1/0/4

#

interface GigabitEthernet1/0/5

#

interface GigabitEthernet1/0/6

#

interface GigabitEthernet1/0/7

#

interface GigabitEthernet1/0/8

#

interface GigabitEthernet1/0/9

#

interface GigabitEthernet1/0/10

#

interface GigabitEthernet1/0/11

#

interface GigabitEthernet1/0/12

#

interface GigabitEthernet1/0/13

#

interface GigabitEthernet1/0/14

#

interface GigabitEthernet1/0/15

#

interface GigabitEthernet1/0/16

#

interface GigabitEthernet1/0/17

#

interface GigabitEthernet1/0/18

#

interface GigabitEthernet1/0/19

#

interface GigabitEthernet1/0/20

#

interface GigabitEthernet1/0/21

#

interface GigabitEthernet1/0/22

#

interface GigabitEthernet1/0/23

#

interface GigabitEthernet1/0/24

#

interface Ten-GigabitEthernet1/0/25

#

interface Ten-GigabitEthernet1/0/26

#

interface Ten-GigabitEthernet1/0/27

#

interface Ten-GigabitEthernet1/0/28

#

user-interface aux 0

user-interface vty 0 4

#

return

1.1.10  display saved-configuration

【命令】

display saved-configuration [ by-linenum ] [ | { begin | exclude | include } regular-expression ]

【视图】

任意视图

【缺省级别】

2:系统级

【参数】

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

|:使用正则表达式对显示信息进行过滤。有关正则表达式的详细介绍,请参见“基础配置指导”中的“CLI”。

begin:从包含指定正则表达式的行开始显示。

exclude:只显示不包含指定正则表达式的行。

include:只显示包含指定正则表达式的行。

regular-expression:表示正则表达式,为1~256个字符的字符串,区分大小写。

【描述】

display saved-configuration命令用来查看设备存储介质中保存的下次启动配置文件的内容。

可以在管理/维护设备时使用该命令确认重要的配置是否已经保存到下次启动配置文件。

执行该命令将显示下次主用启动配置文件的内容。

如果设备未设置下次启动配置文件,或下次启动配置文件不存在,执行display saved-configuration命令时将没有信息显示。

相关配置可参考命令savereset saved-configuration和“基础配置命令参考/设备管理”中的命令display current-configuration

【举例】

# 显示设备存储介质中保存的下次启动配置文件的内容。

<Sysname> display saved-configuration

#

 version 5.20, Test 5310

#

 sysname Sysname

#

 domain default enable system

#

 telnet server enable

#

 multicast routing-enable

#

vlan 1

#

vlan 999

#

domain system

 access-limit disable

 state active

 idle-cut disable

 self-service-url disable

#

interface NULL0

#

  ---- More ----

以上显示的配置依次是全局配置、端口配置、用户接口配置。“---- More ----”表示这一屏信息已经显示完毕,会暂停显示。按<Enter>键将接着显示下一行信息;按<Space>键将接着显示下一屏信息;按<Ctrl+C>或其它任意键将退出显示。

# 使用行号显示设备存储介质中保存的下次启动配置文件的内容。

<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:   multicast routing-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 ----

“---- More ----”表示这一屏信息已经显示完毕,会暂停显示。按<Enter>键将接着显示下一行信息;按<Space>键将接着显示下一屏信息;按<Ctrl+C>或其它任意键将退出显示。

1.1.11  display startup

【命令】

display startup [ | { begin | exclude | include } regular-expression ]

【视图】

任意视图

【缺省级别】

1:监控级

【参数】

|:使用正则表达式对显示信息进行过滤。有关正则表达式的详细介绍,请参见“基础配置指导”中的“CLI”。

begin:从包含指定正则表达式的行开始显示。

exclude:只显示不包含指定正则表达式的行。

include:只显示包含指定正则表达式的行。

regular-expression:表示正则表达式,为1~256个字符的字符串,区分大小写。

【描述】

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

需要注意的是:

因为Slave是根据Master的当前配置启动和运行的,所以IRF中所有成员设备显示的当前启动配置文件始终是相同的。

l              当Master角色变更后,新的Master没有从配置文件重启而是沿用当前的配置继续运行,所以使用display startup查看时,新Master的当前启动配置文件为NULL,其它Slave的当前启动配置文件和新Master保持一致,也为NULL。

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

【举例】

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

<Sysname> display startup

MainBoard:

 Current startup saved-configuration file: NULL

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

 Next backup startup saved-configuration file: flash:/startup2.cfg

Slot 2:

 Current startup saved-configuration file: NULL

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

 Next backup startup saved-configuration file: flash:/startup2.cfg

表1-2 display startup命令显示信息描述表

字段

描述

MainBoard

Master使用的本次及下次启动的配置文件名

Current startup saved-configuration file

当前启动使用的配置文件

Next main startup saved-configuration file

下一次启动时使用的主用配置文件

Next backup startup saved-configuration file

下一次启动时使用的备用配置文件

Slot 2

Slave(成员编号为2)使用的本次及下次启动的配置文件名

 

1.1.12  display this

【命令】

display this [ by-linenum ] [ | { begin | exclude | include } regular-expression ]

【视图】

任意视图

【缺省级别】

1:监控级

【参数】

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

|:使用正则表达式对显示信息进行过滤。有关正则表达式的详细介绍,请参见“基础配置指导”中的“CLI”。

begin:从包含指定正则表达式的行开始显示。

exclude:只显示不包含指定正则表达式的行。

include:只显示包含指定正则表达式的行。

regular-expression:表示正则表达式,为1~256个字符的字符串,区分大小写。

【描述】

display this命令用来显示当前视图下生效的配置。

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

需要注意以下几点:

l              对于已经生效的配置如果与缺省情况相同,则不显示;

l              对于某些参数,虽然用户已经配置,但如果这些参数所在的功能没有生效,则不显示;

l              在任意一个用户界面视图下执行此命令,将会显示所有用户界面下生效的配置;

l              在任意一个VLAN视图下执行此命令,将会显示所有已创建的VLAN下的配置。

【举例】

# 显示接口GigabitEthernet1/0/1下生效的配置(该显示信息与设备当前的配置有关)。

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] display this

#

interface GigabitEthernet1/0/1

 port link-type hybrid

 undo port hybrid vlan 1

 port hybrid vlan 2 to 4 untagged

 port hybrid pvid vlan 2

#

Return

# 显示所有用户界面下生效的配置(该显示信息与设备当前的配置有关)。

<Sysname> system-view

[Sysname] user-interface vty 0

[Sysname-ui-vty0] display this

#

user-interface aux 0

user-interface vty 0

 history-command max-size 256

user-interface vty 1 15

#

return

1.1.13  reset saved-configuration

【命令】

reset saved-configuration [ backup | main ]

【视图】

用户视图

【缺省级别】

3:管理级

【参数】

backup:删除备用下次启动配置文件。

main:删除主用下次启动配置文件。

【描述】

reset saved-configuration命令用来删除设备存储介质中保存的下次启动配置文件。

需要注意的是:

l              删除操作会将配置文件从所有成员设备上彻底删除,所以请慎用该命令。

l              如果当前设备的主备用下次启动配置文件相同,仅执行一次删除操作,系统只会将相应的下次启动配置文件设置为NULL,但不会删除该文件。

l              reset saved-configurationreset saved-configuration main命令执行效果相同:都会删除主用下次启动配置文件。

l              需要注意的是,执行undo startup saved-configuration命令并重启IRF或IRF中的成员设备时,会导致IRF分裂,请谨慎使用。

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

【举例】

# 删除设备存储介质中保存的下次备用启动配置文件。

<Sysname> reset saved-configuration backup

The saved configuration file will be erased. Are you sure? [Y/N]:y

Configuration file in flash is being cleared.

Please wait ...

..

MainBoard:

 Configuration file is cleared.

Slot 2:

 Erase next configuration file successfully

1.1.14  restore startup-configuration

【命令】

restore startup-configuration from src-addr src-filename

【视图】

用户视图

【缺省级别】

3:管理级

【参数】

src-addr:TFTP服务器的IP地址或名称,不支持IPv6。

src-filename:源文件名指定服务器上将下载的文件的文件名。

【描述】

restore startup-configuration命令用于从指定TFTP服务器上下载配置文件并设置为设备的下次启动配置文件。

l              执行该命令设置的是主用下次启动配置文件。

l              执行该命令会将指定配置文件下载到所有成员设备存储介质的根目录下,并设置为所有成员设备的下次启动配置文件。

如果成员设备上已经存在与源文件同名的文件,则提示用户,由用户选择是否覆盖。另外,检查重名文件或向Slave备份时,均默认Master和Slave使用相同类型的存储介质。向Slave备份时将文件拷贝到Slave上与Master相同的目录下,即根目录下。对于Master和Slave使用不同存储设备的情况,备份操作失败。

【举例】

# 从IP地址为2.2.2.2的TFTP服务器上下载config.cfg文件作为设备的主用下次启动配置文件。

<Sysname> restore startup-configuration from 2.2.2.2 config.cfg

Restore next startup-configuration file from 2.2.2.2. Please wait...finished!

Now restore next startup-configuration file from main to slave board. Please wait...finished!

1.1.15  save

【命令】

save file-url [ all | slot slot-number ]

save [ safely ] [ backup | main ] [ force ]

【视图】

任意视图

【缺省级别】

2:系统级

【参数】

file-url:文件路径,必须以“.cfg”为后缀。当本参数和关键字all或者slot一起使用时,本参数不能包含成员编号,如果路径中包含了文件夹,则必须先在相应的成员设备上创建该文件夹,否则本成员设备上的保存操作将失败。

all将当前配置以指定的名称保存到所有成员设备。

slot slot-number:将当前配置以指定的名称保存到指定Slave。slot-number表示设备在IRF中的成员编号。

safely:以安全模式保存配置文件。如果不指定该参数,表示以快速保存方式保存配置文件。

backup:将当前配置保存到交互方式下指定的文件中,并将该文件设置为备用下次启动配置文件。

main:将当前配置保存到交互方式下指定的文件中,并将该文件设置为主用下次启动配置文件。

force:表示直接将当前配置保存到下次启动配置文件,系统不再输出交互信息。缺省情况下,用户执行save命令,系统要求用户输入<Y>或<N>等参数来确认本次操作,如果在30秒内没有确认,系统会自动退出本次操作。如果在执行save操作时使用了force参数,则系统会直接保存当前配置,不再需要用户输入任何信息。

【描述】

save file-url [ all | slot slot-number ]命令用来将当前配置保存到指定文件,但不会将该文件设置为下次启动配置文件。如果file-url不存在,则系统会先创建该文件,再执行保存操作;不指定allslot参数,则保存到Master上。

save [ safely ] [ backup | main ] [ force ]命令用来将当前配置保存到成员设备存储介质的根目录,并将该文件设置为下次启动配置文件。不指定backupmain参数时,则缺省使用main

执行“save [ safely ] [ backup | main ] [ force ]”或者“save file-url all+回车”操作,是对所有成员设备同时生效还是只对Master生效,与配置文件的同步保存功能是否使能有关。

相关配置可参考命令slave auto-update configreset saved-configurationdisplay current-configurationdisplay saved-configuration

【举例】

# 将当前配置保存到成员设备存储介质的根目录,并将该文件设置为下次启动配置文件。

<Sysname> display startup

MainBoard:

 Current startup saved-configuration file: flash:/aa.cfg

 Next main startup saved-configuration file: flash:/aa.cfg

 Next backup startup saved-configuration file: flash:/

Slot 2:

 Current startup saved-configuration file: flash:/aa.cfg

 Next main startup saved-configuration file: flash:/aa.cfg

 Next backup startup saved-configuration file: flash:/

// 以上显示信息表明IRF中所有成员设备的主用下次启动文件均为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)[flash:/aa.cfg]

(To leave the existing filename unchanged, press the enter key):startup.cfg

flash:/startup.cfg exists, overwrite? [Y/N]:y

 Validating file. Please wait.................

 Saved the current configuration to mainboard device successfully.

Slot 2:

 Save next configuration file successfully

 Configuration is saved to device successfully.

<Sysname> display startup

MainBoard:

 Current startup saved-configuration file: flash:/aa.cfg

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

 Next backup startup saved-configuration file: flash:/

Slot 2:

 Current startup saved-configuration file: flash:/aa.cfg

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

 Next backup startup saved-configuration file: flash:/

// 以上显示信息表明IRF中所有成员设备的主用下次启动文件均已经改为startup.cfg

# 将当前配置保存到Slave(成员编号为2),文件名为test.cfg(方法一)。

<Sysname> save test.cfg slot 2

The current configuration will be saved to slot2#flash:/test.cfg. Continue? [Y/N]:y

Now saving current configuration to the device.

Saving configuration slot2#flash:/test.cfg. Please wait...

.........

Configuration is saved to slot2#flash successfully.

或者可以使用以下命令(方法二):

<Sysname> save slot2#flash:/test.cfg

# 直接将当前配置保存到主用下次启动配置文件,不再进行信息确认。

<Sysname> save force

 Validating file. Please wait.................

 Saved the current configuration to mainboard device successfully.

Slot 2:

 Save next configuration file successfully

 Configuration is saved to device successfully.

1.1.16  slave auto-update config

【命令】

slave auto-update config

undo slave auto-update config

【视图】

系统视图

【缺省级别】

2:系统级

【参数】

【描述】

slave auto-update config命令用来使能配置文件同步保存功能。undo slave auto-update config命令用来关闭配置文件同步保存功能。

缺省情况下,配置文件同步保存功能处于使能状态。

【举例】

# 使能配置文件同步保存功能。

<Sysname> system-view

[Sysname] slave auto-update config

1.1.17  startup saved-configuration

【命令】

startup saved-configuration cfgfile [ backup | main ]

undo startup saved-configuration

【视图】

用户视图

【缺省级别】

3:管理级

【参数】

cfgfile:配置文件的名称,该文件必须是存储介质根目录下、后缀为.cfg的文件。

backup:将配置文件设置为备用下次启动配置文件。

main:将配置文件设置为主用下次启动配置文件。

【描述】

startup saved-configuration命令用来配置所有成员设备的下次启动配置文件(系统下次启动时使用的配置文件)。undo startup saved-configuration命令用来设置所有成员设备以空配置启动(空配置启动指使用设备的出厂配置启动)。

所有成员设备的下次启动配置文件必须是相同的文件,因此,使用本命令前,请确保指定的配置文件已经保存在所有成员设备存储介质的根目录下,否则,操作失败。

需要注意的是,执行undo startup saved-configuration命令并重启IRF或IRF中的成员设备时,会导致IRF分裂,请谨慎使用。

使用该命令设置配置文件时:

l              startup saved-configurationstartup saved-configuration main命令执行效果相同:都是用来配置主用下次启动配置文件。

l              主用下次启动配置文件和备用下次启动配置文件可以设置为同一文件,但为了更可靠,建议设置为不同的文件,或者将一份配置保存在两个不同名的文件中,一个设置为主用,一个设置为备用。

l              在执行undo startup saved-configuration命令之后,系统会将主用/备用下次启动配置文件均设置为NULL,但不会删除该文件。

相关配置可参考命令display startup

【举例】

# 配置下次启动使用的配置文件。

<Sysname> startup saved-configuration testcfg.cfg

Please wait ...

Setting the master board ..........

... Done!

Setting the slave board ...

Slot 2:

 Set next configuration file successfully

 

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

新华三官网
联系我们