How path cost is being calculated in STP is still not clear to me. Let's say we got this architecture, where all switches were just turned on for the first time:
During BPDUs exchange, every switch port will conform or discard the BPDU's according to the lowest priority logic. In first burst of BPDU's everyone advertises 0 path cost and every switch accommodates the configuration BPDU on the receiving port by comparing received config + existing config. In the next burst of BPDU's everyone will advertise the chosen bridge ID but still with path cost of 0. When it comes to choosing the port state (root port, designated, non designated), the switch must identify the least path cost on it's interfaces.
As an example For SW2:
- On F0/1: cost is 19 (fast ethernet port)
- On F0/2: cost is 19 (fast ethernet port)
- On F0/3: cost is 19 (0 path cost from bpdu's of SW3 + interface cost of F0/3)
For SW4:
- On G0/1: cost is 4 (gigabit port)
- On G0/2: cost is 4 (0 path cost from bpdu's of SW3 + interface cost of G0/2)
However, I know this is wrong but I didn't managed to understand it properly so far. Functionally, for the above example, I would say the cost of SW4 G0/2 interface would be 4 (0+4) and for G0/1 would be the SUM of the interfaces of SW4, SW2 (one of them) + SW3...but this is not clear because SW2 advertises to SW4 (theoretically) two bpdus: first bpdu when it says he's the root bridge and secondly when it has the bridge id of SW3 but still with the path cost of it's own interface...
How does this path calculation works technically when bpdu's are being exchanged ? For example, if you would say that the path cost of G0/1 for SW4 is a different value; how did you came up to that number, what has happened during the BPDU's exchange to result in the specified number ?
Thanks,