当前位置:文档之家› 华为生成树协议STP分析过程与配置方法

华为生成树协议STP分析过程与配置方法

华为生成树协议STP分析过程与配置方法一、学习目的:1、掌握配置STP的方法2、掌握修改网桥优先级影响根选举的方法3、掌握修改端口优先级影响根端口与指定端口选举的方法4、掌握配置RSTP的方法5、掌握STP与RSTP的相互兼容问题6、掌握配置MSTP实现不同vlan负载均衡的方法7、掌握MSTP与STP的相互兼容问题8、掌握生成树中的保护方法二、重点命令1、开启stp[plain]view plain copy1.stp enable2.stp mode stp2、查看stp状态[plain]view plain copy1.dis stp2.dis stp brief3、指定stp主根和备根[plain]view plain copy1.stp root primary2.stp root secondary4、手工指定根桥优先级[plain]view plain copy1.stp priority 4096(4096的倍数)5、指定RP[plain]view plain copy1.int g0/0/102.stp port priority 16(16的倍数)6、指定DP[plain]view plain copy1.int g0/0/242.stp cost 20000007、开启rstp[plain]view plain copy1.stp enable2.stp mode rstp8、配置mstp[plain]view plain copy1.stp enable2.stp mode mstp3.stp region-configuration4.region-name RG15.instance 1 vlan 1 to 106.instance 2 vlan 11 to 207.active region-configuration9、查看mstp实例配置[plain]view plain copy1.display stp region-configuration10、配置mstp的多实例优先级[plain]view plain copy1.stp instance 1 priority 40962.stp instance 2 priority 819211、配置指定端口保护[plain]view plain copy1.配置在根桥的DP口上2.int g0/0/13.stp root-protection12、配置边缘端口保护[plain]view plain copy1.配置在接入服务器的端口2.int g0/0/103.stp edged-port enable13、配置环路保护[plain]view plain copy1.配置在非根桥交换机的上联口2.int g0/0/133.stp loop-protection三、实验过程1、实验拓扑2、STP配置及验证[plain]view plain copy1.SW1-SW4:2.stp enable3.stp mode stp查看stp状态:[plain]view plain copy2.dis stp3.dis stp brief由图中我可以看出整个stp情况,如下图:3、将SW1配置成主根网桥,将SW2配置成备份根网桥[plain]view plain copy2.[SW1]stp root primary3.4.SW2:5.[SW2]stp root secondary在看下SW1和SW2的stp状态,可以看到设置成主根的priority为0,备根的priority为4096。

此时4台设备的生成树如下图:4、手工指定优先级,使得SW2为主根,SW1为备根[plain]view plain copy1.SW1:2.[SW1]undo stp root3.[SW1]stp priority 81924.6.[SW2]undo stp root7.[SW2]stp priority 4096再看下SW1和SW2的STP状态。

5、根端口选举控制由于上一步把SW2设置成了根桥,所以SW1和SW2互联的两个口一定有一个属于ALTE状态,如下图:可以发现9口是根端口,端口优先级默认是128,数值越小优先级越高,如果我们希望10端口变为根端口,怎么做[plain]view plain copy1.SW2:2.[SW2]int g0/0/103.[SW2-GigabitEthernet0/0/10]stp port priority 16此时再看SW1上的stp端口状态,10端口已经变成了RP。

6、指定端口选举控制先看一下SW3的int g0/0/1以及SW4的int g0/0/24的端口stp状态[plain]view plain copy1.[SW3]dis stp int g0/0/1[plain]view plain copy1.[SW4]dis stp int g0/0/24现在需求把SW3的G0/0/1变成指定端口:[plain]view plain copy1.SW4:2.[SW4]int g0/0/243.[SW4-GigabitEthernet0/0/24]stp cost 2000000再看SW3的int g0/0/1以及SW4的int g0/0/24的端口stp状态,SW3的int g0/0/1变成了指定端口7、STP的收敛速度先在SW1和SW2上分别配置一个SVI口[plain]view plain copy1.SW1:2.[SW1]int vlan 13.[SW1-Vlanif1]ip add4.SW2:5.[SW2]int vlan 16.[SW2-Vlanif1]ip add看一下SW1的stp状态,9口block,10口root,此时在SW1上长pingSW2,并中断SW2的10口我记了一下时间,大概中断了30秒钟,可见stp的收敛时间非常的慢,在对中断时间有极其严格要求的生产环节中不太适合。

8、RSTP配置[plain]view plain copy1.SW1-SW42.stp mode rstp9、验证rstp的收敛时间依然在SW1上长pingSW2,并中断SW2的10口,仅仅丢了一个包,中断在1-2秒钟左右。

10、STP和RSTP兼容将SW1模式更改为stp:[plain]view plain copy1.SW1:2.[SW1]stp mode stp看一下此时SW1的stp状态,和RSTP时一致;再次关闭SW2的10口,验证此时的收敛情况,发现依然中断了30秒所以RSTP兼容STP,但是收敛方式以STP模式运行。

