在对交换机进行VLAN配置的时候,需要在每一台交换机上手工创建该交换机需要涉及的所有VLAN,并且需要手工将交换机上的各个端口加入到相应的VLAN中去。如果交换机和VLAN的数量太多,特别是VLAN的数量又经常变化时,则这种手工配置方式既耗费时间有耗费精力,又非常容易出错。
为此IEEE制定了一个名为GARP(通用属性注册协议)的框架协议,该框架协议包括两个具体的协议:GMRP(组播注册协议)和GVRP(通用VLAN注册协议)。GVRP的主要作用是:自动实现VLAN信息在交换机上的动态注册过程和注销过程;GVRP的应用大大地降低了VLAN配置爱过程中的手工工作背景。
使用方法:
1.在使能(开启)端口的GVRP功能之前,需要先全局使能GVRP功能;
2.配置相关的端口为Trunk,并允许相应的VLAN通过,并且GVRP功能只能配置在Trunk类型的端口上。
GVRP动态注册VLAN过程:
1.在下面的拓扑图中,假设PC1和PC2都被划分到VLAN10,所有的交换机都已经全局使用了GVRP功能,并且相应的端口也使能了GVRP功能,当用户手动在SWI1上创建VLAN10,并且配置swi1的GE0/0/2端口允许属于VLAN 10的帧通过后,swi1的GE0/0/2端口会向外发送VLAN属性的注册报文,swi2的GE0/0/1端口接收到swi1发送过来的VLAN属性的注册报文之后,会自动的创建动态VLAN 10,并将自己的GE0/0/1端口注册到动态VLAN 10中,以此类推,当VLAN属性的单行注册过程完毕之后,只有swi2的GE0/0/1,swi3的GE0/0/2和swi4的GE0/0/2被加入到了动态VLAN 10中。
2.在swi4中手动创建静态VLAN 10,并且配置swi4的GE0/0/2端口允许属于VLAN 10的帧通过后,swi3的GE0/0/1,swi2的GE0/0/2被加入到了动态VLAN 10中。
一:实验拓扑:
二:实验命令:
swi1:
<Huawei>system-view
[Huawei]sysname 1
[1]gvrp
[1]vlan 10
[1-vlan10]quit
[1]int GigabitEthernet 0/0/1
[1-GigabitEthernet0/0/1]port link-type access
[1-GigabitEthernet0/0/1]port default vlan 10
[1-GigabitEthernet0/0/1]quit
[1]int GigabitEthernet 0/0/2
[1-GigabitEthernet0/0/2]port link-type trunk
[1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[1-GigabitEthernet0/0/2]gvrp
[1-GigabitEthernet0/0/2]quit
swi2:
<Huawei>system-view
[Huawei]sysname 2
[2]gvrp
[2]int GigabitEthernet 0/0/1
[2-GigabitEthernet0/0/1]port link-type trunk
[2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[2-GigabitEthernet0/0/1]gvrp
[2-GigabitEthernet0/0/1]quit
[2]int GigabitEthernet 0/0/2
[2-GigabitEthernet0/0/2]port link-type trunk
[2-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[2-GigabitEthernet0/0/2]gvrp
[2-GigabitEthernet0/0/2]quit
swi3:
<Huawei>system-view
[Huawei]sysname 1
[1]sysname 3
[3]gvrp
[3]int GigabitEthernet 0/0/1
[3-GigabitEthernet0/0/1]port link-type trunk
[3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[3-GigabitEthernet0/0/1]gvrp
[3-GigabitEthernet0/0/1]quit
[3]int GigabitEthernet 0/0/2
[3-GigabitEthernet0/0/2]port link-type trunk
[3-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[3-GigabitEthernet0/0/2]gvrp
[3-GigabitEthernet0/0/2]quit
swi4:
<Huawei>system-view
[Huawei]sysname 4
[4]gvrp
[4]vlan 10
[4-vlan10]quit
[4]interface GigabitEthernet 0/0/1
[4-GigabitEthernet0/0/1]port link-type access
[4-GigabitEthernet0/0/1]port default vlan 10
[4-GigabitEthernet0/0/1]quit
[4]int GigabitEthernet 0/0/2
[4-GigabitEthernet0/0/2]port link-type trunk
[4-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[4-GigabitEthernet0/0/2]gvrp
[4-GigabitEthernet0/0/2]quit
三:实验检查:
1.swi1:
通过display gvrp statistics查看端口GVRP统计情况:
[1]display gvrp statistics
GVRP statistics on port GigabitEthernet0/0/2
GVRP status : Enabled
GVRP registrations failed : 0
GVRP last PDU origin : 4c1f-cc66-2a04
GVRP registration type : Normal
GVRP status : Enabled说明swi1的GE0/0/2端口已经使能(开启)了GVRP功能!
通过display vlan summary 查看VLAN信息:
[1]display vlan summary
static vlan:
Total 2 static vlan.
1 10
dynamic vlan:
Total 0 dynamic vlan.
reserved vlan:
Total 0 reserved vlan.
从显示的信息就可以看出,swi1上已经存在动态VLAN10.
swi2:
通过display gvrp statistics查看端口GVRP统计情况:
[2]display gvrp statistics
GVRP statistics on port GigabitEthernet0/0/1
GVRP status : Enabled
GVRP registrations failed : 0
GVRP last PDU origin : 4c1f-cc53-647f
GVRP registration type : Normal
GVRP statistics on port GigabitEthernet0/0/2
GVRP status : Enabled
GVRP registrations failed : 0
GVRP last PDU origin : 4c1f-ccf6-3f96
GVRP registration type : Normal
通过display vlan summary 查看VLAN信息:
[2]display vlan summary
static vlan:
Total 1 static vlan.
1
dynamic vlan:
Total 1 dynamic vlan.
10
reserved vlan:
Total 0 reserved vlan.
swi3:
通过display gvrp statistics查看端口GVRP统计情况:
[3]display gvrp statistics
GVRP statistics on port GigabitEthernet0/0/1
GVRP status : Enabled
GVRP registrations failed : 0
GVRP last PDU origin : 4c1f-ccac-2ded
GVRP registration type : Normal
GVRP statistics on port GigabitEthernet0/0/2
GVRP status : Enabled
GVRP registrations failed : 0
GVRP last PDU origin : 4c1f-cc66-2a04
GVRP registration type : Normal
通过display vlan summary 查看VLAN信息:
[3]display vlan summary
static vlan:
Total 1 static vlan.
1
dynamic vlan:
Total 1 dynamic vlan.
10
reserved vlan:
Total 0 reserved vlan.
swi4:
通过display gvrp statistics查看端口GVRP统计情况:
[4]display gvrp statistics
GVRP statistics on port GigabitEthernet0/0/2
GVRP status : Enabled
GVRP registrations failed : 0
GVRP last PDU origin : 4c1f-ccf6-3f96
GVRP registration type : Normal
通过display vlan summary 查看VLAN信息:
[4]display vlan summary
static vlan:
Total 2 static vlan.
1 10
dynamic vlan:
Total 0 dynamic vlan.
reserved vlan:
Total 0 reserved vlan.
四:ping结果:
当然,在你没有开启GVRP功能之前这两台PC之间也是可以相互ping通的!