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

01-基础配置指导

目录

09-目标配置管理

本章节下载 09-目标配置管理  (240.65 KB)

09-目标配置管理


1 目标配置管理

1.1  目标配置管理简介

进入私有模式系统视图或独占模式系统视图,以及从该视图进入其他视图后,对设备进行的配置为目标配置,在该模式下执行非实时生效的命令行并回车时,命令行不会立即生效,只有执行commit命令后,所有目标配置一起下发。如果目标配置下发成功,则会创建配置回滚点。

私有/独占模式系统视图下具体支持哪些命令,请以设备的实际情况为准。在私有/独占模式系统视图下,执行硬件类相关命令或动作类命令,是立即生效的,不需要再执行commit命令。

进入私有/独占模式系统视图,以及从私有/独占模式系统视图进入其他视图时,命令提示符将以“~”开头,用以提示用户当前视图为私有/独占模式下的相关视图。关于命令行视图的详细介绍,请参见“基础配置命令参考”中的“CLI”。

1.2  下发目标配置

1. 配置限制和指导

目标配置下发成功后,设备会创建配置回滚点。如果短时间内多次执行commit操作,使得设备同时创建多个配置回滚点,导致设备负载过大,有可能使目标配置下发失败,因此请不要频繁的执行commit操作。

2. 配置步骤

(1)     (可选)配置系统最多可创建的回滚点的数量。

a.     进入实时生效系统视图。

system-view

b.     配置系统最多可创建的回滚点的数量。

configuration commit max-number max-number

缺省情况下,系统最多可创建的回滚点的数量为100。

当创建的回滚点数量超过当前配置的回滚点数量时,系统先删除最早的回滚点再保存最新生成的回滚点。

c.     退回用户视图。

quit

(2)     进入独占模式系统视图或私有模式系统视图。

system-view { exclusive | private }

(3)     对设备各功能进行配置。

关于各功能的详细配置,请参见各模块的配置指导。

(4)     (可选)显示目标配置。

display target-configuration

通过执行该命令检查目标配置是否完全正确,以免下发错误目标配置影响当前网络正常运行。

(5)     (可选)更新未提交的目标配置。

refresh target-configuration

(6)     下发目标配置。

commit [ best-effort ] [ force ] [ label labelname ] [ save-running filename ] [ confirmed [ seconds ] | [ minutes minutes ] ] [ show-error ] [ clear-error ] [ description text ]

(7)     (可选)执行配置回滚操作。

configuration replace { file filename | last number | commit-id commit-id | label labelname }

注意

执行本命令后,设备配置将会回滚到指定的配置回滚点的配置,之前的配置将会丢失,请谨慎使用。

 

下发错误目标配置时,执行配置回滚操作,将当前运行配置回滚到下发目标配置前的配置。

关于configuration replace file命令的详细介绍,请参见“基础配置命令参考”中的“配置文件管理”。

1.3  目标配置管理显示和维护

1.3.1  显示和清除回滚点

可在任意视图下执行以下命令:

·     显示回滚点对应配置与当前运行配置或其他回滚点之间的差异。

display configuration commit diff [ at commit-id | last number | since commit-id ]

·     显示回滚点的信息。

display configuration commit list [ number | label ] [ verbose ]

请在用户视图下执行以下命令,清除已创建的回滚点。

reset configuration commit number

注意

删除的回滚点无法恢复,请谨慎使用。

 

1.3.2  显示和清除目标配置

可在私有/独占模式下的任意视图下执行以下命令:

·     显示目标配置。

display target-configuration [ diff | failure [ brief ] | merge | success ]

·     清除目标配置。

reset target-configuration [ command [ text ] ]

注意

删除的目标配置无法恢复,需要用户再次手动配置,请谨慎使用。

 

1.3.3  显示配置会话信息

可在任意视图下执行以下命令,显示CLI、NETCONF、CWMP和SNMP用户的配置会话信息。

display configuration sessions

1.4  目标配置管理典型配置举例

1.4.1  下发目标配置举例

1. 配置需求

