In Figure 1, company A's headquarters, a branch of company A, and company B are connected using switches. GVRP is enabled to implement dynamic VLAN registration.
The branch of Company A can communicate with Company A's headquarters using SwitchA and SwitchB. Company B can communicate with company A's headquarters using SwitchB and SwitchC. Interfaces connected to company A allow only the VLAN to which Company B belongs to pass.
The configuration roadmap is as follows:
Enable GVRP to implement dynamic VLAN registration.
Configure GVRP on all switches of company A and set the registration mode of the interfaces to normal to simplify configurations.
Configure GVRP on all switches of company A and set the registration mode to fixed for the interfaces connecting to company A to allow only the VLAN to which company B belongs to pass.
Before enabling GVRP, you must configure the VCMP role as transparent or silent.
# Enable GVRP globally.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vcmp role silent [SwitchA] gvrp
# Set the link type of GE 0/0/1 and GE 0/0/2 to trunk and configure the interfaces to allow all VLANs to pass through.
[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
# Enable GVRP and set the registration mode on the interfaces.
[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
The configuration of SwitchB is similar to the configuration of SwitchA, and is not mentioned here.
# Enable GVRP globally.
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] vcmp role silent [SwitchB] gvrp
# Set the link type of GE 0/0/1 and GE 0/0/2 to trunk and configure the interfaces to allow all VLANs to pass through.
[SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] port link-type trunk [SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan all [SwitchB-GigabitEthernet0/0/1] quit [SwitchB] interface gigabitethernet 0/0/2 [SwitchB-GigabitEthernet0/0/2] port link-type trunk [SwitchB-GigabitEthernet0/0/2] port trunk allow-pass vlan all [SwitchB-GigabitEthernet0/0/2] quit
# Enable GVRP and set the registration mode on the interfaces.
[SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] gvrp [SwitchB-GigabitEthernet0/0/1] gvrp registration normal [SwitchB-GigabitEthernet0/0/1] quit [SwitchB] interface gigabitethernet 0/0/2 [SwitchB-GigabitEthernet0/0/2] gvrp [SwitchB-GigabitEthernet0/0/2] gvrp registration normal [SwitchB-GigabitEthernet0/0/2] quit
# Create VLAN 101 to VLAN 200.
<HUAWEI> system-view [HUAWEI] sysname SwitchC [SwitchC] vlan batch 101 to 200
# Enable GVRP globally.
[SwitchC] vcmp role silent
[SwitchC] gvrp
# Set the link type of GE 0/0/1 and GE 0/0/2 to trunk and configure the interfaces to allow all VLANs to pass through.
[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
# Enable GVRP and set the registration mode on the interfaces.
[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
After the configuration is complete, the branch of Company A can communicate with the headquarters, and users of Company A in VLAN 101 to VLAN 200 can communicate with users in Company B.
Run the display gvrp statistics command on SwitchA to view GVRP statistics on GVRP interfaces, including the GVRP state of each interface, number of GVRP registration failures, source MAC address of the last GVRP PDU, and registration mode of each interface.
[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 Info: GVRP is disabled on one or moreports.
Verify the configurations of SwitchB and SwitchC in the same way.
SwitchA configuration file
# sysname SwitchA # vcmp role silent # gvrp # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return
SwitchB configuration file
# sysname SwitchB # vcmp role silent # gvrp # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return
SwitchC configuration file
# sysname SwitchC # vcmp role silent # vlan batch 101 to 200 # gvrp # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp gvrp registration fixed # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 2 to 4094 gvrp # return