配置GVRP示例
组网需求
如图10-10所示,公司A、公司A的分公司以及公司B之间有较多的交换设备相连,需要通过GVRP功能,实现VLAN的动态注册。公司A的分公司与总部通过RouterA和RouterB互通;公司B通过RouterB和RouterC与公司A互通,但只允许公司B配置的VLAN通过。
操作步骤
- 在RouterA上创建VLAN101~VLAN200
<RouterA> system-view [RouterA] vlan batch 101 to 200
- 配置RouterA的GVRP功能
# 全局使能GVRP功能。
[RouterA] gvrp
# 配置接口为Trunk类型,并允许所有VLAN通过。
[RouterA] interface ethernet 2/0/1 [RouterA-Ethernet2/0/1] port link-type trunk [RouterA-Ethernet2/0/1] port trunk allow-pass vlan all [RouterA-Ethernet2/0/1] quit [RouterA] interface ethernet 2/0/2 [RouterA-Ethernet2/0/2] port link-type trunk [RouterA-Ethernet2/0/2] port trunk allow-pass vlan all [RouterA-Ethernet2/0/2] quit
# 使能接口的GVRP功能,并配置接口注册模式。
[RouterA] interface ethernet 2/0/1 [RouterA-Ethernet2/0/1] gvrp [RouterA-Ethernet2/0/1] gvrp registration normal [RouterA-Ethernet2/0/1] quit [RouterA] interface ethernet 2/0/2 [RouterA-Ethernet2/0/2] gvrp [RouterA-Ethernet2/0/2] gvrp registration normal [RouterA-Ethernet2/0/2] quit
RouterB配置与RouterA配置类似,这里不再赘述。
- 配置路由器RouterC
# 创建VLAN101~VLAN200。
<RouterC> system-view [RouterC] vlan batch 101 to 200
# 全局使能GVRP功能。
[RouterC] gvrp
# 配置接口为Trunk类型,并允许所有VLAN通过。
[RouterC] interface ethernet 2/0/1 [RouterC-Ethernet2/0/1] port link-type trunk [RouterC-Ethernet2/0/1] port trunk allow-pass vlan all [RouterC-Ethernet2/0/1] quit [RouterC] interface ethernet 2/0/2 [RouterC-Ethernet2/0/2] port link-type trunk [RouterC-Ethernet2/0/2] port trunk allow-pass vlan all [RouterC-Ethernet2/0/2] quit
# 使能接口的GVRP功能,并配置接口注册模式。
[RouterC] interface ethernet 2/0/1 [RouterC-Ethernet2/0/1] gvrp [RouterC-Ethernet2/0/1] gvrp registration fixed [RouterC-Ethernet2/0/1] quit [RouterC] interface ethernet 2/0/2 [RouterC-Ethernet2/0/2] gvrp [RouterC-Ethernet2/0/2] gvrp registration normal [RouterC-Ethernet2/0/2] quit
- 验证配置结果
# 配置完成后,公司A的分公司用户可以与总部互通,公司A属于VLAN101~VLAN200的用户可以与公司B用户互通。
# 在RouterA上使用命令display gvrp status,查看全局GVRP的使能情况,结果如下:
<RouterA> display gvrp status Info: GVRP is enabled.
# 在RouterA上使用命令display gvrp statistics,查看接口的GVRP统计信息,其中包括:GVRP状态、GVRP注册失败次数、上一个GVRP数据单元源MAC地址和接口GVRP注册类型,结果如下:
<RouterA> display gvrp statistics interface ethernet 2/0/1 GVRP statistics on port Ethernet2/0/1 GVRP status : Enabled GVRP registrations failed : 0 GVRP last PDU origin : 0001-0001-0001 GVRP registration type : Normal
# RouterB和RouterC的查看方法与RouterA类似,这里不再赘述。
配置文件
RouterA的配置文件
# sysname RouterA # vlan batch 101 to 200 # gvrp # interface ethernet2/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # interface ethernet2/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return
RouterB的配置文件
# sysname RouterB # gvrp # interface ethernet2/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # interface ethernet2/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return
RouterC的配置文件
# sysname RouterC # vlan batch 101 to 200 # gvrp # interface ethernet2/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp gvrp registration fixed # interface ethernet2/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return