HCNA-12 STP配置和选路规则
HCNA-12 STP配置和选路规则1、STP的基本配置华为交换机默认开启MSTP<Huawei>system-viewsysnamesw1stpenable//STP开启stpmode stp//STP模式STP <Huawei>system-viewsysnamesw2stpenablestpmode stp <Huawei>system-viewsysnamesw3stpenable stpmode stp <Huawei>system-viewsysnamesw4stpenable stpmode stp <sw3>displaystp//查看STP-------- //转发 Port Protocol :Enabled Port Role : Designated Port Port Priority :128 Port Cost(Dot1T ) :Config=auto / Active=20000 Designated Bridge/Port :32768.4c1f-cc38-3f7a / 128.3 Port Edged :Config=default / Active=disabled Point-to-point :Config=auto / Active=true Transit Limit :147 packets/hello-time Protection Type :None Port STP Mode :STP Port Protocol Type:Config=auto / Active=dot1s BPDU Encapsulation:Config=stp / Active=stp PortTimes :Hello 2s MaxAge 20s FwDly 15sRemHop 20 TC or TCN send :36 TC or TCN received:0 BPDU Sent :328 TCN: 0, Config: 328, RST: 0, MST: 0 BPDU Received :2 TCN: 0, Config: 2, RST: 0, MST: 0--------//丢弃 Port Protocol :Enabled Port Role :Alternate Port //替代端口 Port Priority :128 Port Cost(Dot1T ) :Config=auto / Active=20000 Designated Bridge/Port :32768.4c1f-cc10-724e / 128.5 Port Edged :Config=default / Active=disabled Point-to-point :Config=auto / Active=true Transit Limit :147 packets/hello-time Protection Type :None Port STP Mode :STP Port Protocol Type:Config=auto / Active=dot1s BPDU Encapsulation:Config=stp / Active=stp PortTimes :Hello 2s MaxAge 20s FwDly 15sRemHop 0 TC or TCN send :1 TC or TCN received:52 BPDU Sent :2 TCN: 1, Config: 1, RST: 0, MST: 0 BPDU Received :538 TCN: 0, Config: 538, RST: 0, MST: 0<sw1>displaystp brief //查看STP简介 MSTID Port RoleSTP State Protection 0 GigabitEthernet0/0/1 DESIFORWARDING NONE 0 GigabitEthernet0/0/2 DESIFORWARDING NONE<sw2>displaystp brief MSTID Port RoleSTP State Protection 0 GigabitEthernet0/0/1 ROOTFORWARDING NONE 0 GigabitEthernet0/0/4 DESIFORWARDING NONE 0 GigabitEthernet0/0/5 DESIFORWARDING NONE <sw3>display stp brief MSTID Port RoleSTP State Protection 0 GigabitEthernet0/0/2 ROOTFORWARDING NONE 0 GigabitEthernet0/0/3 DESIFORWARDING NONE 0 GigabitEthernet0/0/5 ALTEDISCARDING NONE 0 GigabitEthernet0/0/10 DESIFORWARDING NONE 0 GigabitEthernet0/0/11 DESIFORWARDING NONE<sw4>displaystp brief MSTID Port RoleSTP State Protection 0 GigabitEthernet0/0/3 ALTEDISCARDING NONE 0 GigabitEthernet0/0/4 ROOTFORWARDING NONESw1所有端口都是DESI FORWARDING 指定接口,可以初步认定是ROOT 根交换机。<sw1>displaystp--------------CIST Bridge :32768.4c1f-cc02-6b54ConfigTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20ActiveTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20CIST Root/ERPC :32768.4c1f-cc02-6b54 / 0CISTRegRoot/IRPC :32768.4c1f-cc02-6b54 / 0CISTRootPortId :0.0BPDU-Protection : DisabledTC or TCNreceived:20TC countper hello:0STPConverge Mode :Normal Time sincelast TC:0 days 0h:30m:29sNumber ofTC :16自身交换机ID和根交换机ID相同,SW1为根交换机。--------------CISTBridge :32768.4c1f-cc10-724eConfigTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20ActiveTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20CIST Root/ERPC :32768.4c1f-cc02-6b54 / 20000CISTRegRoot/IRPC :32768.4c1f-cc10-724e / 0CISTRootPortId :128.1BPDU-Protection : DisabledTC or TCNreceived:128TC countper hello:0STPConverge Mode :Normal Time sincelast TC:0 days 0h:32m:6sNumber ofTC :20
2、配置网络中的根交换机由于根交换机的默认选举是通过交换机ID,MAC地址越小,越优先。交换机默认的优先级为32768也可以通过修改优先级来手动配置根交换机选举,一般性能好的做根。2.1、通过优先级参数来配置SW2为主根,SW1为备根;SW2优先级为0,SW1优先级为4096。<sw2>system-viewstppriority 0//配置STP优先级 <sw1>system-viewstppriority 4096 displaystp brief MSTID Port RoleSTP State Protection 0 GigabitEthernet0/0/1 ROOTFORWARDING NONE 0 GigabitEthernet0/0/2 DESIFORWARDING NONE displaystp brief MSTID Port RoleSTP State Protection 0 GigabitEthernet0/0/1 DESIFORWARDING NONE 0 GigabitEthernet0/0/4 DESIFORWARDING NONE 0 GigabitEthernet0/0/5 DESIFORWARDING NONE displaystp --------------CISTBridge :0 .4c1f-cc10-724e//优先级为0ConfigTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20ActiveTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20CISTRoot/ERPC :0 .4c1f-cc10-724e / 0CISTRegRoot/IRPC :0 .4c1f-cc10-724e / 0CISTRootPortId :0.0BPDU-Protection : DisabledTC or TCNreceived:129TC countper hello:0STPConverge Mode :Normal Time sincelast TC:0 days 0h:2m:30sNumber ofTC :21displaystp--------------CISTBridge :4096 .4c1f-cc02-6b54//优先级为4096ConfigTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20ActiveTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20CISTRoot/ERPC :0 .4c1f-cc10-724e / 20000CISTRegRoot/IRPC :4096 .4c1f-cc02-6b54 / 0CISTRootPortId :128.1BPDU-Protection : DisabledTC or TCNreceived:37TC countper hello:0STPConverge Mode :Normal Time sincelast TC:0 days 0h:5m:20sNumber of TC :17Last TCoccurred :GigabitEthernet0/0/1现在SW2为主根;SW1为备根。2.2、通过命令配置SW3为主根,SW4为备根undostp priority//不执行STP优先级参数配置undostp priority <sw3>system-viewstproot primary//配置STP主根 <sw4>system-viewstproot secondary//配置STP备根displaystp brief MSTID Port RoleSTP State Protection 0 GigabitEthernet0/0/2 DESIFORWARDING NONE 0 GigabitEthernet0/0/3 DESIFORWARDING NONE 0 GigabitEthernet0/0/5 DESIFORWARDING NONE 0 GigabitEthernet0/0/10 DESIFORWARDING NONE 0 GigabitEthernet0/0/11 DESIFORWARDING NONEdisplaystp brief MSTID Port RoleSTP State Protection 0 GigabitEthernet0/0/3 ROOTFORWARDING NONE 0 GigabitEthernet0/0/4 DESIFORWARDING NONEdisplaystp--------------CISTBridge :0 .4c1f-cc38-3f7aConfigTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20ActiveTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20CISTRoot/ERPC :0 .4c1f-cc38-3f7a / 0CISTRegRoot/IRPC :0 .4c1f-cc38-3f7a / 0CISTRootPortId :0.0BPDU-Protection : DisabledCIST RootType : Primary rootTC or TCNreceived:290TC countper hello:0STPConverge Mode :Normal Time sincelast TC:0 days 0h:1m:10sNumber ofTC :28Last TCoccurred :GigabitEthernet0/0/3displaystp--------------CISTBridge :4096 .4c1f-cc64-2aadConfigTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20ActiveTimes :Hello 2s MaxAge 20s FwDly15s MaxHop 20CISTRoot/ERPC :0 .4c1f-cc38-3f7a / 20000CISTRegRoot/IRPC :4096 .4c1f-cc64-2aad / 0CISTRootPortId :128.3BPDU-Protection : DisabledCIST RootType :Secondary rootTC or TCNreceived:365TC countper hello:0STPConverge Mode :Normal Time sincelast TC:0 days 0h:1m:26sNumber ofTC :26Last TCoccurred :GigabitEthernet0/0/3现在SW3为根交换机,SW4为备根。
3、理解根端口选举
默认根端口选举原则:比较此交换机上每个端口到达根交换机的根路径开销,路径开销最小的端口成为根端口;若开销相同,则比较每个端口所在链路上的上行交换机ID;若仍相同,则比较每个端口所在链路的上行端口ID,每台交换机只能拥有一个根端口。
通过配置接口的开销值来影响根接口的选举
display stp brief
MSTIDPort RoleSTP State Protection
0 GigabitEthernet0/0/3 ALTE DISCARDING NONE
0 GigabitEthernet0/0/4 ROOT LEARNING NONE
当前根接口为 ge 0/0/4
display stp interface GigabitEthernet 0/0/4//查看生成树接口信息
……
--------
Port Protocol :Enabled
Port Role :Root Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :4096.4c1f-cc10-724e / 128.4
……
display stp interface GigabitEthernet 0/0/3
--------
Port Protocol :Enabled
Port Role :Alternate Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :32768.4c1f-cc38-3f7a / 128.3
……
interface GigabitEthernet 0/0/4
stp cost 30000//配置生成树接口开销值为30000
quit
display stp brief
MSTIDPort RoleSTP State Protection
0 GigabitEthernet0/0/3 ROOT FORWARDING NONE
0 GigabitEthernet0/0/4 ALTE DISCARDING NONE
配置完成后,根端口成了GE 0/0/3
另一种配置方法:
interface GigabitEthernet 0/0/4
undo stp cost//恢复默认COST值
display stp brief
MSTIDPort RoleSTP State Protection
0 GigabitEthernet0/0/3 ALTE DISCARDING NONE
0 GigabitEthernet0/0/4 ROOT FORWARDING NONE
interface GigabitEthernet 0/0/3
stp cost 2000
quit
display stp brief
MSTIDPort RoleSTP State Protection
0 GigabitEthernet0/0/3 ROOT LEARNING NONE
0 GigabitEthernet0/0/4 ALTE DISCARDING NONE
display stp interface GigabitEthernet 0/0/3
……
Last TC occurred :GigabitEthernet0/0/3
--------
Port Protocol :Enabled
Port Role :Root Port
Port Priority :128
Port Cost(Dot1T ) :Config=2000 / Active=2000
Designated Bridge/Port :32768.4c1f-cc38-3f7a / 128.3
……
说明COST的值越小,越优先。
页:
[1]