Tips and Concepts

Concept

 
 Layer-2 Redundancy         Tips and Concepts

We all know the purpose of Spanning Tree is to prevent loop in a redundancy network. Let take a much closer look on what is going on durring the converging of Per Vlan Spanning Tree (PVST) on Cisco switches using packet tracer.

The folling topology giving us a full mesh on 4 cisco switches with different link speed:

All switch just powered up; its mac address-table will be empty as no host has transmitted any data as you can see all ports are orange.

 
   
Optimize OSPF /30 network  
Layer-2 Resolving  
Data Encapsulation  
"Fish-Mo" of AD  
Layer-2 Redundancy  
Using /31 Subnet  
FSMO: Inf Master and GC  
   
   
   
   

Lets take a look at each switch durring the convergent.

1.
1. All ports on each switch will be in Blocking state initially and each switch begins to send out its BPDU (Bridge Protocol Data Unit) containing BID (Bridge ID) which is its priority and MAC address. By default, all Cisco switch run PVST (Per-Vlan Spanning-Tree) with priority of 32,768. We will leave the Priority as default.

SW_A
Since SW_A has the lowest BID (lowest MAC), it becomes the root bridge.
All link ports on all switch will transition to Listening state and begin to compute. SW_A now know it’s the root bridge, all of its ports now transition to Designated Roles.
Since SW_A is the root bridge, it will be the only switch to send out its BPDU to all interfaces with the cost of 0.
It will continue its Listening state then switch to Learning and finally Forwarding state.
From the output above, you can see that its Root ID and its Bridge ID are the same due to it’s the root bridge. Since Cisco run PVST, it will add the VLAN number to its priority (32,376 + 1 = 32,769).

SW_B
Receive BPDU of SW_A from all switches, it add the link cost between its interface and the switch that it receive the BPDU from as the total cost to the Root Bridge.

From BPDU RP Cost On Interface Interface Cost SW_B RP Cost
SW_A 0 Gig1/1 4 4
SW_C 4 Fa0/24 19 23
SW_D 19 Gig1/2 4 23

Since the BPDU on Gig1/1 has the lowest total cost (4), SW_B change the Role of G1/2 to Root.
Forward the BPDU from SW_A out of interface G1/2 (to SW_D) and Fa0/24 (to SW_C), telling them I have a Root Port cost of 4.
Compare its Root Port cost (4) to BPDU from SW_D (19). Since SW_B has a lower Root Port Cost, it know eventually SW_D will use this port as the path to the Root Bridge and change the Role of G1/2 to Designated.
Compare its Root Port cost (4) to BPDU from SW_C (4). Since this is a tie, it recognize that this is a redundant path and one of them has to be in Block.
It then compare the MAC address value. Since SW_B has a lower MAC address, SW_B change the Role of Fa0/24 to Designated where SW_C will place it port to Alternate Roles and eventually be in Block State.


Note: From the output above, we can see in the Root ID section (Cost 4). That is the Root Port Cost for SW_B. On the bottom of the output, the Cost there is each interface cost.
All interfaces not in Alternate Role will continue in Listening State.

SW_C
Receive BPDU of SW_A from all switches, it add the link cost between its interface and the switch that it receive the BPDU from as the total cost to the Root Bridge.

From BPDU RP Cost On Interface Interface Cost SW_B RP Cost
SW_A 0 Gig1/2 4 4
SW_B 4 Fa0/24 19 23
SW_D 8 Fa0/23 19 27

Since the BPDU on Gig1/2 has the lowest total cost (4), SW_B change the Role of G1/2 to Root.
Forward the BPDU from SW_A out of interface Fa0/23 (to SW_D) and Fa0/24 (to SW_B), telling them I have a Root Port cost of 4.
Compare its Root Port cost (4) to BPDU from SW_D (8). Since SW_C has a lower Root Port Cost, it change the Role of G1/2 to Designated.
Compare its Root Port cost (4) to BPDU from SW_B (4). It recognize that this is a redundant path and one of them has to be in Block. Since this is a tie in Root Port cost, it then compare the MAC address value. SW_C has a higher MAC address, SW_C change the Role of Fa0/24 to Alternate.

All Alternate Role Port be placed in Block State immediately.
All interfaces not in Alternate Role will continue in Listening State.

SW_D
Receive BPDU of SW_A from all switches, it add the link cost between its interface and the switch that it receive the BPDU from as the total cost to the Root Bridge.

From BPDU RP Cost On Interface Interface Cost SW_B RP Cost
SW_A 0 Fa0/24 19 19
SW_B 4 Gig1/2 4 8
SW_C 4 Fa0/23 19 23

Since the BPDU on Gig1/2 has the lowest total cost (8), SW_C change the Role of G1/2 to Root.
This is a little different than SW_B and SW_C.
- SW_D forward the BPDU from SW_A received from SW_D (8) out of interface Fa0/23 (to SW_B).
- However; it use Gig1/2 to SW_B as the Root, it will forward the next best cost (19 on interface Fa0/24) out of Gig1/2 (to SW_B), telling I have the next best path with a cost of 19 if your Root Port ever goes down.
Even Fa0/24 is connected directly to the Root Bridge, it still have a higher cost path. SW_D change the Role of Fa0/24 to Alternate.
Compare its Root Port cost (8) to BPDU from SW_C (4). Since this is a redundant path and one of them has to be in Block, SW_C change the Role of Fa0/23 to Alternate.

All Alternate Role Port be placed in Block State immediately.
All interfaces not in Alternate Role will continue in Listening State.
2.
Now all the ports on all switches are in their proper Roles, ports in Listening State continue to Learning State to learn all MAC address from other switches then transition to Forwarding State.
3.
They maintain in their State and continue to forward BPDUs from SW_A unless a port goes down
4.
If one of Designated or Root Port goes down, before transition a Block State to forwarding, the port must go through the cycle of Listening, Learning before Forwarding State. This will ensure from bring in up a Block port causing a layer-2 loop.
5.
Once the layer-2 spanning-tree has converged, there can be only one layer-2 path as seen below. Remember that a Block port will continue to receive BPDUs.