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:

stp-topology-cost-calculations.png

  1. 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.
  2. 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.
  3. This summed cost is used to populate the appropriate field in the BPDU that is prepared to be sent downstream.
  4. 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.
  5. 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.

https://forum.networklessons.com/t/spanning-tree-cost-calculation/1111/102?u=lagapidis

https://networklessons.com/spanning-tree/spanning-tree-cost-calculation/