温馨提示:欢迎对技术感兴趣的新手朋友们,希望这些知识点能对大家有帮助。如果有什么不解或疑惑或建议,可留言小编,我将尽快给予解决。谢谢!!

拓扑图

图3.1 配置STP实验拓扑图

场景:上一集我们讲到如何控制根桥选举,那接下来我们将继续下一个步骤:

控制根端口选举

控制根端口选举

在SW1上执行display stp brief命令查看端口角色。

[SW1]display stp brief

MSTID Port Role STP State Protection

0 GigabitEthernet0/0/9 ROOT FORWARDING NONE

0 GigabitEthernet0/0/10 ALTE DISCARDING NONE

上述回显信息表明SW1的G0/0/9是根端口,G0/0/10是Alternate端口。通过修改端口优先级,使G0/0/10成为根端口,G0/0/9成为Alternate端口。

修改SW2上G0/0/9和G0/0/10端口的优先级。

缺省情况下端口优先级为128。端口优先级取值越大,则优先级越低。在SW2上,修改G0/0/9的端口优先级值为32,G0/0/10的端口优先级值为16。

[SW2]interface GigabitEthernet 0/0/9

[SW2-GigabitEthernet0/0/9]stp port priority 32

[SW2-GigabitEthernet0/0/9]quit

[SW2]interface GigabitEthernet 0/0/10

[SW2-GigabitEthernet0/0/10]stp port priority 16

提示:此处是修改SW2的端口优先级,而不是修改SW1的端口优先级。

SW2的端口优先级修改完成后,SW1的G0/0/10成为了根端口。

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

-------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 :4096 .4c1f-cc78-50fb / 0

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

CIST RootPortId :0.0

BPDU-Protection :Disabled

TC or TCN received :46

TC count per hello :0

STP Converge Mode :Normal

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

Number of TC :14

Last TC occurred :GigabitEthernet0/0/10

----Port9(GigabitEthernet0/0/9)----

Port Protocol :Enabled

Port Role :Designated Port

Port Priority :32

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

Designated Bridge/Port :4096.4c1f-cc78-50fb / 32.9

Port Edged :Config=default / Active=disabled

Point-to-point :Config=auto / Active=true

……output omit……

[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 :4096 .4c1f-cc78-50fb / 0

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

CIST RootPortId :0.0

BPDU-Protection :Disabled

TC or TCN received :46

TC count per hello :0

STP Converge Mode :Normal

Time since last TC :0 days 0h:4m:0s

Number of TC :14

Last TC occurred :GigabitEthernet0/0/10

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

Port Protocol :Enabled

Port Role :Designated Port

Port Priority :16

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

Designated Bridge/Port :4096.4c1f-cc78-50fb / 16.10

Port Edged :Config=default / Active=disabled

Point-to-point :Config=auto / Active=true

……output omit……

在SW1上执行display stp brief命令查看端口角色。

[SW1]display stp brief

MSTID Port Role STP State Protection

0 GigabitEthernet0/0/9 ALTE DISCARDING NONE

0 GigabitEthernet0/0/10 ROOT FORWARDING NONE

在上述回显信息中,灰色部分表明SW1的G0/0/10端口是根端口,G0/0/9是Alternate端口。

关闭SW1的GigabitEthernet 0/0/10端口,再查看端口角色。

[SW1]interface GigabitEthernet 0/0/10

[SW1-GigabitEthernet0/0/10]shutdown

[SW1]disp stp brief

MSTID Port Role STP State Protection

0 GigabitEthernet0/0/9 ROOT DISCARDING NONE

在上述回显信息中的灰色部分可以看出,SW1的G0/0/9变成了根端口。在SW2上恢复G0/0/9和G0/0/10端口的缺省优先级,并重新开启SW1上关闭的端口。

[SW2]interface GigabitEthernet 0/0/9

[SW2-GigabitEthernet0/0/9]undo stp port priority

[SW2-GigabitEthernet0/0/9]quit

[SW2]interface GigabitEthernet 0/0/10

[SW2-GigabitEthernet0/0/10]undo stp port priority

[SW1]interface GigabitEthernet 0/0/10

[SW1-GigabitEthernet0/0/10]undo shutdown

在SW1上执行display stp brief命令和display stp interface命令查看端口角色。

<SW1>display stp brief

MSTID Port Role STP State Protection

0 GigabitEthernet0/0/9 ROOT FORWARDING NONE

0 GigabitEthernet0/0/10 ALTE DISCARDING NONE

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

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

CIST Bridge :8192 .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 :4096 .4c1f-cc78-50fb / 20000

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

CIST RootPortId :128.33

BPDU-Protection :Disabled

TC or TCN received :168

TC count per hello :0

STP Converge Mode :Normal

Time since last TC :0 days 0h:1m:22s

Number of TC :15

Last TC occurred :GigabitEthernet0/0/9

----Port33(GigabitEthernet0/0/9)----

Port Protocol :Enabled

Port Role :Root Port

Port Priority :128

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

Designated Bridge/Port :4096.4c1f-cc78-50fb / 128.9

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 :3

TC or TCN received :73

BPDU Sent :4

TCN: 3, Config: 1, RST: 0, MST: 0

BPDU Received :487

TCN: 0, Config: 487, RST: 0, MST: 0

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

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

CIST Bridge :8192 .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 :4096 .4c1f-cc78-50fb / 20000

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

CIST RootPortId :128.33

BPDU-Protection :Disabled

TC or TCN received :168

TC count per hello :0

STP Converge Mode :Normal

Time since last TC :0 days 0h:1m:53s

Number of TC :15

Last TC occurred :GigabitEthernet0/0/9

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

Port Protocol :Enabled

Port Role :Alternate Port

Port Priority :128

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

Designated Bridge/Port :4096.4c1f-cc78-50fb / 128.10

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 :1

TCN: 0, Config: 1, RST: 0, MST: 0

BPDU Received :68

TCN: 0, Config: 68, RST: 0, MST: 0

在上述回显信息中,灰色部分表明G0/0/9和G0/0/10的端口开销缺省情况下为20000。

修改SW1上的G0/0/9端口开销值为200000。

[SW1]interface GigabitEthernet 0/0/9

[SW1-GigabitEthernet0/0/9]stp cost 200000

在SW1上执行display stp brief命令和display stp interface命令查看端口角色。

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

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

CIST Bridge :8192 .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 :4096 .4c1f-cc78-50fb / 20000

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

CIST RootPortId :128.34

BPDU-Protection :Disabled

TC or TCN received :204

TC count per hello :0

STP Converge Mode :Normal

Time since last TC :0 days 0h:0m:12s

Number of TC :18

Last TC occurred :GigabitEthernet0/0/10

----Port33(GigabitEthernet0/0/9)----

Port Protocol :Enabled

Port Role :Alternate Port

Port Priority :128

Port Cost(Dot1T ) :Config=200000 / Active=200000

Designated Bridge/Port :4096.4c1f-cc78-50fb / 128.9

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 :3

TC or TCN received :90

BPDU Sent :4

TCN: 3, Config: 1, RST: 0, MST: 0

BPDU Received :568

TCN: 0, Config: 568, RST: 0, MST: 0

[SW1]display stp brief

MSTID Port Role STP State Protection

0 GigabitEthernet0/0/9 ALTE DISCARDING NONE

0 GigabitEthernet0/0/10 ROOT FORWARDING NONE

此时,SW1上的G0/0/10端口变为根端口。

配置文件

<S1>display current-configuration

<S2>display current-configuration


微思郭仔
31 声望2 粉丝

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