華為
拓撲圖

LSW3上的配置
先建立vlan10、20
vlan batch 10 20
然後在接口下劃分trunk、access模式
interface Ethernet0/0/1
port link-type access
port default vlan 10
interface Ethernet0/0/2
port link-type access
port default vlan 20
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
interface Ethernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
配置mstp
stp mode mstp
stp region-configuration
region-name liu
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
驗證
dis stp instance 10 bri
LSW1上的配置
先建立vlan10、20
vlan batch 10 20
配置鍊路聚合和trunk口
interface Eth-Trunk1
trunkport int g0/0/1
trunkport int g0/0/2
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
配置mstp
stp mode mstp
stp region-configuration
region-name liu
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
stp instance 10 root primary
stp instance 20 root secondary
配置VRRP
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 120
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 100
驗證
dis vrrp bri
LSW2上的配置
先建立vlan10、20
vlan batch 10 20
配置鍊路聚合和trunk口
interface Eth-Trunk1
trunkport int g0/0/1
trunkport int g0/0/2
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
配置mstp
stp mode mstp
stp region-configuration
region-name liu
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
stp instance 20 root primary
stp instance 10 root secondary
配置VRRP
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 120
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 100
思科
SW3上的配置
先建立vlan10,20
vlan 10
vlan 20
然後在接口下劃分trunk、access模式
interface Ethernet0/3
switchport mode access
switchport access vlan 10
interface Ethernet1/0
switchport mode access
switchport access vlan 20
int range e0/1 , e0/2
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20
配置mstp
spanning-tree mode mstp
spanning-tree mst configuration
name liu
revision 123
instance 10 vlan 10
instance 20 vlan 20
驗證
show spanning-tree mst 1
SW1上的配置
先建立vlan10,20
vlan 10
vlan 20
配置鍊路聚合和trunk口
interface range e0/2 , e0/0 , e0/1
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20
interface range e0/2 , e0/0
channel-group 1 mode on
驗證
show int port-channel 1
配置mstp
spanning-tree mode mstp
spanning-tree mst configuration
name liu
revision 123
instance 10 vlan 10
instance 20 vlan 20
spanning-tree mst 10 root primary
spanning-tree mst 20 root sec
配置vrrp
interface Vlan10
ip address 192.168.10.253 255.255.255.0
vrrp 10 ip 192.168.10.254
vrrp 10 priority 200
interface Vlan20
ip address 192.168.20.252 255.255.255.0
vrrp 20 ip 192.168.20.254
vrrp 20 priority 100
驗證
show vrrp bri
SW2上的配置
先建立vlan10,20
vlan 10
vlan 20
配置鍊路聚合和trunk口
interface range e0/2 , e0/0 , e0/1
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20
interface range e0/2 , e0/0
channel-group 1 mode on
驗證
show int port-channel 1
配置mstp
spanning-tree mode mstp
spanning-tree mst configuration
name liu
revision 123
instance 10 vlan 10
instance 20 vlan 20
spanning-tree mst 20 root primary
spanning-tree mst 10 root sec
配置vrrp
interface Vlan20
ip address 192.168.20.253 255.255.255.0
vrrp 20 ip 192.168.20.254
vrrp 20 priority 200
interface Vlan10
ip address 192.168.10.252 255.255.255.0
vrrp 10 ip 192.168.10.254
vrrp 10 priority 100
驗證
show vrrp bri
注意
如果SW1有上行接口和上行鍊路時,其中一個發生故障,VRRP預設是無法感覺的,即主備狀态無法切換,資料包無法發送出去,這是就要用到track功能
華為track的配置
vrrp 10 track int g0/0/3 reduced 30
配置完這條指令之後,即當g0/0/3或者其上行鍊路發生故障時,其優先級減少30,然後目前優先級小于Backup狀态的三層交換機,則主備狀态發生切換
思科track的配置
vrrp 10 track 1 decrement 150
track 1 int g0/0/3 line-protocol