
Spanning tree protokolü (STP) ethernet networklerinde loop oluşumunun önüne geçebilmek için switch lerde kullanılan bir protokoldür.
1.STP Konfigurasyonu ve kontrolleri
STP protokolüne başlamak için stp enable diyerek açıyoruz.
STP modunu seçmek için stp mode stp diyoruz.
Switch1 ve Switch2 Cihazları root durumlarını belirliyoruz(primary, secondary).
system-view
Enter system view, return user view with Ctrl+Z.
[Quidway]sysname Switch1
[Switch1]stp mode stp
[Switch1]stp root primary
system-view
Enter system view, return user view with Ctrl+Z.
[Quidway]sysname Switch2
[Switch2]stp mode stp
[Switch2]stp root secondary
İnterfacelerin STP port rollerini görüntülemek için display stp brief deriz.
[Switch1]display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 DESI FORWARDING NONE
0 GigabitEthernet0/0/10 DESI FORWARDING NONE
[R2]display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ROOT FORWARDING NONE
0 GigabitEthernet0/0/10 ALTE DISCARDING NONE
Herhangi bir interfacein STP ile ilgili bilgileri ve durumunu görmek için display stp interface GigabitEthernet 0/0/10* deriz. *görüntülemek istediğimiz interface.
[Switch1]display stp interface GigabitEthernet 0/0/10
—-[CIST][Port10(GigabitEthernet0/0/10)][FORWARDING]—-
Port Protocol :enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Desg. Bridge/Port :0.80fb-06e8-d3c0 / 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
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :33
TC or TCN received :0
BPDU Sent :874
TCN: 0, Config: 874, RST: 0, MST: 0
BPDU Received :44
TCN: 0, Config: 44, RST: 0, MST: 0
[R2]display stp interface GigabitEthernet 0/0/10
—-[CIST][Port10(GigabitEthernet0/0/10)][DISCARDING]—-
Port Protocol :enabled
Port Role :Alternate Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Desg. Bridge/Port :0.80fb-06e8-d3c0 / 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
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 0
TC or TCN send :17
TC or TCN received :0
BPDU Sent :86
TCN: 0, Config: 86, RST: 0, MST: 0
BPDU Received :796
TCN: 0, Config: 796, RST: 0, MST: 0
- Root Bridge SeçimiRoot bridge hakkında bilgi edinmek için display stp komutunu kullanırız.
[Switch1]display stp
——-[CIST Global Info][Mode STP]——-
CIST Bridge :0 .80fb-06e8-d3c0
Bridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .80fb-06e8-d3c0 / 0
CIST RegRoot/IRPC :0 .80fb-06e8-d3c0 / 0
CIST RootPortId :0.0
BPDU-Protection :disabled
CIST Root Type :PRIMARY root
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:32m:17s
—-[Port1(GigabitEthernet0/0/1)][DOWN]—-
Port Protocol :enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Desg. Bridge/Port :0.80fb-06e8-d3c0 / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
Port Stp Mode :MSTP
—- More —-
[R2]display stp
——-[CIST Global Info][Mode STP]——-
CIST Bridge :4096 .80fb-06ae-2c2e
Bridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .80fb-06e8-d3c0 / 20000
CIST RegRoot/IRPC :4096 .80fb-06ae-2c2e / 0
CIST RootPortId :128.9
BPDU-Protection :disabled
CIST Root Type :SECONDARY root
TC or TCN received :0
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:32m:15s
—-[Port1(GigabitEthernet0/0/1)][DOWN]—-
Port Protocol :enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Desg. Bridge/Port :4096.80fb-06ae-2c2e / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
Port Stp Mode :MSTP
—- More —-
Root bridge seçimini priority değerleri ile belirlemek için, stp root komutunu kapatırız ve stp priority değeri girerek root bridge seçimini sağlarız. Daha küçük priority değeri olan cihaz daha önceliklidir, en düşük priority değerine sahip olan cihaz Root Bridge seçilecektir.
[Switch1]undo stp root
[Switch1]stp priority 8192
[R2]undo stp root
[R2]stp priority 4096
Değiştirdiğimiz priority değerlerini görüntülemek için display stp komutunu kullanabiliriz. CIST Bridge ve CIST Root/ERPC değerleri aynı olan cihaz Root Bridge’imizdir.
display stp
——-[CIST Global Info][Mode STP]——-
CIST Bridge :8192 .80fb-06e8-d3c0
Bridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .80fb-06ae-2c2e / 20000
CIST RegRoot/IRPC :8192 .80fb-06e8-d3c0 / 0
CIST RootPortId :128.9
BPDU-Protection :disabled
TC or TCN received :35
TC count per hello :1
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:0s
—-[Port1(GigabitEthernet0/0/1)][DOWN]—-
Port Protocol :enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Desg. Bridge/Port :8192.80fb-06e8-d3c0 / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
Port Stp Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
—- More —-
display stp
——-[CIST Global Info][Mode STP]——-
CIST Bridge :4096 .80fb-06ae-2c2e
Bridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .80fb-06ae-2c2e / 0
CIST RegRoot/IRPC :4096 .80fb-06ae-2c2e / 0
CIST RootPortId :0.0
BPDU-Protection :disabled
TC or TCN received :12
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:47s
—-[Port1(GigabitEthernet0/0/1)][DOWN]—-
Port Protocol :enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Desg. Bridge/Port :4096.80fb-06ae-2c2e / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
Port Stp Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
—- More —-
Görüldüğü gibi Switch2 Root Bridge olmuş durumda. CIST Bridge ve CIST Root/ERPC değerleri aynı.
Switch2 üzerinde GigabitEthernet 0/0/9 ve GigabitEthernet 0/0/10 interfacelerini kapatalım.
[R2]interface GigabitEthernet 0/0/9
[R2-GigabitEthernet0/0/9]shutdown
[R2-GigabitEthernet0/0/9]quit
[R2]interface GigabitEthernet 0/0/10
[R2-GigabitEthernet0/0/10]shutdown
display stp
——-[CIST Global Info][Mode STP]——-
CIST Bridge :8192 .80fb-06e8-d3c0
Bridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .80fb-06ae-2c2e / 20000
CIST RegRoot/IRPC :8192 .80fb-06e8-d3c0 / 0
CIST RootPortId :128.10
BPDU-Protection :disabled
TC or TCN received :70
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:51s
—-[Port1(GigabitEthernet0/0/1)][DOWN]—-
Port Protocol :enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Desg. Bridge/Port :8192.80fb-06e8-d3c0 / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
Port Stp Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
Görüldüğü gibi Switch2’nin bağlantısının kopması ile Switch1 Root Bridge olmuştur.
Switch2 üzerindeki interfaceleri tekrar aktif edelim.
[R2]interface GigabitEthernet 0/0/9
[R2-GigabitEthernet0/0/9]undo shutdown
[R2-GigabitEthernet0/0/9]quit
[R2]interface GigabitEthernet 0/0/10
[R2-GigabitEthernet0/0/10]undo shutdown
display stp
——-[CIST Global Info][Mode STP]——-
CIST Bridge :8192 .80fb-06e8-d3c0
Bridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .80fb-06ae-2c2e / 20000
CIST RegRoot/IRPC :8192 .80fb-06e8-d3c0 / 0
CIST RootPortId :128.9
BPDU-Protection :disabled
TC or TCN received :70
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:3m:23s
—-[Port1(GigabitEthernet0/0/1)][DOWN]—-
Port Protocol :enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Desg. Bridge/Port :8192.80fb-06e8-d3c0 / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
Port Stp Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
—- More —-
[R2]display stp
——-[CIST Global Info][Mode STP]——-
CIST Bridge :4096 .80fb-06ae-2c2e
Bridge Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .80fb-06ae-2c2e / 0
CIST RegRoot/IRPC :4096 .80fb-06ae-2c2e / 0
CIST RootPortId :0.0
BPDU-Protection :disabled
TC or TCN received :14
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:0m:17s
—-[Port1(GigabitEthernet0/0/1)][DOWN]—-
Port Protocol :enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Desg. Bridge/Port :4096.80fb-06ae-2c2e / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
Port Stp Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
—- More —-
Switch2 üzerindeki interfaceler aktif olduktan sonra, Switch2 görüldüğü üzere tekrar Root Bridge olmuştur. CIST Bridge ve CIST Root/ERPC değerleri aynı. - Root Port Seçimi
İnterface rollerini görüntülemek için display stp brief komutunu kullanırız.
display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ROOT FORWARDING NONE
0 GigabitEthernet0/0/10 ALTE DISCARDING NONE
Çıktı G0/0/9 ‘un root port olduğunu, G0/0/10’un alternate port durumunda olduğunu gösteriyor. Port priority değerlerini değiştirerek G0/0/10’u root port, G0/0/9’u alternate port durumuna getirebiliriz.
G0/0/9 vev G0/0/10 için priority’leri Switch2 üzerinde değiştiriyoruz.
Port priority default da 128’dir. Root port seçiminde en büyük priority değerine sahip olan seçilir. G0/0/9 için 32, G0/0/10 için 16 priority değeri giriyoruz. Switch2 üzerinde bu değişiklikleri yaptığımızda Switch1 üzerinde G0/0/1 Root portumuz oluyor.
[R2]interface GigabitEthernet 0/0/9
[R2-GigabitEthernet0/0/9]stp port priority 32
[R2-GigabitEthernet0/0/9]quit
[R2]interface GigabitEthernet 0/0/10
[R2-GigabitEthernet0/0/10]stp port priority 16
Port priotity değerlerini Switch2 üzerinde değiştirdik, Switch1 üzerinde değil!
[Switch2]display stp interface GigabitEthernet 0/0/9
—-[CIST][Port9(GigabitEthernet0/0/9)][FORWARDING]—-
Port Protocol :enabled
Port Role :Designated Port
Port Priority :32
Port Cost(Dot1T ) :Config=auto / Active=20000
Desg. Bridge/Port :4096.80fb-06ae-2c2e / 32.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
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :36
TC or TCN received :1
BPDU Sent :189
TCN: 0, Config: 189, RST: 0, MST: 0
BPDU Received :2
TCN: 1, Config: 1, RST: 0, MST: 0
[Switch2]display stp interface GigabitEthernet 0/0/10
—-[CIST][Port10(GigabitEthernet0/0/10)][FORWARDING]—-
Port Protocol :enabled
Port Role :Designated Port
Port Priority :16
Port Cost(Dot1T ) :Config=auto / Active=20000
Desg. Bridge/Port :4096.80fb-06ae-2c2e / 16.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
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :35
TC or TCN received :1
BPDU Sent :224
TCN: 0, Config: 224, RST: 0, MST: 0
BPDU Received :1
TCN: 1, Config: 0, RST: 0, MST: 0
Switch1 üzerinde display stp brief komutunu yazdığımızda, interface rollerini görüyoruz.
display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ALTE DISCARDING NONE
0 GigabitEthernet0/0/10 ROOT FORWARDING NONE
Switch1 üzerinde G0/0/10 Root port olmuş durumda, G0/0/9 ise alternate port durumuna geçmiş.
Switch1 üzerinde G0/0/10 interfaceini kapatalım ve rol durumlarına bakalım.
[Switch1]interface GigabitEthernet 0/0/10
[Switch1-GigabitEthernet0/0/10]shutdown
[Switch1-GigabitEthernet0/0/10]quit
[Switch1]display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ROOT LEARNING NONE
Bu durumda G0/0/9’un Root port olduğunu görüyoruz.
Switch2 üzerinde G0/0/9 ve G0/0/10 içibn default priority değerlerine geri dönelim ve Switch1 üzerinde G0/0/10 interfaceimizi tekrar aktif hale getirelim.
[Switch2]interface GigabitEthernet 0/0/9
[Switch2-GigabitEthernet0/0/9]undo stp port priority
[Switch2-GigabitEthernet0/0/9]quit
[Switch2]interface GigabitEthernet 0/0/10
[Switch2-GigabitEthernet0/0/10]undo stp port priority
[Switch1]interface GigabitEthernet 0/0/10
[Switch1-GigabitEthernet0/0/10]undo shutdown
Switch1 üzerinde interface rollerini görüntülemek için; display stp brief ve display stp interfacekomutlarını kullanalım.
[Switch1]display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ROOT FORWARDING NONE
0 GigabitEthernet0/0/10 ALTE DISCARDING NONE
[Switch1]display stp interface GigabitEthernet 0/0/9
—-[CIST][Port9(GigabitEthernet0/0/9)][FORWARDING]—-
Port Protocol :enabled
Port Role :Root Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Desg. Bridge/Port :4096.80fb-06ae-2c2e / 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
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 :519
TCN: 0, Config: 519, RST: 0, MST: 0
[Switch1]display stp interface GigabitEthernet 0/0/10
—-[CIST][Port10(GigabitEthernet0/0/10)][DISCARDING]—-
Port Protocol :enabled
Port Role :Alternate Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Desg. Bridge/Port :4096.80fb-06ae-2c2e / 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
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 :54
TCN: 0, Config: 54, RST: 0, MST: 0
G0/0/9 ve G0/0/10 için cost değerleri default’da 20000 olarak gözüküyor. Switch1 üzerinde G0/0/9 için cost değerini 200000 olarak girelim.
[Switch1]interface GigabitEthernet 0/0/9
[Switch1-GigabitEthernet0/0/9]stp cost 200000
Switch1 üzerinde interface rollerini görüntülemek için; display stp brief ve display stp interface komutlarını girelim.
display stp interface GigabitEthernet 0/0/9
—-[CIST][Port9(GigabitEthernet0/0/9)][DISCARDING]—-
Port Protocol :enabled
Port Role :Alternate Port
Port Priority :128
Port Cost(Dot1T ) :Config=200000 / Active=200000
Desg. Bridge/Port :4096.80fb-06ae-2c2e / 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
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 0
TC or TCN send :3
TC or TCN received :89
BPDU Sent :4
TCN: 3, Config: 1, RST: 0, MST: 0
BPDU Received :569
TCN: 0, Config: 569, RST: 0, MST: 0
display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ALTE DISCARDING NONE
0 GigabitEthernet0/0/10 ROOT FORWARDING NONE
Çıktıda göründüğü gibi G0/0/10 Root port durumuna geçmiş.
Final.
display current-configuration
#
!Software Version V100R005C01SPC100
sysname Switch1
#
stp mode stp
stp instance 0 priority 8192
stp enable
#
interface GigabitEthernet0/0/9
stp instance 0 cost 200000
bpdu enable
#
interface GigabitEthernet0/0/10
bpdu enable
#
user-interface con 0
idle-timeout 0 0
user-interface vty 0 4
#
return