cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
547
Views
2
Helpful
25
Replies

Calculation of MST cost

rasmus.elmholt
Level 7
Level 7

Hi all,

Could someone please explain to me why I see the things I do with MST?

I have the below setup in a lab, where SW1 is configured with the lowest Cost and is the root bridge.

Everything is working as expect, in regards to STP, and SW4 is Blocking its port Gi1/2 and 1/3 towards SW3.

I found this old post from @Peter Paluch in regards to Common and Internal STP cost, but am not sure it has anything to do in regards to what I am seeing, except that I got confused by the path cost of 0... https://community.cisco.com/t5/switching/mst-is-showing-root-cost-for-mst0-as-zero/m-p/1960068/highlight/true#M219070

But my question is: Why will the shutdown of a port in the LAG between SW2 and SW3 result in the STP topology to change so much that the traffic from SW3 will go through a 100mbit link to SW4->SW2->SW1?

rasmuselmholt_0-1751544990300.png

 

25 Replies 25

Enes Simnica
Level 1
Level 1

hello G, sick problem u have there, love it...

The topology change u're observing occurs because MST recalculates path costs when a LAG member port shuts down. In ur lab, when uu disable a port in the SW2-SW3 LAG bundle, the remaining active links in that LAG may no longer provide the lowest cumulative path cost to the root bridge (SW1). MST compares all available paths and selects the one with the lowest total cost to the root.

SOooo, In this case, the path through SW4's 100Mbps link likely shows a lower total cost to reach SW1 than the remaining LAG members between SW2-SW3. This happens because MST doesn't automatically account for the reduced bandwidth of the degraded LAG cause it only sees the individual link costs. The protocol makes forwarding decisions strictly based on the numerical path cost calculations, not the actual available bandwidth.

To prevent this behavior, u should manually configure the LAG's MST path cost to ensure it remains lower than alternative paths even when some members fail. Use the command "spanning-tree mst 0 cost" on the PortChannel interface to set an explicit value that maintains your desired forwarding path. Also verify that all switches in the MST region have consistent configurations, including the same region name and revision number. The key commands to troubleshoot are "show spanning-tree mst" and "show spanning-tree mst interface" to compare path costs before and after the topology change.

 

if u want I can jump on EVEng and lab it? just ping me

hope it helps G.

 

-Enes

more Cisco?!
more Gym?!

Hi @Enes Simnica  I agree, it is a strange issue I see.

The reason I notices this behaviour was actually because I would see if it changed the cost of a LAG if you shutdown one of the ports, and as you can see on the rightmost textbox where I shutdown the interface you can see the cost of Po1 changes from 10.000 to 20.000 as we expect. But the 100mbit link(gi1/2) has a cost of 200.000 and I cannot understand why it would choose this path to the RB.

The STP configuration is the same on all devices. And the VLAN Database as well. With the caveat that the links(gi1/2 and Gi1/3) are accessports with only VLAN20 allowed.

spanning-tree mode mst
spanning-tree extend system-id
spanning-tree mst configuration
 name CiscoSTD
 revision 1

If I shut down the other interface in the LAG. Gi0/2 I see another result. I would expect it to be the same as all it does is changing the cost of the Po1.

But somehow it changes the STP topology to block both access ports on SW3 and change them to FWD on SW4.

As shown below.

SW3#show span mst 0

##### MST0    vlans mapped:   1-4094
Bridge        address 5009.0003.0000  priority      32768 (32768 sysid 0)
Root          address 5009.0001.0000  priority      24576 (24576 sysid 0)
              port    Po1             path cost     0        
Regional Root address 5009.0001.0000  priority      24576 (24576 sysid 0)
                                      internal cost 40000     rem hops 18
Operational   hello time 2 , forward delay 15, max age 20, txholdcount 6 
Configured    hello time 2 , forward delay 15, max age 20, max hops    20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- ----------------------------
----
Gi0/0            Desg FWD 20000     128.1    P2p 
Gi0/3            Desg FWD 20000     128.4    P2p 
Gi1/0            Desg FWD 20000     128.5    P2p 
Gi1/1            Desg FWD 20000     128.6    P2p 
Gi1/2            Altn BLK 200000    128.7    P2p 
Gi1/3            Altn BLK 200000    128.8    P2p 
Po1              Root FWD 20000     128.65   P2p 

 

