Example for Configuring HVRP
Networking Requirements
In Figure 21-5, switches on the enterprise network are connected through Layer 2 interfaces and constitute a Layer 2 network. STP is used to eliminate loops. SwitchA is the root bridge and the link between SwitchD and SwitchE is blocked. Because enterprise users increase continuously, MAC addresses on the switch cannot meet requirements. The enterprise requires that users increase without switch upgrade.
Configuration Roadmap
HVRP can be used. HVRP dynamically registers and ages VLANs to reserve necessary VLANs. When one or two interfaces exist in a VLAN, the switch can be disabled from learning MAC addresses to reduce the number of learned MAC addresses and increase downstream users connected to the switch. The configuration roadmap is as follows:
Enable STP on switches of the ring network to eliminate loops.
Configure link types of interfaces and VLANs to implement Layer 2 connectivity.
Enable HVRP globally and interfaces so that VLANs are dynamically registered and aged, and the number MAC addresses learned by the switch is reduced.
Procedure
- Enable STP on switches of the ring network. SwitchD is used as an example. The configurations of other devices in the STP ring are similar to the configuration of SwitchD, and are not mentioned here.
<HUAWEI> system-view [HUAWEI] sysname SwitchD [SwitchD] stp enable
- Configure SwitchA as the root device to block the link between SwitchD and SwitchE.
[SwitchA] stp root primary
- Create VLANs, and configure link types of interfaces and add interfaces to VLANs. SwitchD is used as an example. The configurations of other devices in the STP ring are similar to the configuration of SwitchD, and are not mentioned here.
[SwitchD] vlan batch 101 to 500 [SwitchD] interface gigabitethernet 1/0/0 [SwitchD-GigabitEthernet1/0/0] port link-type trunk [SwitchD-GigabitEthernet1/0/0] port trunk allow-pass vlan 101 to 500 [SwitchD-GigabitEthernet1/0/0] quit [SwitchD] interface gigabitethernet 2/0/0 [SwitchD-GigabitEthernet2/0/0] port link-type trunk [SwitchD-GigabitEthernet2/0/0] port trunk allow-pass vlan 101 to 500 [SwitchD-GigabitEthernet2/0/0] quit [SwitchD] interface gigabitethernet 3/0/0 [SwitchD-GigabitEthernet3/0/0] port link-type trunk [SwitchD-GigabitEthernet3/0/0] port trunk allow-pass vlan 101 to 200 [SwitchD-GigabitEthernet3/0/0] quit
- Enable HVRP. SwitchD is used as an example. The configurations of other devices in the STP ring are similar to the configuration of SwitchD, and are not mentioned here.
[SwitchD] hvrp enable [SwitchD] interface gigabitethernet 1/0/0 [SwitchD-GigabitEthernet1/0/0] hvrp enable [SwitchD-GigabitEthernet1/0/0] quit [SwitchD] interface gigabitethernet 2/0/0 [SwitchD-GigabitEthernet2/0/0] hvrp enable [SwitchD-GigabitEthernet2/0/0] quit
- Verify the configuration.
Run the display hvrp verbose command to check detailed information about HVRP.
[SwitchD] display hvrp verbose HVRP is enabled globally. HVRP registervlan timer :5s. HVRP registervlan age timer :15s. HVRP age all VLAN :Disabled. HVRP Permanent-vlan : HVRP statistics on port GigabitEthernet1/0/0 (PORT_LINK_UP) Mstp Role : 0 - designated HVRP statistics on port GigabitEthernet2/0/0 (PORT_LINK_UP) Mstp Role : 0 - root
When the service volume is the same, run the display mac-address command to check the number of learned MAC addresses. After HVRP is configured, the number of learned MAC addresses is reduced, HVRP reduces the number of MAC addresses learned by the switch.
Configuration Files
SwitchA configuration file
# sysname SwitchA # vlan batch 101 to 500 # stp instance 0 root primary # hvrp enable # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 # interface GigabitEthernet3/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # return
SwitchB configuration file
# sysname SwitchB # vlan batch 101 to 500 # hvrp enable # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 301 to 400 # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # interface GigabitEthernet3/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # return
SwitchC configuration file
# sysname SwitchC # vlan batch 101 to 500 # hvrp enable # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 401 to 500 # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # interface GigabitEthernet3/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # return
SwitchD configuration file
# sysname SwitchD # vlan batch 101 to 500 # hvrp enable # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # interface GigabitEthernet3/0/0 port link-type trunk port trunk allow-pass vlan 101 to 200 # return
SwitchE configuration file
# sysname SwitchE # vlan batch 101 to 500 # hvrp enable # interface GigabitEthernet1/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # interface GigabitEthernet2/0/0 port link-type trunk port trunk allow-pass vlan 101 to 500 hvrp enable # interface GigabitEthernet3/0/0 port link-type trunk port trunk allow-pass vlan 201 to 300 # return