Ok so this point specifically has been causing me alot of headache for the past 2 hours and thank God i was able to figure out how it works , am writing it here because i know very well i will forget it after 1 hour from now. So here's the catch how does a switch choose a root port it all cuts down to the below specific 4 tie breakers.
– Port with the lowest accumulated path cost based on BW [ include cost to root + interface cost ]
– Lowest next hop bridge ID to the root bridge [ bridge ID here stands for designated switch (priority + MAC address)]
– Lowest port priority (1B and is 128 by default) [ port priority of neighbor switch - in most cases root switch]
– Lowest port ID (1B)
So now if i have a topology for MST instance 1 ... me h ... what is MST instance 1 , MST is a sentence of spanning tree where a set of Vlans is associated to 1 STP instance so i'll focus here on MST 1 and by the way below is the configuration i used for MST for memorizing
On Sw1
spanning-tree mode mst
spanning-tree mst configuration
instance 1 vlan 1-100
instance 2 vlan 101 - 200
instance 3 vlan 201 - 1055
exit
spanning-tree mst 1 root primary
Ok now just close your eyes and imagine woooosh spanning tree MST 1 all working with switch 1 working fine let's check switch 2 mst 1 results
Rack1SW2-basicIP#show spanning-tree mst 1
##### MST1 vlans mapped: 1-100
Bridge address 001b.0c7c.a200 priority 28673 (28672 sysid 1)
Root address 001b.2aa7.8200 priority 24577 (24576 sysid 1)
port Fa0/13 cost 200000 rem hops 19
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13 Root FWD 200000 128.15 P2p
Fa0/14 Altn BLK 200000 128.16 P2p
Fa0/15 Altn BLK 200000 128.17 P2p
Fa0/16 Altn BLK 200000 128.18 P2p
Fa0/17 Altn BLK 200000 128.19 P2p
Fa0/18 Altn BLK 200000 128.20 P2p
Fa0/19 Desg FWD 200000 128.21 P2p
Fa0/20 Desg FWD 200000 128.22 P2p
Fa0/21 Desg FWD 200000 128.23 P2p
Fa0/24 Desg FWD 200000 128.26 P2p
Task: I want port Fa0/19 to be the root port (i.e) layer 2 traffic will move from SW2 through SW3 not through SW1
Now remember the tie breakers what's the first Tie breaker ... yes its the cost
Now the point don't be FOOLED by the costs you see on the above output those are the interface cost , remember well root port is chosen based on the total cost [ include cost to root + interface cost ]
Ok let's now compare between the two interfaces Fa0/19 and Fa0/13
– Port with the lowest accumulated path cost based on BW [ include cost to root + interface cost ]
– Lowest next hop bridge ID to the root bridge [ bridge ID here stands for designated switch (priority + MAC address)]
– Lowest port priority (1B and is 128 by default) [ port priority of neighbor switch - in most cases root switch]
– Lowest port ID (1B)
So now if i have a topology for MST instance 1 ... me h ... what is MST instance 1 , MST is a sentence of spanning tree where a set of Vlans is associated to 1 STP instance so i'll focus here on MST 1 and by the way below is the configuration i used for MST for memorizing
On Sw1
spanning-tree mode mst
spanning-tree mst configuration
instance 1 vlan 1-100
instance 2 vlan 101 - 200
instance 3 vlan 201 - 1055
exit
spanning-tree mst 1 root primary
Ok now just close your eyes and imagine woooosh spanning tree MST 1 all working with switch 1 working fine let's check switch 2 mst 1 results
Rack1SW2-basicIP#show spanning-tree mst 1
##### MST1 vlans mapped: 1-100
Bridge address 001b.0c7c.a200 priority 28673 (28672 sysid 1)
Root address 001b.2aa7.8200 priority 24577 (24576 sysid 1)
port Fa0/13 cost 200000 rem hops 19
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13 Root FWD 200000 128.15 P2p
Fa0/14 Altn BLK 200000 128.16 P2p
Fa0/15 Altn BLK 200000 128.17 P2p
Fa0/16 Altn BLK 200000 128.18 P2p
Fa0/17 Altn BLK 200000 128.19 P2p
Fa0/18 Altn BLK 200000 128.20 P2p
Fa0/19 Desg FWD 200000 128.21 P2p
Fa0/20 Desg FWD 200000 128.22 P2p
Fa0/21 Desg FWD 200000 128.23 P2p
Fa0/24 Desg FWD 200000 128.26 P2p
Task: I want port Fa0/19 to be the root port (i.e) layer 2 traffic will move from SW2 through SW3 not through SW1
Now remember the tie breakers what's the first Tie breaker ... yes its the cost
Now the point don't be FOOLED by the costs you see on the above output those are the interface cost , remember well root port is chosen based on the total cost [ include cost to root + interface cost ]
Ok let's now compare between the two interfaces Fa0/19 and Fa0/13
Rack1SW2-basicIP#show spanning-tree interface Fa0/19 cost <<<<<<<<<<<< Interface cost
MST0 200000
MST1 200000
MST2 200000
Rack1SW2-basicIP#show spanning-tree interface Fa0/19 rootcost <<<<<<<< Cost to root
MST0 0
MST1 200000
MST2 0
Fa0/19 cost for MST1 is : 400000
Rack1SW2-basicIP#show spanning-tree interface Fa0/13 rootcost
MST0 0
MST1 0
MST2 200000
Rack1SW2-basicIP#show spanning-tree interface Fa0/13 cost
MST0 200000
MST1 200000
MST2 200000
Fa0/13 cost for MST2 is : 200000
So noting the above output whatever cost value i assign to the interface still there's 20000 cost to the root , so as a workaround we'll higher the interface cost on interfaces connecting to SW1 and then change the cost on ports connecting to SW3 as per below
Rack1SW2-basicIP(config)#int range fa0/13 - 15
Rack1SW2-basicIP(config-if-range)#spanning-tree mst 1 cost 300000
Rack1SW2-basicIP(config-if-range)#exit
Rack1SW2-basicIP(config)#int fa0/19
Rack1SW2-basicIP(config-if)#spanning-tree mst 1 cost 100
Rack1SW2-basicIP(config-if)#^Z
Rack1SW2-basicIP#show
*Mar 7 23:43:06.359: %SYS-5-CONFIG_I: Configured from console by console
Rack1SW2-basicIP#show span
Rack1SW2-basicIP#show spanning-tree mst 1
##### MST1 vlans mapped: 1-100
Bridge address 001b.0c7c.a200 priority 28673 (28672 sysid 1)
Root address 001b.2aa7.8200 priority 24577 (24576 sysid 1)
port Fa0/19 cost 200100 rem hops 18 <<<<<<<< Notice best cost is 200100 which is cost of Fa0/19
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13 Altn BLK 300000 128.15 P2p
Fa0/14 Altn BLK 300000 128.16 P2p
Fa0/15 Altn BLK 300000 128.17 P2p
Fa0/16 Altn BLK 200000 128.18 P2p
Fa0/17 Altn BLK 200000 128.19 P2p
Fa0/18 Altn BLK 200000 128.20 P2p
Fa0/19 Root FWD 100 128.21 P2p
Fa0/20 Altn BLK 200000 128.22 P2p
Fa0/21 Altn BLK 200000 128.23 P2p
Fa0/24 Desg LRN 200000 128.26 P2p
Now that we're done with the port-cost part let's move to the priority part , i already explained in a previous blog post that changing priority must be done on the neighbor switch that's because of the designated port ID is being compared .... Now after some research on the problem. I believe its not only the neighbor switch that we should care about ...
Because before we think about using point 3 which is the port priority the switch use as a tie breaker the below.
[ bridge ID here stands for next hop designated switch (priority + MAC address) ]
So in most cases if point 1,2 are matched most probably point 3 will be reached on a switch that has blocked ports and is connected to the root itself , that's why it was logical to impact port priority on neighbor switch not on our switch because tie breaker works on the designated port over the segment.
Because before we think about using point 3 which is the port priority the switch use as a tie breaker the below.
[ bridge ID here stands for next hop designated switch (priority + MAC address) ]
So in most cases if point 1,2 are matched most probably point 3 will be reached on a switch that has blocked ports and is connected to the root itself , that's why it was logical to impact port priority on neighbor switch not on our switch because tie breaker works on the designated port over the segment.
Now to conclude this bullshit and many debates all over the forums , now to conclude if you want to make changes to the spanning tree convergence (i.e make an interface takes a separate role than the one it already had simply issue the below command on both interfaces the one that's root and the one that's notshow
First check the total cost to root between both interfaces equal or not ?
if equal
Check the designated bridge priority fied
if equal
Check designated bridge MAC address
if equal
Check designated port ID priority
if equal
Switch will choose the least port ID number