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.
CLIGURU-S1 ve CLIGURU-S2 Cihazları root durumlarını belirliyoruz(primary, secondary).
<Quidway>system-view
Enter system view, return user view with Ctrl+Z.
[Quidway]sysname CLIGURU-S1
[CLIGURU-S1]stp mode stp
[CLIGURU-S1]stp root primary
|
<Quidway>system-view
Enter system view, return user view with Ctrl+Z.
[Quidway]sysname CLIGURU-S2
[CLIGURU-S2]stp mode stp
[CLIGURU-S2]stp root secondary
|
İnterfacelerin STP port rollerini görüntülemek için display stp brief deriz.
[CLIGURU-S1]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.
[CLIGURU-S1]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
|
2. Root Bridge SeçimiRoot bridge hakkında bilgi edinmek için display stp komutunu kullanırız.
[CLIGURU-S1]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.
[CLIGURU-S1]undo stp root
[CLIGURU-S1]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.
<CLIGURU-S1>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 —-
|
<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 :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 CLIGURU-S2 Root Bridge olmuş durumda. CIST Bridge ve CIST Root/ERPC değerleri aynı.
CLIGURU-S2 ü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
|
<CLIGURU-S1>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 CLIGURU-S2’nin bağlantısının kopması ile CLIGURU-S1 Root Bridge olmuştur.
CLIGURU-S2 ü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
|
<CLIGURU-S1>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 —-
|
CLIGURU-S2 üzerindeki interfaceler aktif olduktan sonra, CLIGURU-S2 görüldüğü üzere tekrar Root Bridge olmuştur. CIST Bridge ve CIST Root/ERPC değerleri aynı.
3. Root Port Seçimi
İnterface rollerini görüntülemek için display stp brief komutunu kullanırız.
<CLIGURU-S1>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 CLIGURU-S2 ü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. CLIGURU-S2 üzerinde bu değişiklikleri yaptığımızda CLIGURU-S1 ü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 CLIGURU-S2 üzerinde değiştirdik, CLIGURU-S1 üzerinde değil!
[CLIGURU-S2]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
|
[CLIGURU-S2]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
|
CLIGURU-S1 üzerinde display stp brief komutunu yazdığımızda, interface rollerini görüyoruz.
<CLIGURU-S1>display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ALTE DISCARDING NONE
0 GigabitEthernet0/0/10 ROOT FORWARDING NONE
|
CLIGURU-S1 üzerinde G0/0/10 Root port olmuş durumda, G0/0/9 ise alternate port durumuna geçmiş.
CLIGURU-S1 üzerinde G0/0/10 interfaceini kapatalım ve rol durumlarına bakalım.
[CLIGURU-S1]interface GigabitEthernet 0/0/10
[CLIGURU-S1-GigabitEthernet0/0/10]shutdown
[CLIGURU-S1-GigabitEthernet0/0/10]quit
|
[CLIGURU-S1]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.
CLIGURU-S2 üzerinde G0/0/9 ve G0/0/10 içibn default priority değerlerine geri dönelim ve CLIGURU-S1 üzerinde G0/0/10 interfaceimizi tekrar aktif hale getirelim.
[CLIGURU-S2]interface GigabitEthernet 0/0/9
[CLIGURU-S2-GigabitEthernet0/0/9]undo stp port priority
[CLIGURU-S2-GigabitEthernet0/0/9]quit
[CLIGURU-S2]interface GigabitEthernet 0/0/10
[CLIGURU-S2-GigabitEthernet0/0/10]undo stp port priority
|
[CLIGURU-S1]interface GigabitEthernet 0/0/10
[CLIGURU-S1-GigabitEthernet0/0/10]undo shutdown
|
CLIGURU-S1 üzerinde interface rollerini görüntülemek için; display stp brief ve display stp interface komutlarını kullanalım.
[CLIGURU-S1]display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ROOT FORWARDING NONE
0 GigabitEthernet0/0/10 ALTE DISCARDING NONE
|
[CLIGURU-S1]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
|
[CLIGURU-S1]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. CLIGURU-S1 üzerinde G0/0/9 için cost değerini 200000 olarak girelim.
[CLIGURU-S1]interface GigabitEthernet 0/0/9
[CLIGURU-S1-GigabitEthernet0/0/9]stp cost 200000
|
CLIGURU-S1 üzerinde interface rollerini görüntülemek için; display stp brief ve display stp interface komutlarını girelim.
<CLIGURU-S1>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
|
<CLIGURU-S1>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.
<CLIGURU-S1>display current-configuration
#
!Software Version V100R005C01SPC100
sysname CLIGURU-S1
#
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
|