实验目的
了解生成树原理,在实际配置时可以阻塞合适的端口。
stp建立过程验证
上图实验,仅配置stp为stp模式。默认优先级相同。查看端口情况如下图:
选择过程中判断过程:根桥ID -> 路径开销 -> BPDU的桥ID -> 端口优先级
分析:1. LSW2的MAC地址最小,选为root。2. 根端口(R):非根桥的up端口到根桥的cost不同,选择开销最小的 3. 指定端口:根桥的所有端口为指定端口,其他每一段链路选出指定端口
MSTP配置过程
华为路由器MSTP为默认配置
MSTP优势:
- 提高链路利用率:不同域的STP拓扑不同,阻塞点不同
- 配置灵活:将多个VLAN加到一个域中
由于MSTP配置配置需要配置不同的VLAN, 对于生成树了解,不同之处在配置过程将vlan加入到域中,下面是搜索到的参考配置:
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] stp region-configuration
[SwitchA-mst-region] region-name RG1
[SwitchA-mst-region] instance 1 vlan 2 to 10
[SwitchA-mst-region] instance 2 vlan 11 to 20
[SwitchA-mst-region] active region-configuration
[SwitchA-mst-region] quit
[SwitchA] stp instance 1 root primary
[SwitchA] stp instance 2 root secondary
[SwitchA] stp pathcost-standard legacy
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 20
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] save
总结
STP是一种二层网络防环的策略,实现网络提供冗余链路的同时避免环路导致的广播风暴等其他影响。
实际业务配置中,通过可直接设置根桥、次根桥。并通过设置路径开销在配置时确定最后的阻塞端口。