STP - Cost of last link added by receiving switch
When calculating the cost of a path to the root bridge in an Spanning Tree Protocol (STP) topology, the cost of each link is added by the receiving switch, which in turn, places this summed cost into the appropriate BPDU field before forwarding that BPDU downstream.
Refer to the following diagram:
- A BPDU is sent from the root bridge (e.g., SW1) to another switch (e.g., SW2). The root bridge does not add any cost to the BPDU; it simply sends it.
- When SW2 receives the BPDU, it adds the cost of the link between SW1 and SW2. The receiving switch is responsible for adding this cost.
- This summed cost is used to populate the appropriate field in the BPDU that is prepared to be sent downstream.
- As SW2 forwards the BPDU to another switch (e.g., SW4), the added cost of the link between SW1 and SW2 is included in the BPDU.
- When SW4 receives the BPDU, it adds the cost of the link between SW2 and SW4, and so on.
This process ensures that each switch in the network can calculate the total path cost to the root bridge, allowing STP to determine the shortest path and maintain a loop-free topology.
Links
https://networklessons.com/spanning-tree/spanning-tree-cost-calculation/