cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
263
Views
4
Helpful
2
Replies

How the stp protocol works exactly

Alipasha2050
Level 1
Level 1

Hello dear friends!

I have three questions about how the stp protocol works on the network.

These are my impressions of the performance of this protocol.

I want to know your opinion if I have the right idea or not? (The second one is more important to me)

 

1) We know that at the beginning of work and when all switches are booted, all switches assume themselves as the root bridge and start sending their own bpdu.

I concluded that although each switch sends a bpdu every two seconds, due to the high power of the switches' ASICs, when each switch receives a better bpdu, it processes it within a few microseconds and passes it on to the next switch.

And it stops sending its own bpdus!!!

I came to the conclusion that by sending the first bpdu by each switch, within a few milliseconds (a little more or less depending on the size of the network and the number of switches), all switches in the network will find the root bridge and stop sending their own bpdu. is it correct??

I think there is no need to send the second bpdu by the main root bridge in this step!(The bpdu transmissions every two seconds by the root bridge are for the next steps of network stabilization to make sure the network is stable.. right?)

 

2) My second and main question is to imagine a moment when all switches have found the real root bridge and try to calculate the least cost path to reach the root bridge based on bpdus to find their root ports.

 

Each switch receives different bpdus with the same bridge ID (corresponding to the actual root bridge) but with different total path costs on its different ports!

 And the switch always remembers the bpdu with the lowest path cost.

My question is, when will this process stop for the switch? When will the switch find out that this bpdu has the lowest cost of the route to the root bridge? And after that, isn't he going to get a better bpdu at a lower cost?

 

3) And my third question is that I came to the conclusion that at the root port calculation stage for each switch, only the first bpdu sent by the root bridge is needed, which circulates in the network, and the total cost of its path changes every time. And the switches do not need the second bpdu packet from the root bridge in this process. (The bpdu transmissions every two seconds by the root bridge are for the next stages of network stabilization.. correct?)

Thank you in advance for your attention.. Thank you for helping me understand these concepts better..

@PeterPaluch

2 Replies 2

Peter Paluch
Cisco Employee
Cisco Employee

Hello there!

Regarding Question 1: Essentially, you are asking if it is possible that the entire network can learn the identity of the root bridge through a single BPDU originated by the root that simply propagates, with appropriate updates to it, across the network within a few milliseconds.

In theory, this is indeed possible. Once the true root switch originates its BPDU, its immediate neighbors receive it, accept the root switch, and relay the BPDU after appropriate updates (incrementing the root path cost, the message age, updating the sending bridge ID and sending port ID). Their own neighbors will do the same - and so within a few moments, well under 2 seconds, the knowledge about the real root switch should propagate across the whole network.

Note that the statement about non-root switches not sending their own BPDUs - or better said, not originating their own BPDUs - is true for legacy STP. In legacy STP, non-root switches only relay BPDUs received on their root ports, after updating them as described earlier. But in RSTP and MSTP, every switch, even a non-root one, still originates BPDUs on its own. However, non-root switches originate their BPDUs based on their local knowledge of root bridge and root path cost and don't wait for an arrival of a BPDU on their root port in order to send out a BPDU themselves.

As an aside note, BPDUs are not processed in ASICs. When a switch receives an STP BPDU, the ASIC of course analyzes it but it realizes that the processing needs to be done in the operating system of the switch instead of forwarding it out some other port. So it redirects it to the switch CPU instead. As a simplified rule, ASICs are involved only in handling transit traffic. Traffic that is to be processed by the switch itself will be initially seen by ASIC but immediately punted to the CPU for the real processing.

Regarding Question 2: The process never ends! With every received BPDU on any port, a switch reevaluates the complete STP state - who is the root switch, what is the root port, whether the port receiving the BPDU should be designated or one of the blocked ports (alternate, backup). This would be the naive implementation. Of course, intelligent implementations of STP would remember the last seen BPDU on the port and compare it to the nearest one passing through the port. If the two are the same, no need to re-run the entire STP computation machinery because the result would be the same. But the truth is that the STP process never ends, it just produces always the same stable results after the network itself stabilizes.

Regarding Question 3: This is a little more complex. There are transitory situations in STP during which BPDUs received on a port may be ignored for some time (max_age). If they occur, then a single BPDU would not be enough to allow the entire network to stabilize because the BPDU could get ignored. A typical situation is what's called the indirect link failure and it is described in this document about the (now obsolete) BackboneFast feature: https://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/12014-18.html

So in similar situations, a single BPDU would not be enough to allow the whole network to compute the new stable loop-free topology because some switches could ignore it. Hence, when the topology changes, it may take several BPDUs before they even get accepted and processed further.

Please feel welcome to ask further!

Best regards,
Peter

 

 

Martin L
VIP
VIP

Yes, after Root bridge is elected, "all switches in the network will find the root bridge and stop sending their own BPDU."  Next step is to select and agree on Port roles based on cost to Root switch. I would not say that there is no need to send the second BPDU; in fact, from now on, the main Root bridge is the only switch sending BPDUs downstream to all others.  Other switches copy that main Root BPDU, edit it or add its own info like port cost, MAC ID, and forwarded it downstream (away from Root sw). 

So, the process never stops; as u mentioned BPDU is sent out every 2 seconds by Root sw and is propagated downstream to others. BPDU flows constantly and is being process where its info is compared instantly.  If such process stops, if Switch B stops hearing BPDU over port A, it will assume topology has changed (failure occurred).  Let's say Sw A is the Root sw and its Root BPDU flows downstream to all others; If Sw B gets it, it compares it to its own info (looking for superior info) and then send it out to all other Designated ports to other switches. The process repeats itself every 2 seconds when another Root BPDU comes in.  

Finally, while it is true that Root switch is the one that sends out the "main" Root BPDU, other switches that get it, compare it and add or edit BPDU with its own info before sending it out to others.  it is a bit of controversial; Root Sw is the one that originates BPDU while all other switches do not; other non-root switches do not create their own BPDUs but they do modify the one they got from Root.  You may find Differences in wording in various books such as "edit" "copy", "modified"

Regards, ML
**Please Rate All Helpful Responses **

Review Cisco Networking for a $25 gift card