华为生成树协议STP分析过程与配置方法doc.docx
《华为生成树协议STP分析过程与配置方法doc.docx》由会员分享,可在线阅读,更多相关《华为生成树协议STP分析过程与配置方法doc.docx(24页珍藏版)》请在冰豆网上搜索。
![华为生成树协议STP分析过程与配置方法doc.docx](https://file1.bdocx.com/fileroot1/2022-10/27/49b403c8-19c1-4c8a-867a-ddd4737f44eb/49b403c8-19c1-4c8a-867a-ddd4737f44eb1.gif)
华为生成树协议STP分析过程与配置方法doc
v1.0可编辑可修改
华为生成树协议STP分析过程与配置方法
一、学习目的:
1、掌握配置STP的方法
2、掌握修改网桥优先级影响根选举的方法
3、掌握修改端口优先级影响根端口与指定端口选举的方法
4、掌握配置RSTP的方法
5、掌握STP与RSTP的相互兼容问题
6、掌握配置MSTP实现不同vlan负载均衡的方法
7、掌握MSTP与STP的相互兼容问题
8、掌握生成树中的保护方法
二、重点命令
1、开启stp
1.stpenable
2.stpmodestp
1
v1.0可编辑可修改
2、查看stp状态
1.disstp
2.disstpbrief
3、指定stp主根和备根
1.stprootprimary
2.stprootsecondary
4、手工指定根桥优先级
1.stppriority4096(4096的倍数)
2
v1.0可编辑可修改
5、指定RP
1.intg0/0/10
2.stpportpriority16(16的倍数)
6、指定DP
1.intg0/0/24
2.stpcost2000000
7、开启rstp
1.stpenable
3
v1.0可编辑可修改
2.stpmoderstp
8、配置mstp
1.stpenable
2.stpmodemstp
3.stpregion-configuration
4.region-nameRG1
5.
instance
1
vlan
1
to
10
6.
instance
2
vlan
11
to
20
7.
active
region-configuration
9、查看mstp实例配置
1.displaystpregion-configuration
4
v1.0可编辑可修改
10、配置mstp的多实例优先级
1.
stp
instance
1
priority
4096
2.
stp
instance
2
priority
8192
11、配置指定端口保护
1.配置在根桥的DP口上
2.intg0/0/1
3.stproot-protection
12、配置边缘端口保护
1.配置在接入服务器的端口
2.intg0/0/10
5
v1.0可编辑可修改
3.stpedged-portenable
13、配置环路保护
1.配置在非根桥交换机的上联口
2.intg0/0/13
3.stploop-protection
三、实验过程
1、实验拓扑
6
v1.0可编辑可修改
2、STP配置及验证
1.SW1-SW4:
2.stpenable
7
v1.0可编辑可修改
3.stpmodestp
查看stp状态:
1.SW1-SW4
2.disstp
3.disstpbrief
8
v1.0可编辑可修改
9
v1.0可编辑可修改
10
v1.0可编辑可修改
11
v1.0可编辑可修改
由图中我可以看出整个stp情况,如下图:
12
v1.0可编辑可修改
3、将SW1配置成主根网桥,将SW2配置成备份根网桥
13
v1.0可编辑可修改
1.SW1:
2.
[SW1]stproot
primary
3.
4.SW2:
5.[SW2]stprootsecondary
在看下SW1和SW2的stp状态,可以看到设置成主根的priority为0,备根的priority为4096。
14
v1.0可编辑可修改
15
v1.0可编辑可修改
此时4台设备的生成树如下图:
16
v1.0可编辑可修改
4、手工指定优先级,使得SW2为主根,SW1为备根
1.SW1:
17
v1.0可编辑可修改
2.[SW1]undostproot
3.
[SW1]stppriority
8192
4.
5.SW2:
6.[SW2]undostproot
7.[SW2]stppriority4096
再看下SW1和SW2的STP状态。
18
v1.0可编辑可修改
5、根端口选举控制
由于上一步把SW2设置成了根桥,所以SW1和SW2互联的两个口一定有一个属于ALTE状态,如下图:
19
v1.0可编辑可修改
可以发现9口是根端口,端口优先级默认是128,数值越小优先级越高,如果我们希望10端口变为根端口,怎么做
1.SW2:
2.[SW2]intg0/0/10
3.[SW2-GigabitEthernet0/0/10]stpportpriority16
此时再看SW1上的stp端口状态,10端口已经变成了RP。
20
v1.0可编辑可修改
6、指定端口选举控制
先看一下SW3的intg0/0/1以及SW4的intg0/0/24的端口stp状态
1.[SW3]disstpintg0/0/1
21
v1.0可编辑可修改
1.[SW4]disstpintg0/0/24
22
v1.0可编辑可修改
现在需求把SW3的G0/0/1变成指定端口:
1.SW4:
23
v1.0可编辑可修改
2.[SW4]intg0/0/24
3.[SW4-GigabitEthernet0/0/24]stpcost2000000
再看SW3的intg0/0/1以及SW4的intg0/0/24的端口stp状态,SW3的intg0/0/1变成了指定端口
24
v1.0可编辑可修改
25
v1.0可编辑可修改
7、STP的收敛速度
先在SW1和SW2上分别配置一个SVI口
26
v1.0可编辑可修改
1.SW1:
2.[SW1]intvlan1
3.[SW1-Vlanif1]ipadd
4.SW2:
5.[SW2]intvlan1
6.[SW2-Vlanif1]ipadd
看一下SW1的stp状态,9口block,10口root,此时在SW1上长pingSW2,并中断SW2的10口
我记了一下时间,大概中断了30秒钟,可见stp的收敛时间非常的慢,在对中断时间有极其严格要求的生产环节中不太适合。
27
v1.0可编辑可修改
28
v1.0可编辑可修改
8、RSTP配置
1.SW1-SW4
2.stpmoderstp
9、验证rstp的收敛时间
依然在SW1上长pingSW2,并中断SW2的10口,仅仅丢了一个包,中断在1-2秒钟左右。
29
v1.0可编辑可修改
30
v1.0可编辑可修改
10、STP和RSTP兼容
将SW1模式更改为stp:
1.SW1:
2.[SW1]stpmodestp
看一下此时SW1的stp状态,和RSTP时一致;
再次关闭SW2的10口,验证此时的收敛情况,发现依然中断了
30秒
31
v1.0可编辑可修改
32
v1.0可编辑可修改
所以RSTP兼容STP,但是收敛方式以STP模式运行。
11、MSTP配置和验证
通过mstp可以实现多vlan下的负载,先创建vlan2到20,并配置trunk。
1.SW1:
2.
[SW1]vlan
batch2to20
3.
[SW1]int
g0/0/9
4.
[SW1-GigabitEthernet0/0/9]port
link-type
trunk
5.
[SW1-GigabitEthernet0/0/9]port
trunk
allow-pass
vlan
1
to
20
6.
[SW1]int
g0/0/10
7.
[SW1-GigabitEthernet0/0/10]port
link-type
trunk
8.
[SW1-GigabitEthernet0/0/10]port
trunk
allow-pass
vlan
1
to
20
9.
[SW1]int
g0/0/13
10.
[SW1-GigabitEthernet0/0/13]port
link-type
trunk
11.
[SW1-GigabitEthernet0/0/13]port
trunk
allow-pass
vlan
1
to
20
12.
[SW1]int
g0/0/14
13.
[SW1-GigabitEthernet0/0/14]port
link-type
trunk
14.
[SW1-GigabitEthernet0/0/14]port
trunk
allow-pass
vlan
1
to
20
15.
33
v1.0可编辑可修改
16.
SW2:
17.
[SW2]vlan
batch
2
to
20
18.
[SW2]int
g0/0/9
19.
[SW2-GigabitEthernet0/0/9]port
link-type
trunk
20.
[SW2-GigabitEthernet0/0/9]port
trunk
allow-pass
vlan
1
to
20
21.
[SW2]int
g0/0/10
22.
[SW2-GigabitEthernet0/0/10]port
link-type
trunk
23.
[SW2-GigabitEthernet0/0/10]port
trunk
allow-pass
vlan
1
to
20
24.
[SW2]int
g0/0/13
25.
[SW2-Gig