GVRP概述
简要介绍GVRP和GARP的基本概念。
为设备配置VLAN的方法通常是手工配置。如 图1所示,Device A上有VLAN2,Device B和Device C上只有VLAN1,三台设备通过Trunk链路连接在一起。如果需要为网络中的所有设备都配置VLAN,就需要网络管理员在每台设备上分别进行手工添加。为了使Device A上VLAN 2的报文可以传到Device C,网络管理员必须在Device B和Device C上分别手工添加VLAN2。
对于上面的组网情况,手工添加VLAN很简单,但是当实际组网复杂到网络管理员无法短时间内了解网络的拓扑结构,或者是整个网络的VLAN太多时,工作量会非常大,而且非常容易配置错误。
GARP VLAN注册协议GVRP(GARP VLAN Registration Protocol)是通用属性注册协议GARP(Generic Attribute Registration Protocol)的一种应用,对于上述情况,用户可以通过GVRP的VLAN自动注册功能完成VLAN的配置。
图1 GVRP应用组网图
缺省配置
支持GVRP的设备都有默认的配置,实际应用的配置可以基于默认配置进行修改。
参数 | 缺省值 |
GVRP功能 | 全局和接口的GVRP功能都处于关闭状态 |
GVRP接口注册模式 | normal |
LeaveAll定时器 | 1000厘秒 |
Hold定时器 | 10厘秒 |
Join定时器 | 20厘秒 |
Leave定时器 | 60厘秒 |
配置GVRP示例
组网需求
如 图1所示,公司A、公司A的分公司以及公司B之间有较多的交换设备相连,需要通过GVRP功能,实现VLAN的动态注册。公司A的分公司与总部通过SwitchA和SwitchB互通;公司B通过SwitchB和SwitchC与公司A互通,但只允许公司B配置的VLAN通过。
图1 配置GVRP的组网图
配置思路
采用如下的思路配置GVRP:
- 使能GVRP功能,实现VLAN的动态注册。
- 公司A的所有交换机配置GVRP功能并配置接口注册模式为Normal,以简化配置。
- 公司B的所有交换机配置GVRP功能并将与公司A相连的接口的注册模式配置为Fixed,以控制只允许公司B配置的VLAN通过。
操作步骤
配置交换机SwitchA
# 全局使能GVRP功能。
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] gvrp
# 配置接口为Trunk类型,并允许所有VLAN通过。
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan all
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] port link-type trunk
[SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan all
[SwitchA-GigabitEthernet0/0/2] quit
# 使能接口的GVRP功能,并配置接口注册模式。
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] gvrp
[SwitchA-GigabitEthernet0/0/1] gvrp registration normal
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] gvrp
[SwitchA-GigabitEthernet0/0/2] gvrp registration normal
[SwitchA-GigabitEthernet0/0/2] quit
- SwitchB配置与SwitchA配置类似,这里不再赘述。
- 配置交换机SwitchC
# 创建VLAN101~VLAN200。
<HUAWEI> system-view
[HUAWEI] sysname SwitchC
[SwitchC] vlan batch 101 to 200
# 全局使能GVRP功能。
[SwitchC] gvrp
# 配置接口为Trunk类型,并允许所有VLAN通过。
[SwitchC] interface gigabitethernet 0/0/1
[SwitchC-GigabitEthernet0/0/1] port link-type trunk
[SwitchC-GigabitEthernet0/0/1] port trunk allow-pass vlan all
[SwitchC-GigabitEthernet0/0/1] quit
[SwitchC] interface gigabitethernet 0/0/2
[SwitchC-GigabitEthernet0/0/2] port link-type trunk
[SwitchC-GigabitEthernet0/0/2] port trunk allow-pass vlan all
[SwitchC-GigabitEthernet0/0/2] quit
- # 使能接口的GVRP功能,并配置接口注册模式。
[SwitchC] interface gigabitethernet 0/0/1
[SwitchC-GigabitEthernet0/0/1] gvrp
[SwitchC-GigabitEthernet0/0/1] gvrp registration fixed
[SwitchC-GigabitEthernet0/0/1] quit
[SwitchC] interface gigabitethernet 0/0/2
[SwitchC-GigabitEthernet0/0/2] gvrp
[SwitchC-GigabitEthernet0/0/2] gvrp registration normal
[SwitchC-GigabitEthernet0/0/2] quit
- 验证配置结果 配置完成后,公司A的分公司用户可以与总部互通,公司A属于VLAN101~VLAN200的用户可以与公司B用户互通。 在SwitchA上使用命令display gvrp status,查看全局GVRP的使能情况,结果如下:
<SwitchA> display gvrp status
Info:GVRP is enabled
- 在SwitchA上使用命令display gvrp statistics,查看接口的GVRP统计信息,其中包括:GVRP状态、GVRP注册失败次数、上一个GVRP数据单元源MAC地址和接口GVRP注册类型,结果如下:
<SwitchA> display gvrp statistics
GVRP statistics on port GigabitEthernet0/0/1
GVRP status : Enabled
GVRP registrations failed : 0
GVRP last PDU origin : 0000-0000-0000
GVRP registration type : Normal
GVRP statistics on port GigabitEthernet0/0/2
GVRP status : Enabled
GVRP registrations failed : 0
GVRP last PDU origin : 0000-0000-0000
GVRP registration type : Normal
- SwitchB和SwitchC的查看方法与SwitchA类似,这里不再赘述。