拓扑图

图1 配置STP实验拓扑图

场景

假如您是公司的网络管理员,为了避免网络中的环路问题,需要在网络中的交换机上配置STP。本实验中,您还需要通过修改桥优先级来控制STP的根桥选举,并通过配置STP的一些特性来加快STP的收敛速度。接下来,我们将分几期内容来跟大家讲解下。

配置STP并验证

为了保证实验结果的准确性,确保设备以空配置启动。

华为交换机STP特性默认是打开的,如果STP被禁用,则执行stp enable命令启用STP。

关闭交换机STP特性命令:

[Huawei]stp disable

启用交换机STP特性命令:

[Huawei]stp enable

本实验中,SW1和SW2之间有两条链路,在SW1和SW2上启用STP,并把SW1配置为根桥。

配置SW1:

<Huawei>system-view

Huawei]sysname SW1

[SW1]stp mode stp

[SW1]stp root primary <设置本交换机的优先级为0>

配置SW2:

<Huawei>system-view

Huawei]sysname SW2

[SW2]stp mode stp

[SW2]stp root secondary <设置本交换机的优先级为4096>

执行display stp brief命令查看STP信息。

[SW1]display stp brief

MSTID Port Role STP State Protection

0 GigabitEthernet0/0/9 DESI FORWARDING NONE

0 GigabitEthernet0/0/10 DESI FORWARDING NONE

[SW2]display stp brief

MSTID Port Role STP State Protection

0 GigabitEthernet0/0/9 ROOT FORWARDING NONE

0 GigabitEthernet0/0/10 ALTE DISCARDING NONE

执行display stp interface命令查看端口的STP状态。

[SW1]display stp interface GigabitEthernet 0/0/10

-------CIST Global Info-------

CIST Bridge :0 .4c1f-cc16-05ac

Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

CIST Root/ERPC :0 .4c1f-cc16-05ac / 0

CIST RegRoot/IRPC :0 .4c1f-cc16-05ac / 0

CIST RootPortId :0.0

BPDU-Protection :Disabled

CIST Root Type :Primary root

TC or TCN received :8

TC count per hello :0

STP Converge Mode :Normal

Time since last TC :0 days 0h:19m:33s

Number of TC :6

----Port34(GigabitEthernet0/0/10)----

Port Protocol :Enabled

Port Role :Designated Port

Port Priority :128

Port Cost(Dot1T ) :Config=auto / Active=20000

Designated Bridge/Port :0.4c1f-cc16-05ac / 128.34

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 15s RemHop 20

TC or TCN send :17

TC or TCN received :0

BPDU Sent :556

TCN: 0, Config: 556, RST: 0, MST: 0

BPDU Received :2

TCN: 0, Config: 2, RST: 0, MST: 0

[SW2]display stp interface GigabitEthernet 0/0/10

-------CIST Global Info-------

CIST Bridge :4096 .4c1f-cc78-50fb

Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

CIST Root/ERPC :0 .4c1f-cc16-05ac / 20000

CIST RegRoot/IRPC :4096 .4c1f-cc78-50fb / 0

CIST RootPortId :128.9

BPDU-Protection :Disabled

CIST Root Type :Secondary root

TC or TCN received :43

TC count per hello :0

STP Converge Mode :Normal

Time since last TC :0 days 0h:23m:3s

Number of TC :8

----Port10(GigabitEthernet0/0/10)----

Port Protocol :Enabled

Port Role :Alternate Port

Port Priority :128

Port Cost(Dot1T ) :Config=auto / Active=20000

Designated Bridge/Port :0.4c1f-cc16-05ac / 128.34

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 15s RemHop 0

TC or TCN send :0

TC or TCN received :17

BPDU Sent :2

TCN: 0, Config: 2, RST: 0, MST: 0

BPDU Received :645

TCN: 0, Config: 645, RST: 0, MST: 0

文章来自:微思网络


微思郭仔
31 声望2 粉丝

微思IT认证培训-思科、华为、红帽、oracle、VMware、PMP、CISP等,一切为了成为更好的自己,加油!!!