Hello G, yeah looks like a tricky one, but this time i think I see whats happening here. So, even though the 100Mbps link has a cost of 200,000, MST sometimes still prefers it when the lag (Po1) drops a member. MST recalculates based on the individual port costs, not the full bundle bandwidth, unless u manually set the cost. When u shut a port in the LAG, the Po1 cost increases (for example. from 10,000 to 20,000), and MST may re-evaluate the topology and see the 100Mbps access link as a valid alternate, even if it’s slower. Also, since Gi1/2 and Gi1/3 are access ports only allowing VLAN 20, MST might see them as a more “direct” path for VLAN 20 when the topology shifts, especially if BPDU reception changes.

would be a good thing to manually set the mst cost on po1 to stay lower than any backup path like: #int port-channel1 and then spanningtree mst 0 cost 10000 - but if u dont want sw4s 100mpbs link to ever be preferred, either block or prune vlan 20 on them....

and man looks like i will lab this on eveng later FO So...

hope it helps G

 

-Enes

more Cisco?!
more Gym?!

Interesting @Enes Simnica ,

Could you point me in the right direction to where I can read more about this MST behavior?

I thought I understood STP. 1, Find the Root Bridge. 2, Select Root ports based on cost and priority.

But apparently not.

Take a look at this where I have set the cost on the LAG between SW2 and SW3 manually but it will still result in a recomputation.

SW3#show span mst 0

##### MST0    vlans mapped:   1-4094
Bridge        address 5009.0003.0000  priority      32768 (32768 sysid 0)
Root          address 5009.0001.0000  priority      24576 (24576 sysid 0)
              port    Po1             path cost     0        
Regional Root address 5009.0001.0000  priority      24576 (24576 sysid 0)
                                      internal cost 40000     rem hops 18
Operational   hello time 2 , forward delay 15, max age 20, txholdcount 6 
Configured    hello time 2 , forward delay 15, max age 20, max hops    20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- ----------------------------
----
Gi0/0            Desg FWD 20000     128.1    P2p 
Gi0/3            Desg FWD 20000     128.4    P2p 
Gi1/0            Desg FWD 20000     128.5    P2p 
Gi1/1            Desg FWD 20000     128.6    P2p 
Gi1/2            Desg FWD 200000    128.7    P2p 
Gi1/3            Desg FWD 200000    128.8    P2p 
Po1              Root FWD 20000     128.65   P2p 

SW3#show run int po1
Building configuration...

Current configuration : 124 bytes
!
interface Port-channel1
 switchport trunk encapsulation dot1q
 switchport mode trunk
 spanning-tree mst 0 cost 20000
end

SW3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW3(config)#int gi0/1
SW3(config-if)#shut
SW3(config-if)#
*Jul  3 13:29:53.635: %LINK-5-CHANGED: Interface GigabitEthernet0/1, chan
ged state to administratively down
*Jul  3 13:29:54.635: %LINEPROTO-5-UPDOWN: Line protocol on Interface Gig
abitEthernet0/1, changed state to down
SW3(config-if)#do show span mst 0

##### MST0    vlans mapped:   1-4094
Bridge        address 5009.0003.0000  priority      32768 (32768 sysid 0)
Root          address 5009.0001.0000  priority      24576 (24576 sysid 0)
              port    Gi1/2           path cost     0        
Regional Root address 5009.0001.0000  priority      24576 (24576 sysid 0)
                                      internal cost 250000    rem hops 17
Operational   hello time 2 , forward delay 15, max age 20, txholdcount 6 
Configured    hello time 2 , forward delay 15, max age 20, max hops    20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- ----------------------------
----
Gi0/0            Desg BLK 20000     128.1    P2p 
Gi0/3            Desg BLK 20000     128.4    P2p 
Gi1/0            Desg BLK 20000     128.5    P2p 
Gi1/1            Desg BLK 20000     128.6    P2p 
Gi1/2            Root FWD 200000    128.7    P2p 
Gi1/3            Altn BLK 200000    128.8    P2p 
Po1              Desg BLK 20000     128.65   P2p 

I will have to look some more into this. But the regional cost from SW4 is only 50.000 on the 100mbit ports.

Whereas the cost from SW2 on Po1 is 250.000 for some reason as seen here from SW3:

GigabitEthernet1/2 of MST0 is root forwarding 
Port info             port id          128.7  priority    128  cost      200000
Designated root       address 5009.0001.0000  priority  24576  cost           0
Design. regional root address 5009.0001.0000  priority  24576  cost       50000
Designated bridge     address 5009.0004.0000  priority  32768  port id    128.7
Timers: message expires in 5 sec, forward delay 0, forward transitions 9
Bpdus sent 1118, received 2301
          
GigabitEthernet1/3 of MST0 is alternate blocking 
Port info             port id          128.8  priority    128  cost      200000
Designated root       address 5009.0001.0000  priority  24576  cost           0
Design. regional root address 5009.0001.0000  priority  24576  cost       50000
Designated bridge     address 5009.0004.0000  priority  32768  port id    128.8
Timers: message expires in 5 sec, forward delay 0, forward transitions 7
Bpdus sent 1103, received 2308
          
