配置Trunk和Access
[SW3]int e0/0/1
[SW3-Ethernet0/0/1]p l a
[SW3-Ethernet0/0/1]p d v 10
[SW3-Ethernet0/0/1]int e0/0/2
[SW3-Ethernet0/0/2]p l a
[SW3-Ethernet0/0/2]p d v 10
[SW3-Ethernet0/0/2]int e0/0/3
[SW3-Ethernet0/0/3]p l a
[SW3-Ethernet0/0/3]p d v 20
[SW3-Ethernet0/0/3]int e0/0/4
[SW3-Ethernet0/0/4]p l a
[SW3-Ethernet0/0/4]p d v 20
[SW3-Ethernet0/0/4]int e0/0/5
[SW3-Ethernet0/0/5]p l t
[SW3-Ethernet0/0/5]p t a v a
[SW3-Ethernet0/0/5]int e0/0/6
[SW3-Ethernet0/0/6]p l t
[SW3-Ethernet0/0/6]p t a v a
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]p l t
[SW1-GigabitEthernet0/0/2]p t a v a
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]p l t
[SW2-GigabitEthernet0/0/1]p t a v a
[SW2-GigabitEthernet0/0/1]int g0/0/2
[SW2-GigabitEthernet0/0/2]p l t
[SW2-GigabitEthernet0/0/2]p t a v a
配置mstp
[SW3]stp region-configuration
[SW3-mst-region]region-name topsec.com
[SW3-mst-region]instance 1 vlan 10
[SW3-mst-region]instance 2 vlan 20
[SW3-mst-region]active region-configuration
[SW1]stp mode mstp
[SW1]stp region-configuration
[SW1-mst-region]region-name topsec.com
[SW1-mst-region]instance 1 vlan 10
[SW1-mst-region]instance 2 vlan 20
[SW1-mst-region]active region-configuration
Info: This operation may take a few seconds. Please wait for a moment....done.
[SW1]stp instance 1 root primary
[SW1]stp instance 2 root secondary
[SW2]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]stp mode mstp
[SW2]stp region-configuration
[SW2-mst-region]region-name topsec.com
[SW2-mst-region]instance 1 vlan 10
[SW2-mst-region]instance 2 vlan 20
[SW2-mst-region]active region-configuration
[SW2]stp instance 2 root primary
[SW2]stp instance 1 root secondary
配置vrrp
[SW1]int vlanif 10
[SW1-Vlanif10]ip add 192.168.1.251 24
[SW1-Vlanif10]vrrp vrid 10 virtual-ip 192.168.1.254
[SW1-Vlanif10]int vlanif 20
[SW1-Vlanif20]ip add 172.16.10.251 24
[SW1-Vlanif20]vrrp vrid 20 virtual-ip 172.16.10.254
[SW2]int vlanif 10
[SW2-Vlanif10]ip add 192.168.1.252 24
[SW2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.1.254
[SW2-Vlanif10]int vlanif 20
[SW2-Vlanif20]ip add 172.16.10.252 24
[SW2-Vlanif20]vrrp vrid 20 virtual-ip 172.16.10.254
[SW2-Vlanif20]vrrp vrid 20 priority 200
结果
用vlan10的PC ping .254,并抓包查看
发现SW1的g0/0/1接口可以看到通信,但SW2的g0/0/1接口不可以看到通信
用vlan20的PC ping .254,并抓包查看
发现SW1的g0/0/1接口不可以看到通信,但SW2的g0/0/1接口可以看到通信