11、MSTP配置和验证通过mstp可以实现多vlan下的负载,先创建vlan2到20,并配置trunk。

[plain]view plain copy1.SW1:2.[SW1]vlan batch 2 to 203.[SW1]int g0/0/94.[SW1-GigabitEthernet0/0/9]port link-type trunk5.[SW1-GigabitEthernet0/0/9]port trunk allow-pass vlan 1 to 206.[SW1]int g0/0/107.[SW1-GigabitEthernet0/0/10]port link-type trunk8.[SW1-GigabitEthernet0/0/10]port trunk allow-pass vlan 1 to 209.[SW1]int g0/0/1310.[SW1-GigabitEthernet0/0/13]port link-type trunk11.[SW1-GigabitEthernet0/0/13]port trunk allow-pass vlan 1 to 2012.[SW1]int g0/0/1413.[SW1-GigabitEthernet0/0/14]port link-type trunk14.[SW1-GigabitEthernet0/0/14]port trunk allow-pass vlan 1 to 2015.16.SW2:17.[SW2]vlan batch 2 to 2018.[SW2]int g0/0/919.[SW2-GigabitEthernet0/0/9]port link-type trunk20.[SW2-GigabitEthernet0/0/9]port trunk allow-pass vlan 1 to 2021.[SW2]int g0/0/1022.[SW2-GigabitEthernet0/0/10]port link-type trunk23.[SW2-GigabitEthernet0/0/10]port trunk allow-pass vlan 1 to 2024.[SW2]int g0/0/1325.[SW2-GigabitEthernet0/0/13]port link-type trunk27.[SW2]int g0/0/1428.[SW2-GigabitEthernet0/0/14]port link-type trunk29.[SW2-GigabitEthernet0/0/14]port trunk allow-pass vlan 1 to 2030.31.SW3:32.[SW3]vlan batch 2 to 2033.[SW3]int g0/0/134.[SW3-GigabitEthernet0/0/1]port link-type trunk35.[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 to 2036.[SW3]int g0/0/1337.[SW3-GigabitEthernet0/0/13]port link-type trunk38.[SW3-GigabitEthernet0/0/13]port trunk allow-pass vlan 1 to 2039.[SW3]int g0/0/2340.[SW3-GigabitEthernet0/0/23]port link-type trunk41.[SW3-GigabitEthernet0/0/23]port trunk allow-pass vlan 1 to 242.43.SW4:44.[SW4]vlan batch 2 to 2045.[SW4]int g0/0/146.[SW4-GigabitEthernet0/0/1]port link-type trunk47.[SW4-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 to 2048.[SW4]int g0/0/1449.[SW4-GigabitEthernet0/0/14]port link-type trunk50.[SW4-GigabitEthernet0/0/14]port trunk allow-pass vlan 1 to 2051.[SW4]int g0/0/2452.[SW4-GigabitEthernet0/0/24]port link-type trunk53.[SW4-GigabitEthernet0/0/24]port trunk allow-pass vlan 1 to 2配置mstp,定义vlan1-10属于instance 1,vlan11-20属于instance 2 [plain]view plain copy1.SW1:2.[SW1]stp mode mstp3.[SW1]stp region-configuration4.[SW1-mst-region]region-name RG15.[SW1-mst-region]instance 1 vlan 1 to 106.[SW1-mst-region]instance 2 vlan 11 to 207.[SW1-mst-region]active region-configuration8.SW2:9.[SW2]stp mode mstp10.[SW2]stp region-configuration11.[SW2-mst-region]region-name RG112.[SW2-mst-region]instance 1 vlan 1 to 1013.[SW2-mst-region]instance 2 vlan 11 to 2014.[SW2-mst-region]active region-configuration15.SW3:16.[SW3]stp mode mstp17.[SW3]stp region-configuration18.[SW3-mst-region]region-name RG119.[SW3-mst-region]instance 1 vlan 1 to 1020.[SW3-mst-region]instance 2 vlan 11 to 2021.[SW3-mst-region]active region-configuration22.SW4:23.[SW4]stp mode mstp24.[SW4]stp region-configuration25.[SW4-mst-region]region-name RG126.[SW4-mst-region]instance 1 vlan 1 to 1027.[SW4-mst-region]instance 2 vlan 11 to 2028.[SW4-mst-region]active region-configuration 查看mstp实例配置配置vlan负载[plain]view plain copy1.SW1:2.[SW1]stp instance 1 priority 40963.[SW1]stp instance 2 priority 81924.5.SW2:6.[SW2]stp instance 1 priority 81927.[SW2]stp instance 2 priority 4096查看mstp实例状态信息,SW1为实例1的根桥,SW2为实例2的根桥。

相关主题