配置MSTP基本功能
配置LSW到域名为RG1的域内,创建实例MSTI1和实例MSTI2
[LSW1-mst-region]region-name RG1
[LSW1-mst-region]instance 1 vlan 10
[LSW1-mst-region]instance 2 vlan 20
[LSW1-mst-region]active region-configuration
[LSW2]stp region-configuration
[LSW2-mst-region]region-name RG1
[LSW2-mst-region]instance 1 vlan 10
[LSW2-mst-region]instance 2 vlan 20
[LSW2-mst-region]active region-configuration
[LSW3]stp region-configuration
[LSW3-mst-region]reg
[LSW3-mst-region]region-name RG1
[LSW3-mst-region]instance 1 vlan 10
[LSW3-mst-region]instance 2 vlan 20
[LSW3-mst-region]active region-configuration
在域RG1内,配置MSTI1与MSTI2的根桥与备份根桥
[LSW1]stp instance 1 root primary
[LSW1]stp instance 2 root secondary
[LSW2]stp instance 1 root secondary
[LSW2]stp instance 2 root primary
配置实例MSTI1和MSTI2中将要被阻塞端口的路径开销值大于缺省值
[LSW1]stp pathcost-standard legacy
[LSW2]stp pathcost-standard legacy
[LSW3]stp pathcost-standard legacy
[LSW3-GigabitEthernet0/0/1]stp instance 2 cost 20000
[LSW3-GigabitEthernet0/0/2]stp instance 1 cost 20000
使能MSTP,实现破除环路
[LSW1]stp enable
[LSW2]stp enable
[LSW3]stp enable
[LSW3-GigabitEthernet0/0/3]stp edged-port enable //将与PC相连的端口设置为边缘端口
[LSW3-GigabitEthernet0/0/4]stp edged-port enable
[LSW3]stp bpdu-protection //配置BPDU保护功能
[LSW1-GigabitEthernet0/0/1]stp edged-port enable
[LSW1]stp bpdu-protection
[LSW2-GigabitEthernet0/0/2]stp edged-port enable
[LSW2]stp bpdu-protection
配置保护功能, 在各实例的根桥设备的指定端口配置根保护功能
[LSW1-GigabitEthernet0/0/3]stp root-protection
[LSW2-GigabitEthernet0/0/3]stp root-protection
配置处于环网中的设备的二层转发功能
[LSW1]vlan batch 10 20
[LSW1-GigabitEthernet0/0/3]port link-type trunk
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20
[LSW1-GigabitEthernet0/0/2]port link-type trunk
[LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20
[LSW2]vlan batch 10 20
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20
[LSW2-GigabitEthernet0/0/1]port link-type trunk
[LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[LSW3]vlan batch 10 20
[LSW3-GigabitEthernet0/0/3]port link-type access
[LSW3-GigabitEthernet0/0/3]port default vlan 10
[LSW3-GigabitEthernet0/0/4]port link-type access
[LSW3-GigabitEthernet0/0/4]port default vlan 20
[LSW3-GigabitEthernet0/0/1]port link-type trunk
[LSW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[LSW3-GigabitEthernet0/0/2]port link-type trunk
[LSW3-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20
验证配置
配置设备间的网络互连
[LSW1]vlan batch 30
[LSW1-GigabitEthernet0/0/1]port link-type trunk
[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 30
[LSW1-Vlanif10]ip add 10.1.1.1 24
[LSW1-Vlanif20]ip add 10.1.2.1 24
[LSW1-Vlanif30]ip add 10.1.3.1 24
[LSW2]vlan batch 40
[LSW2-GigabitEthernet0/0/2]port link-type trunk
[LSW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 40
[LSW2-Vlanif10]ip add 10.1.1.2 24
[LSW2-Vlanif20]ip add 10.1.2.2 24
[LSW2-Vlanif40]ip add 10.1.4.2 24
[LSW1]ospf 1
[LSW1-ospf-1]area 0
[LSW1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[LSW1-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[LSW1-ospf-1-area-0.0.0.0]network 10.1.3.0 0.0.0.255
[LSW2]ospf 1
[LSW2-ospf-1]area 0
[LSW2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.0]network 10.1.4.0 0.0.0.255
配置VRRP备份组
[LSW1]int Vlanif 10
[LSW1-Vlanif10]vrrp vrid 1 virtual-ip 10.1.1.254
[LSW1-Vlanif10]vrrp vrid 1 priority 120
[LSW1-Vlanif10]vrrp vrid 1 preempt-mode timer delay 20
[LSW1]int Vlanif 20
[LSW1-Vlanif20]vrrp vrid 2 virtual-ip 10.1.2.254
[LSW2]int Vlanif 20
[LSW2-Vlanif20]vrrp vrid 2 virtual-ip 10.1.2.254
[LSW2-Vlanif20]vrrp vrid 2 priority 120
[LSW2-Vlanif20]vrrp vrid 2 preempt-mode timer delay 20
[LSW2]int Vlanif 10
[LSW2-Vlanif10]vrrp vrid 1 virtual-ip 10.1.1.254
验证配置