Port-channel1 of MST0 is designated forwarding 
Port info             port id         128.65  priority    128  cost       20000
Designated root       address 5009.0001.0000  priority  24576  cost           0
Design. regional root address 5009.0001.0000  priority  24576  cost      250000
Designated bridge     address 5009.0003.0000  priority  32768  port id   128.65
Timers: message expires in 0 sec, forward delay 0, forward transitions 2
Bpdus sent 177, received 499

Could be caused by the P2p Dispute on SW2, I will have to look into this.

SW2#show span mst 0

##### MST0    vlans mapped:   1-4094
Bridge        address 5009.0002.0000  priority      32768 (32768 sysid 0)
Root          address 5009.0001.0000  priority      24576 (24576 sysid 0)
              port    Gi0/0           path cost     0        
Regional Root address 5009.0001.0000  priority      24576 (24576 sysid 0)
                                      internal cost 20000     rem hops 19
Operational   hello time 2 , forward delay 15, max age 20, txholdcount 6 
Configured    hello time 2 , forward delay 15, max age 20, max hops    20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi0/0            Root FWD 20000     128.1    P2p 
Gi1/1            Desg FWD 20000     128.6    P2p 
Gi1/2            Desg FWD 20000     128.7    P2p 
Gi1/3            Desg FWD 20000     128.8    P2p 
Po1              Desg BLK 20000     128.65   P2p Dispute 
Po2              Desg FWD 10000     128.66   P2p 

https://www.cisco.com/c/en/us/support/docs/lan-switching/stp/218351-troubleshoot-mst-on-catalyst-9000-switch.html#anc31

You not see video I share ?
anyway 
cst is same for all SW that meaning you vlan1 is OK 

instance root is issue since each device see itself as root 
that manily becuase of VLAN is missing from the trunk between SW or PO is not correctly config
or you wrong map VLAN to instance 

That it

MHM

I have just watched the video. But I still don't understand the issue I see.

VLANs and configuration are consistent in the entire setup.

But for some reason whenever I shut down one of the ports in the LAG, the entire STP environment changes, even with the cost hardcoded, and the ports goes though LRN again.

 

SW2#show vlan brie

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi0/1, Gi1/1, Gi1/2, Gi1/3
10   VLAN0010                         active    
20   VLAN0020                         active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

spanning-tree mode mst
spanning-tree extend system-id
spanning-tree mst configuration
 name CiscoSTD
 revision 1

G what u seeing here is still consisten with MST, its just that mst behaves a bit differently than pvst when it comes to logic vs physical interfaces. Now, from the show span mst 0 result, i can see that when u shut down a member, mst treats that as a topology change, meaning it recalculates based on the now degraded lag, and during this process: 1. The portchannel may briefly become inconsistent, especially if BPDUs aren't received fast enough over the remaining member, depending on switch platform & timers... 2. mst can shift to an alternate path like Gi1/2 if it receives BPDUs from that port first, and its cost looks valid. 3. and the result as we see: ur g1/2 access port becomes the root port temporarily, which absolutely gets po1 blocked.

try to set mst interface priorities to bieas ur preferred ports, and the commands should be: 

int po1
spanning-tree mst 0 port-priority 64
int g1/2
spanning-tree mst 0 port-priority 240

--

i hope this will help somehow G

again gonna lab this later (and will dive deeper..., and if u need more official guide, i would check Cisco's official mst guide : https://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/24248-147.html  and u have o lot youtube videos or other famous traning  websites 

 

-Enes

more Cisco?!
more Gym?!

@Enes Simnica I will definitely have to look some more into this. Thank you for the pointers.

I have now shut down the connections between SW3 and SW4, and I am trying to shutdown gi0/1 of the LAG again and the P2p Dispute is still an issue as shown below.

rasmuselmholt_0-1751551549800.png

I will look into it and return if I find a cause for this behaviour.

 

Below video explains' roots select in mst

There are two root' one per instance and one for cst 

What I think you face is root of cst is re-elect

https://youtu.be/h8iuNNfiDW4?si=RxTdN93eY9MldZ5W

 

Hi @rasmus.elmholt 

I check your issue' can you confirm you config same region in all SW or different region?

MHM

Hi @MHM Cisco World ,

I have now watched the video you linked but I don't think it is relevant to the issue I see.

All switches are in the same region with the same MST configuration and VTP/VLANs.

Can I see 

Show spanning tree mst config 

For all SW

MHM