Spanning-tree revisited


In this post i will shed some light on some spanning-tree info that has been floating around. But also an explanation why i choose a non-obvious answer to an IPexpert question.

Specifically 2 things.

The first one is the selection of ports and what _exactly_ selects the root port.

The second thing is selection of a designated bridge and why the typical phrasing of a question might also be more complex than what you expect.

The topology i will be using is as such:

Topology

Topology

(Note: Please pay attention to the fact that i have manually modified the cost of the G0/1 interface on Cat1 and Cat2 in order to be able to use this port in the output below).

Topic 1:

——–

Lets start out with a premise that states, that a root port is selected based on the following:

1) Lowest Path Cost to Root Bridge

2) Lowest Sender Bridge ID

3) Lowest Sender Port ID

I will go through tiebreak number 1 quite fast, since the lowest cost path to the root will always be chosen.

This is the case for our Cat3 switch. The lowest cost path is through F0/21 with a path cost of 19 (Cat1 sends out cost = 0 and Cat3 adds 19). We can verify this:

Cat3#sh span vl 1
VLAN0001
Spanning tree enabled protocol rstp
Root ID    Priority    24577
Address     0012.01fa.8e00
Cost        19
Port        21 (FastEthernet0/21)
Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Cat2 on the other hand has two links with equal cost between them (because i manually set the cost on both Cat1 and Cat2). So which one to choose?

Well, the next tiebreaker down the list states the lowest sender bridge ID. Since both links are from the same switch, this tiebreaker cant be used.

The third one down the list is where the action takes place. While “Lowest Sender Port ID” can be considered correct, i dont fully agree with it. Its more complex than a simple number. Each Port ID is combined of the Port Priority (default is 128) and the locally assigned Port Number. All of this is on the sender bridge!

Lets take a look on Cat1:

Cat1#sh span vl 1 de
VLAN0001 is executing the rstp compatible Spanning Tree protocol
Bridge Identifier has priority 24576, sysid 1, address 0012.01fa.8e00
Configured hello time 2, max age 20, forward delay 15, transmit hold-count 6
We are the root of the spanning tree
Topology change flag not set, detected flag not set
Number of topology changes 6 last change occurred 01:02:54 ago
from FastEthernet0/23
Times:  hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
Port 21 (FastEthernet0/21) of VLAN0001 is designated forwarding
Port path cost 19, Port priority 128, Port Identifier 128.21.
Designated root has priority 24577, address 0012.01fa.8e00
Designated bridge has priority 24577, address 0012.01fa.8e00
Designated port id is 128.21, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
BPDU: sent 2275, received 10
Port 23 (FastEthernet0/23) of VLAN0001 is designated forwarding
Port path cost 19, Port priority 128, Port Identifier 128.23.
Designated root has priority 24577, address 0012.01fa.8e00
Designated bridge has priority 24577, address 0012.01fa.8e00
Designated port id is 128.23, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
BPDU: sent 1889, received 3
Port 49 (GigabitEthernet0/1) of VLAN0001 is designated forwarding
Port path cost 19, Port priority 128, Port Identifier 128.49.
Designated root has priority 24577, address 0012.01fa.8e00
Designated bridge has priority 24577, address 0012.01fa.8e00
Designated port id is 128.49, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
BPDU: sent 2280, received 5

Its a long output, but with lots of useful information. What we are interested in, is port 23 and port 49. Port 23 is F0/23 and Port 49 is G0/1. Each of these has a Priority of 128 at the moment. The combined Port ID is then 128.23 for F0/23 and 128.49 for G0/1.

So right now we should see F0/23 (128.23) being the Root Port on Cat2:

Cat2#sh span vl 1
...
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1               Altn BLK 19        128.1    P2p
Fa0/19              Altn BLK 19        128.21   P2p
Fa0/23              Root FWD 19        128.25   P2p

And with more detail:

