华为交换机MSTP+VRRP典型场景实验( 二 )


#配置MSTP,将vlan10 20映射到实例1,将vlan30 40映射到实例2
#将SW1的MSTP设置为实例2的主根,实例1的次根
[SW2] stp mode mstp
[SW2] stp region-configuration
[SW2-mst-region] region-name huawei
[SW2-mst-region] instance 1 vlan 10 20
[SW2-mst-region] instance 2 vlan 30 40
[SW2-mst-region] active region-configuration
[SW2-mst-region] quit
[SW2] stp instance 1 root secondary
[SW2] stp instance 2 root primary
[SW2] stp enable
 
#配置vlanif10、vlanif20、vlanif30、vlanif40
#配置vlanif10、vlanif20、vlanif30、vlanif40,分别加入VRRP组1,2,3,4
#其中SW1为VRRP组3及4的Master,为组1及2的Backup
[SW2] interface Vlanif10
[SW2-vlanif10] ip address 192.168.10.252 255.255.255.0
[SW2-vlanif10] vrrp vrid 1 virtual-ip 192.168.10.254
[SW2] interface Vlanif20
[SW2-vlanif20] ip address 192.168.20.252 255.255.255.0
[SW2-vlanif20] vrrp vrid 2 virtual-ip 192.168.20.254
[SW2] interface Vlanif30
[SW2-vlanif30] ip address 192.168.30.252 255.255.255.0
[SW2-vlanif30] vrrp vrid 3 virtual-ip 192.168.30.254
[SW2-vlanif30] vrrp vrid 3 priority 120
[SW2] interface Vlanif40
[SW2-vlanif40] ip address 192.168.40.252 255.255.255.0
[SW2-vlanif40] vrrp vrid 4 virtual-ip 192.168.40.254
[SW2-vlanif40] vrrp vrid 4 priority 120
完成配置后,各VLAN的用户都能够ping通自己的网关;
我们在SW3上看看:
[SW3] display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/1 DESI FORWARDING NONE
0 GigabitEthernet0/0/2 DESI FORWARDING NONE
0 GigabitEthernet0/0/22 DESI FORWARDING NONE
0 GigabitEthernet0/0/23 DESI FORWARDING NONE
1 GigabitEthernet0/0/1 DESI FORWARDING NONE
1 GigabitEthernet0/0/22 ROOT FORWARDING NONE
1 GigabitEthernet0/0/23 ALTE DISCARDING NONE
2 GigabitEthernet0/0/2 DESI FORWARDING NONE
2 GigabitEthernet0/0/22 ALTE DISCARDING NONE
2 GigabitEthernet0/0/23 ROOT FORWARDING NONE
我们看到,MSTP实例1中被Block掉的端口是GE0/0/23口;MSTP实例2中被Block掉的端口是GE0/0/22,符合我们的需求 。再去SW1上看看VRRP组的状态:
[SW1] display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Master Vlanif10 Normal 192.168.10.254
2 Master Vlanif20 Normal 192.168.20.254
3 Backup Vlanif30 Normal 192.168.30.254
4 Backup Vlanif40 Normal 192.168.40.254
----------------------------------------------------------------
Total:4 Master:2 Backup:2 Non-active:0
从上述输出可以看出,SW1为VRRP组1及组2的Master,同时也为VRRP组3和组4的Backup 。

【华为交换机MSTP+VRRP典型场景实验】


推荐阅读