測試編號:STP-1網絡
測試目的:測試STP的選舉過程ide
測試環境:學習
測試過程:測試
1、搭建一個環形的網絡拓撲;spa
2、給VLAN1配置優先級orm
測試方法1、blog
SW1(config)#spanning-tree vlan 1 priority 65535ci
SW2(config)#spanning-tree vlan 1 priority 4096get
SW3(config)#spanning-tree vlan 1 priority 0it
測試方法1的結果:
SW1#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c202.0e48.0000
Cost 19
Port 43 (FastEthernet1/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 65535
Address c200.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 BLK 19 4096 c201.0e48.0000 128.41
FastEthernet1/2 128.43 128 19 FWD 0 0 c202.0e48.0000 128.42
F1/1 爲阻塞端口 F1/2爲根端口
SW2#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c202.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4096
Address c201.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0 128.41 128 19 FWD 19 4096 c201.0e48.0000 128.41
FastEthernet1/1 128.42 128 19 FWD 0 0 c202.0e48.0000 128.43
F1/0 爲指定端口 F1/1爲根端口
SW3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c202.0e48.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c202.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 0 c202.0e48.0000 128.42
FastEthernet1/2 128.43 128 19 FWD 0 0 c202.0e48.0000 128.43
F1/1爲指定端口 F1/2爲指定端口
測試預期效果:SW3爲根網橋,SW2爲備份根網橋,阻塞端口爲SW1的F1/2
測試結果:SW3爲根網橋,SW2爲備份根網橋,阻塞端口爲SW1的F1/2
測試方法2、
R1(config)#spanning-tree vlan 1 priority 0
R2(config)#spanning-tree vlan 1 priority 4096
R3(config)#spanning-tree vlan 1 priority 65535
測試方法2的結果:
SW1#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c200.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 0 c200.0e48.0000 128.42
FastEthernet1/2 128.43 128 19 FWD 0 0 c200.0e48.0000 128.43
SW2#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 41 (FastEthernet1/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4096
Address c201.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/0 128.41 128 19 FWD 0 0 c200.0e48.0000 128.42
FastEthernet1/1 128.42 128 19 FWD 19 4096 c201.0e48.0000 128.42
SW3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 65535
Address c202.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 BLK 19 4096 c201.0e48.0000 128.42
測試預期效果:SW1爲根網橋,SW2爲備份根網橋,阻塞端口爲SW3的F1/2
測試結果:SW1爲根網橋,SW2爲備份根網橋,阻塞端口爲SW3的F1/2
測試結果分析:
在選舉根網橋,備份根網橋時,越小越優先
測試示例:
測試目的:STP的狀態轉換
測試環境:如上圖
測試過程:
1、搭建一個環形的網絡拓撲;
2、給VLAN1配置優先級
測試方法:
SW1(config)#spanning-tree vlan 1 priority 0
SW2(config)#spanning-tree vlan 1 priority 4096
SW3(config)#spanning-tree vlan 1 priority 0
3、查看結果;
SW3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 65535
Address c202.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 BLK 19 4096 c201.0e48.0000 128.42
BLK 阻塞狀態:接收BPDU但不轉發BPDU,不接收數據也不轉發數據,不學習MAC地址
R3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c202.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 LIS 19 0 c202.0e48.0000 128.43
LIS 監聽狀態:接收BPDU也轉發BPDU,不接收數據也不轉發數據,不學習MAC地址
R3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c202.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 LRN 19 0 c202.0e48.0000 128.43
LRN 學習狀態:接收BPDU也轉發BPDU,接收數據但不轉發數據,學習MAC地址
R3#show spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 0
Address c200.0e48.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 0
Address c202.0e48.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 0 c200.0e48.0000 128.43
FastEthernet1/2 128.43 128 19 FWD 19 0 c202.0e48.0000 128.43
FWD 轉發狀態:接收BPDU也轉發BPDU,接收數據也轉發數據,學習MAC地址
測試預期效果:STP的狀態變化:BLK->LIS->LRN->FWD
測試結果:STP的狀態變化:BLK->LIS->LRN->FWD
STP的狀態時間: 20S 15S 15S
測試結果分析:
STP有四個狀態:阻塞狀態、監聽狀態、學習狀態、轉發狀態
阻塞狀態:接收BPDU但不轉發BPDU,不接收數據也不轉發數據,不學習MAC地址
監聽狀態:接收BPDU也轉發BPDU,不接收數據也不轉發數據,不學習MAC地址
學習狀態:接收BPDU也轉發BPDU,接收數據但不轉發數據,學習MAC地址
轉發狀態:接收BPDU也轉發BPDU,接收數據也轉發數據,學習MAC地址