Cat2#sh span vl 1 de
...
Port 1 (GigabitEthernet0/1) of VLAN0001 is alternate blocking
Port path cost 19, Port priority 128, Port Identifier 128.1.
Designated root has priority 24577, address 0012.01fa.8e00
Designated bridge has priority 24577, address 0012.01fa.8e00
Designated port id is 128.49, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
BPDU: sent 5, received 2402
...
Port 25 (FastEthernet0/23) of VLAN0001 is root forwarding
Port path cost 19, Port priority 128, Port Identifier 128.25.
Designated root has priority 24577, address 0012.01fa.8e00
Designated bridge has priority 24577, address 0012.01fa.8e00
Designated port id is 128.23, designated path cost 0
Timers: message age 15, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
BPDU: sent 3, received 2014

Everything looks fine. We now have a topology that looks like this:

Topology - G0/1 Block

But lets change the Priority on Cat1’s G0/1 interface:

Cat1(config)#int g0/1
Cat1(config-if)#spanning-tree port-priority 112

And verify on Cat2:

Cat2#sh span vl 1
...
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1               Root FWD 19        128.1    P2p
Fa0/19              Altn BLK 19        128.21   P2p
Fa0/23              Altn BLK 19        128.25   P2p
Cat2#sh span vl 1 de
...
Port 1 (GigabitEthernet0/1) of VLAN0001 is root forwarding
Port path cost 19, Port priority 128, Port Identifier 128.1.
Designated root has priority 24577, address 0012.01fa.8e00
Designated bridge has priority 24577, address 0012.01fa.8e00
Designated port id is 112.49, designated path cost 0
Timers: message age 15, forward delay 0, hold 0
Number of transitions to forwarding state: 2
Link type is point-to-point by default
BPDU: sent 8, received 2494
...
Port 25 (FastEthernet0/23) of VLAN0001 is alternate blocking
Port path cost 19, Port priority 128, Port Identifier 128.25.
Designated root has priority 24577, address 0012.01fa.8e00
Designated bridge has priority 24577, address 0012.01fa.8e00
Designated port id is 128.23, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
BPDU: sent 3, received 2106

We can see that it indeed has changed.

Our topology now looks like this:

Topology - F0/23 Block

So this means that Port Priority is an important part of the Port ID, so simply saying Lowest Sender Port ID, is correct, but only half the truth.

Topic 2:

———-

The second thing is in a way related to Topic 1.

As with Topic number 1, for a given segment, a designated bridge needs to be selected. Take the link between Cat2 and Cat3. Either Cat2 or Cat3 needs to be the designated bridge and have its link being in a forwarding state. The other bridge will put its link into a blocking state.

The Tiebreaker here will be the sending bridge with the lowest Bridge ID, which is made up of the priority of the sending bridge along with its Mac address.

Seeing as the Mac address will be unique, this will be the Tie Breaker. Thats why i in my comment stated that mac address will be a tiebreaker, all other things being equal.

To verify this:

On Cat2:
Cat2#sh span vl 1
...
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1               Altn BLK 19        128.1    P2p
Fa0/19              Altn BLK 19        128.21   P2p
Fa0/23              Root FWD 19        128.25   P2p

We can see that the F0/19 link is blocking, meaning that Cat3 is the designated switch, which we verify here:

Cat3#sh span vl 1
...
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/19              Desg FWD 19        128.19   P2p
Fa0/21              Root FWD 19        128.21   P2p

F0/19 is in a forwarding state and it is designated.

If we run the following on each switch:

Cat2#sh span vl 1 br id
VLAN0001         8001.0016.9d94.8e80
Cat3#sh span vl 1 br id
VLAN0001         8001.000d.28a7.f600

We clearly see that Cat3 has the lowest total Bridge ID.

I hope that by explaining these two topics, you will realize _why_ something as “Sender Port ID” and “Sender Bridge ID” cause a selection and simply not reiterate what books tell you.