配置GVRP示例
组网需求
如图8-6所示,公司A和分公司之间通过多台交换设备连接,要求实现分公司跟总公司的互相通信。随着公司业务的扩展,公司A的销售部与公司B的采购部建立起业务关系,现在需要通过GVRP功能实现公司B的采购部(VLAN 100,VLAN 102~VLAN 105)和公司A的销售部(VLAN 100,VLAN 102~VLAN 105)互相通信,由于公司B的其他部门和公司A没有业务关系,不需要互相通信。
配置思路
采用如下的思路配置GVRP:
在SwitchA~SwitchC上均先使能全局GVRP功能,后使能接口GVRP功能,实现VLAN的动态注册。
公司A及分公司的所有交换机配置GVRP功能并配置接口注册模式为Normal,以简化配置。
公司B的所有交换机配置GVRP功能并将与公司A相连的接口的GVRP注册模式配置为Fixed,以控制只允许公司B配置的VLAN通过。
操作步骤
- 配置SwitchA
# 全局使能GVRP功能。
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] gvrp [*SwitchA] commit
# 配置接口10GE1/0/1为Trunk类型,并允许所有VLAN通过,使能接口GVRP功能,注册模式为Normal。
[~SwitchA] interface 10ge 1/0/1 [~SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan all [*SwitchA-10GE1/0/1] gvrp [*SwitchA-10GE1/0/1] gvrp registration normal [*SwitchA-10GE1/0/1] commit [~SwitchA-10GE1/0/1] quit
# 配置接口10GE1/0/2为Trunk类型,并允许所有VLAN通过,使能接口GVRP功能,注册模式为Normal。
[~SwitchA] interface 10ge 1/0/2 [~SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan all [*SwitchA-10GE1/0/2] gvrp [*SwitchA-10GE1/0/2] gvrp registration normal [*SwitchA-10GE1/0/2] commit [~SwitchA-10GE1/0/2] quit
SwitchC的配置与SwitchA相同,不再赘述。
- 配置SwitchB
# 全局使能GVRP功能,创建VLAN 100,VLAN 102~VLAN 105。
<HUAWEI> system-view [~HUAWEI] sysname SwitchB [*HUAWEI] commit [~SwitchB] gvrp [*SwitchB] vlan batch 100 102 to 105 [*SwitchB] commit
# 配置接口10GE1/0/1为Trunk类型,并允许所有VLAN通过,使能接口GVRP功能,注册模式为Fixed。
[~SwitchB] interface 10ge 1/0/1 [~SwitchB-10GE1/0/1] port link-type trunk [*SwitchB-10GE1/0/1] port trunk allow-pass vlan all [*SwitchB-10GE1/0/1] gvrp [*SwitchB-10GE1/0/1] gvrp registration fixed [*SwitchB-10GE1/0/1] commit [~SwitchB-10GE1/0/1] quit
# 配置接口10GE1/0/2为Trunk类型,并允许加入的VLAN通过,使能接口GVRP功能,注册模式为Normal。
[~SwitchB] interface 10ge 1/0/2 [~SwitchB-10GE1/0/2] port link-type trunk [*SwitchB-10GE1/0/2] port trunk allow-pass vlan all [*SwitchB-10GE1/0/2] gvrp [*SwitchB-10GE1/0/2] gvrp registration normal [*SwitchB-10GE1/0/2] commit [~SwitchB-10GE1/0/2] quit
- 验证配置结果
配置完成后,公司A的员工可以与分公司的员工互通。公司A属于VLAN 100,VLAN 102~VLAN 105的员工可以与公司B的员工互通。
在SwitchA上使用命令display gvrp status,查看全局GVRP的使能情况,结果如下:
[~SwitchA] display gvrp status GVRP status: enabled.
在SwitchA上使用命令display gvrp statistics,查看接口的GVRP统计信息,其中包括:GVRP状态、GVRP注册失败次数、上一个GVRP数据单元源MAC地址和接口GVRP注册类型,结果如下:
[~SwitchA] display gvrp statistics GVRP statistics on port 10GE1/0/1 GVRP status : Enabled GVRP registrations failed : 0 GVRP last PDU origin : 0000-0000-0000 GVRP registration type : Normal GVRP statistics on port 10GE1/0/2 GVRP status : Enabled GVRP registrations failed : 0 GVRP last PDU origin : 0000-0000-0000 GVRP registration type : Normal
SwitchB和SwitchC的查看方法与SwitchA类似,这里不再赘述。
配置文件
SwitchA的配置文件
# sysname SwitchA # gvrp # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return
SwitchB的配置文件
# sysname SwitchB # vlan batch 100 102 to 105 # gvrp # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp gvrp registration fixed # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return
SwitchC的配置文件
# sysname SwitchC # gvrp # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return