在设备上预配置VLAN 100接口,用于局域网VLAN 100内终端的接入。确认VLAN 100接口配置无误后,再下发配置。

2. 配置步骤

# 进入独占模式。

<Sysname> system-view exclusive

# 查看当前目标配置为空。

~[Sysname] display target-configuration

~[Sysname]

# 创建VLAN100,配置VLAN接口的IP地址为3.3.3.4/16。

~[Sysname] vlan 100

~[Sysname-vlan100] quit

~[Sysname] interface vlan-interface 100

~[Sysname-Vlan-interface100] ip address 3.3.3.4 16

~[Sysname-Vlan-interface100] quit

# 查看当前目标配置,验证已有VLAN100的目标配置。

~[Sysname] display target-configuration

vlan 100

interface Vlan-interface100

 ip address 3.3.3.4 16

~[Sysname]

# 通过display interface vlan-interface brief命令查看当前配置未生效。

~[Sysname] display interface vlan-interface brief

Brief information on interfaces in route mode:

Link: ADM - administratively down; Stby - standby

Protocol: (s) - spoofing

Interface                         Link Protocol Primary IP        Description

Vlan1                             UP   UP       169.254.134.177

# 下发目标配置。

~[Sysname]commit

3. 验证配置

# 查看当前目标配置,不再有VLAN100的配置。

~[Sysname] display target-configuration

~[Sysname]

# 通过display interface vlan-interface brief命令查看当前配置已生效。

~[Sysname] display interface vlan-interface brief

Brief information on interfaces in route mode:

Link: ADM - administratively down; Stby - standby

Protocol: (s) - spoofing

Interface                         Link Protocol Primary IP        Description

Vlan1                             UP   UP       169.254.134.177

Vlan100                           DOWN DOWN     3.3.3.4

1.4.2  删除目标配置举例

1. 配置需求

预配置了VLAN 100接口和VLAN 200接口,后发现VLAN 200接口配置多余,删除VLAN 200的预配置后,下发VLAN 100的预配置。

2. 配置步骤

# 进入独占模式。

<Sysname> system-view exclusive

# 查看当前目标配置为空。

~[Sysname] display target-configuration

~[Sysname]

# 创建VLAN 100,配置VLAN接口的IP地址为3.3.3.4/16。

~[Sysname] vlan 100

~[Sysname-vlan100] quit

~[Sysname] interface vlan-interface 100

~[Sysname-Vlan-interface100] ip address 3.3.3.4 16

~[Sysname-Vlan-interface100] quit

# 创建VLAN 200,配置VLAN接口的IP地址为4.4.4.4/16。

~[Sysname] vlan 200

~[Sysname-vlan200] quit

~[Sysname] interface vlan-interface 200

~[Sysname-Vlan-interface200] ip address 4.4.4.4 16

~[Sysname-Vlan-interface200] quit

# 查看当前目标配置,验证已有VLAN100和VLAN200的目标配置。

~[Sysname] display target-configuration

vlan 100

interface Vlan-interface100

 ip address 3.3.3.4 16

vlan 200

interface Vlan-interface200

 ip address 4.4.4.4 16

~[Sysname]

# 通过reset target-configuration command命令删除VLAN200的目标配置。

~[Sysname] reset target-configuration command vlan 200

说明

执行reset target-configuration命令可删除所有目标配置。

 

# 查看当前目标配置,验证已删除VLAN200相关配置。

~[Sysname] display target-configuration

vlan 100

interface Vlan-interface100

 ip address 3.3.3.4 16

~[Sysname]

# 下发目标配置。

~[Sysname] commit

3. 验证配置

# 通过display interface vlan-interface brief命令查看当前配置已生效。

~[Sysname] display interface vlan-interface brief

Brief information on interfaces in route mode:

Link: ADM - administratively down; Stby - standby

Protocol: (s) - spoofing

Interface                         Link Protocol Primary IP        Description

Vlan1                             UP   UP       169.254.134.177

Vlan100                           DOWN DOWN     3.3.3.4

 

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

新华三官网
联系我们