|
实验总结
- STP作用:破环,冗余
- BPDU = Bridge Protocol Data Unit 桥协议数据单元,包含STP详细信息,交换机每两秒发送一次
- BID = Bridge ID,桥ID,交换机的“身份证”,由 优先级(默认32768,最小为0,必须是4096倍数) + MAC 组成
- Root 根桥【整个交换网络中有且只有1个】,选出STP生成树的参考点。 比较桥ID,越小优先级越高;通过指定优先级来确认 主根、备根。通过同化、转发BPDU ,
- RootPort,RP,根端口(不需要人为设置,自动选择,可以正常收发数据帧)。所有非根交换机确认一个RP;Root选举完毕后,非根交换机选择一个RP根端口(本质是一个距离根桥更近的端口)。
- RP端口的确认依据: RPC RootPortCost 根路径开销:交换机的每个端口都有一个开销值与端口的速率有关,反比,速率越高开销越小【G口千M=开销20000】。 发送BPDU的桥ID【优先级+MAC】:越小越优。 发送者的Port ID,端口ID,PID【优先级(默认128)+端口号】:越小越优。 接收者的端口ID,越小越优
- DP端口,指定端口 Designated Port:RP端口选举完后基于每条链路确认DP端口,可以正常收数据帧,本质也是离根桥最近的端口【通常,根桥交换机接口都是DP端口】。 选举依据:RPC、发送者的BID、发送者的PID。
- STP经过选举 Root、RP、DP后,剩下的端口为AP端口 Alternate Port即堵塞备用替代端口,逻辑上堵塞,避免成环。
- STP的五种端口状态
Disabled 禁用 不运行STP
Blocking 阻塞 只接受STP BPDU,不发送STP BPDU,不学习MAC,不转发用户数据-----AP端口状态
Listening 侦听 接受、转发STP BPDU,不学习MAC,不转发用户数据 15s
Learning 学习 接受、转发STP BPDU,学习MAC,不转发用户数据 15s
Forwarding 转发 接受、转发STP BPDU,学习MAC,转发用户数据
状态转变时间
阻塞 → 侦听 0s~20s时间
侦听 → 学习 15s时间
学习 → 转发 15s时间
端口的三种角色:RP、DP、AP,端口的角色转换【拓扑发生变化】和状态转换没有必然联系。
通过设置边缘端口【一般直接与终端设备直连】来避免因为端口状态转变耗费的时间增加了等待时间,disable直接变为forwaing
接口下开启关闭边缘端口: stp edged-port enable / disable
接口优先级高于全局优先级,可先在接口下关闭边缘端口,在从全局模式下开启边缘端口【stp edged-port default】
实验目地
实验现象
- 交换机每两秒发送一次 BPDU
-
- 交换机桥ID和Root根桥
-
- RP端口
-
-
- <article data-content="[{"type":"block","id":"CNB4-1664452886597","name":"list-item","data":{"headingLevel":"h2","listId":"fXJd-1664452639589","listType":"unordered","listLevel":1},"nodes":[{"type":"text","id":"Lq8t-1664452886596","leaves":[{"text":"关键命令","marks":[{"type":"bold"},{"type":"fontSize","value":22}]}]}]},{"type":"block","id":"dQqg-1664452748913","name":"list-item","data":{"listId":"fXJd-1664452639589","listType":"unordered","listLevel":1},"nodes":[{"type":"text","id":"K6PR-1664452748911","leaves":[{"text":"display stp 查看交换机生成树信息","marks":[]}]}],"state":{"index":2}},{"type":"block","id":"qZyB-1664452676598","name":"code","data":{"wrap":false,"language":"","theme":"default"},"nodes":[{"type":"block","id":"CcVD-1664452676597","name":"code-line","data":{},"nodes":[{"type":"text","id":"BMLt-1664450095101","leaves":[{"text":"# 查看交换机生成树信息","marks":[]}]}]},{"type":"block","id":"76t2-1664454745414","name":"code-line","data":{},"nodes":[{"type":"text","id":"Fjtf-1664454745413","leaves":[{"text":"dis stp","marks":[]}]}]},{"type":"block","id":"gvW4-1664454745418","name":"code-line","data":{},"nodes":[{"type":"text","id":"aeod-1664454745417","leaves":[{"text":"-------[CIST Global Info][Mode MSTP]-------","marks":[]}]}]},{"type":"block","id":"4Cgt-1664454745420","name":"code-line","data":{},"nodes":[{"type":"text","id":"4oCF-1664454745419","leaves":[{"text":"CIST Bridge :32768.4c1f-cca3-1f5c","marks":[]}]}]},{"type":"block","id":"KdsC-1664454745422","name":"code-line","data":{},"nodes":[{"type":"text","id":"GMqx-1664454745421","leaves":[{"text":"Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20","marks":[]}]}]},{"type":"block","id":"1GOL-1664454745424","name":"code-line","data":{},"nodes":[{"type":"text","id":"Hz17-1664454745423","leaves":[{"text":"Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20","marks":[]}]}]},{"type":"block","id":"neNi-1664454745426","name":"code-line","data":{},"nodes":[{"type":"text","id":"0CKy-1664454745425","leaves":[{"text":"CIST Root/ERPC :32768.4c1f-cc6f-7f25 / 20000","marks":[]}]}]}],"state":{"language":"ruby"}},{"type":"block","id":"DM4u-1664454639462","name":"list-item","data":{"listId":"p167-1664454650455","listType":"unordered","listLevel":1},"nodes":[{"type":"text","id":"kHlF-1664454639463","leaves":[{"text":"stp priority num 设置stp 桥ID的优先级【0-32768,必须是4096倍数】","marks":[]}]}],"state":{"index":1}},{"type":"block","id":"QtNE-1664454948224","name":"list-item","data":{"listId":"p167-1664454650455","listType":"unordered","listLevel":1},"nodes":[{"type":"text","id":"yqRf-1664454948223","leaves":[{"text":"stp root primary 主根【优先级0】,stp root secondary 备份根【优先级4096】","marks":[]}]}],"state":{"index":2}},{"type":"block","id":"w1G9-1664455851515","name":"list-item","data":{"listId":"p167-1664454650455","listType":"unordered","listLevel":1},"nodes":[{"type":"text","id":"UWFC-1664455851513","leaves":[{"text":"dis stp brief 查看 STP 简要信息, stp edged-port enable 端口下开启边缘端口","marks":[]}]}],"state":{"index":3}},{"type":"block","id":"iRV5-1664454639461","name":"code","data":{"wrap":false,"language":"","theme":"default"},"nodes":[{"type":"block","id":"5qER-1664454639460","name":"code-line","data":{},"nodes":[{"type":"text","id":"WZ1y-1664450095406","leaves":[{"text":"# 设置stp 桥ID的优先级","marks":[]}]}]},{"type":"block","id":"npLP-1664454640702","name":"code-line","data":{},"nodes":[{"type":"text","id":"rkbm-1664454640701","leaves":[{"text":"[S1]stp priority 0","marks":[]}]}]},{"type":"block","id":"2MQN-1664454640704","name":"code-line","data":{},"nodes":[{"type":"text","id":"cigS-1664454640703","leaves":[{"text":"[S1]dis stp","marks":[]}]}]},{"type":"block","id":"Xowh-1664454640706","name":"code-line","data":{},"nodes":[{"type":"text","id":"u5Y1-1664454640705","leaves":[{"text":"-------[CIST Global Info][Mode MSTP]-------","marks":[]}]}]},{"type":"block","id":"M7oR-1664454640708","name":"code-line","data":{},"nodes":[{"type":"text","id":"V72K-1664454640707","leaves":[{"text":"CIST Bridge :0 .4c1f-cca3-1f5c","marks":[]}]}]},{"type":"block","id":"5rp0-1664454640710","name":"code-line","data":{},"nodes":[{"type":"text","id":"jTTK-1664454640709","leaves":[{"text":"Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20","marks":[]}]}]},{"type":"block","id":"uJ8x-1664454640712","name":"code-line","data":{},"nodes":[{"type":"text","id":"mh3F-1664454640711","leaves":[{"text":"Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20","marks":[]}]}]},{"type":"block","id":"02G3-1664454640714","name":"code-line","data":{},"nodes":[{"type":"text","id":"sm1w-1664454640713","leaves":[{"text":"CIST Root/ERPC :0 .4c1f-cca3-1f5c / 0","marks":[]}]}]},{"type":"block","id":"pVqt-1664454640716","name":"code-line","data":{},"nodes":[{"type":"text","id":"1cC5-1664454640715","leaves":[{"text":"[S1]stp root ?","marks":[]}]}]},{"type":"block","id":"HvJ1-1664454991495","name":"code-line","data":{},"nodes":[{"type":"text","id":"lIBS-1664454991494","leaves":[{"text":" primary Primary root switch","marks":[]}]}]},{"type":"block","id":"Wa06-1664454991497","name":"code-line","data":{},"nodes":[{"type":"text","id":"Febq-1664454991496","leaves":[{"text":" secondary Secondary root switch","marks":[]}]}]},{"type":"block","id":"7kUY-1664454989980","name":"code-line","data":{},"nodes":[{"type":"text","id":"khNp-1664454989979","leaves":[{"text":"[S1]stp root primary ","marks":[]}]}]},{"type":"block","id":"Lb5o-1664454921068","name":"code-line","data":{},"nodes":[{"type":"text","id":"TIyr-1664454921066","leaves":[{"text":"[S1]stp root secondary ","marks":[]}]}]},{"type":"block","id":"K8Hj-1664454921381","name":"code-line","data":{},"nodes":[{"type":"text","id":"LFRz-1664454921380","leaves":[{"text":"[S3]dis stp brief","marks":[]}]}]},{"type":"block","id":"RIvI-1664455838583","name":"code-line","data":{},"nodes":[{"type":"text","id":"chHy-1664455838582","leaves":[{"text":" MSTID Port Role STP State Protection","marks":[]}]}]},{"type":"block","id":"1ykr-1664455838585","name":"code-line","data":{},"nodes":[{"type":"text","id":"8kJr-1664455838584","leaves":[{"text":" 0 GigabitEthernet0/0/1 ROOT FORWARDING NONE","marks":[]}]}]},{"type":"block","id":"sLhD-1664455838587","name":"code-line","data":{},"nodes":[{"type":"text","id":"oiOK-1664455838586","leaves":[{"text":" 0 GigabitEthernet0/0/2 ALTE DISCARDING NONE","marks":[]}]}]},{"type":"block","id":"QEsR-1664455838589","name":"code-line","data":{},"nodes":[{"type":"text","id":"msbY-1664455838588","leaves":[{"text":"[S3]","marks":[]}]}]},{"type":"block","id":"bwHk-1664519766672","name":"code-line","data":{},"nodes":[{"type":"text","id":"M7Z0-1664519766670","leaves":[{"text":"# LSW3","marks":[]}]}]},{"type":"block","id":"8HBM-1664519770815","name":"code-line","data":{},"nodes":[{"type":"text","id":"xRy1-1664519770814","leaves":[{"text":"[Huawei-GigabitEthernet0/0/20]stp edged-port enable","marks":[]}]}]},{"type":"block","id":"2fQD-1664519773840","name":"code-line","data":{},"nodes":[{"type":"text","id":"27pi-1664519773838","leaves":[{"text":"# LSW9","marks":[]}]}]},{"type":"block","id":"pSAx-1664519894928","name":"code-line","data":{},"nodes":[{"type":"text","id":"
hzj-1664519894927","leaves":[{"text":"[Huawei-GigabitEthernet0/0/1]stp edged-port enable","marks":[]}]}]},{"type":"block","id":"E3CQ-1664519774402","name":"code-line","data":{},"nodes":[{"type":"text","id":"2USN-1664519774400","leaves":[{"text":"","marks":[]}]}]},{"type":"block","id":"XzCK-1664519774611","name":"code-line","data":{},"nodes":[{"type":"text","id":"sYzQ-1664519774610","leaves":[{"text":"","marks":[]}]}]}],"state":{}}]" style="white-space: normal;">- 关键命令
- display stp 查看交换机生成树信息
# 查看交换机生成树信息<Huawei>dis stp-------[CIST Global Info][Mode MSTP]-------CIST Bridge :32768.4c1f-cca3-1f5cConfig Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20CIST Root/ERPC :32768.4c1f-cc6f-7f25 / 20000
- stp priority num 设置stp 桥ID的优先级【0-32768,必须是4096倍数】
- stp root primary 主根【优先级0】,stp root secondary 备份根【优先级4096】
- dis stp brief 查看 STP 简要信息, stp edged-port enable 端口下开启边缘端口
# 设置stp 桥ID的优先级[S1]stp priority 0[S1]dis stp-------[CIST Global Info][Mode MSTP]-------CIST Bridge :0 .4c1f-cca3-1f5cConfig Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20CIST Root/ERPC :0 .4c1f-cca3-1f5c / 0[S1]stp root ? primary Primary root switch secondary Secondary root switch[S1]stp root primary [S1]stp root secondary [S3]dis stp brief MSTID Port Role STP State Protection 0 GigabitEthernet0/0/1 ROOT FORWARDING NONE 0 GigabitEthernet0/0/2 ALTE DISCARDING NONE[S3]# LSW3[Huawei-GigabitEthernet0/0/20]stp edged-port enable# LSW9[Huawei-GigabitEthernet0/0/1]stp edged-port enable
|
|