STP:
STP - Spanning Tree Protocol(生成树协议)
1.逻辑上断开环路,防止广播风暴的产生
2.当线路故障时,阻塞接口被激活,恢复通信,起到备份作用
交换网络环路的产生:
广播风暴的形成
多帧复制
MAC地址紊乱
生成树算法
生成树算法分为三个步骤
1.选择根网桥(交换机)
2.选择根端口
3.选择指定端口
排除根端口和指定端口,剩下的就是阻塞端口
MSTP:
多生成树协议—可为每个vlan或者多个vlan为一组构造一个生成树,实现网络的负载分担(均衡)
-----------将SW1、SW2分别做vlan10、vlan20的根网桥----------
[SW1]stp mode mstp ###将交换机配置成MSTP模式,MSTP兼容STP/RSTP。
[SW1]stp region-configuration ###进入MSTP域视图MSTP配置模式
[SW1-mst-region]region-name huawei1 ###配置MSTP域的域名为huawei1,缺省为交换设备主控板上管理网口的MAC地址。
[SW1-mst-region]revision-level 1 ###配置MST域的MSTP修订级别为1,缺省情况下MSTP域的MSTP修订级别为0,需要将各设备的MSTP修订级别修改为一致
####配置多生成树实例和VLAN的映射关系,同一vlan的数据只能对应一个实例,而一个实例可以对应多个vlan(instance 1 vlan 2 to 10)
[SW1-mst-region]instance 1 vlan 10 ###将vlan 10加入实例1中
[SW1-mst-region]instance 2 vlan 20 ###将vlan 20加入实例2中
[SW1-mst-region]check region-configuration ###查看MSTP域配置参数
[SW1-mst-region]active region-configuration ###激活MSTP域的配置(必须配置)
[SW1-mst-region]quit ###退出配置模式
[SW1]stp instance 1 root primary ###配置此交换机为实例1的主根桥
[SW1]stp instance 2 root secondary ###配置此交换机为实例2的备份根桥
------------------------------
[SW2]stp mode mstp
[SW2]stp region-configuration
[SW2-mst-region]region-name huawei1
[SW2-mst-region]revision-level 1
[SW2-mst-region]instance 1 vlan 10
[SW2-mst-region]instance 2 vlan 20
[SW2-mst-region]active region-configuration
[SW2-mst-region]quit
[SW2]stp instance 1 root secondary ###配置SW1交换机为实例1的备份根桥
[SW2]stp instance 2 root primary ###配置SW2交换机为实例2的主根桥
-----------------------------------
[SW3]stp mode mstp
[SW3]stp region-configuration
[SW3-mst-region]region-name huawei1
[SW3-mst-region]revision-level 1
[SW3-mst-region]instance 1 vlan 10
[SW3-mst-region]instance 2 vlan 20
[SW3-mst-region]active region-configuration
[SW1]stp enable ###在所有交换机上启用MSTP
[SW2]stp enable
[SW3]stp enable
[SW3]dis stp brief ###查看STP接口角色及状态信息
--------修改交换机优先级值----------------
[SW1]stp priority 0 ###数值要为4096的倍数
[SW1]stp root primary ###优先级变为0
[SW1]dis stp ###查看stp信息,可以确定哪个是根网桥