1

I was reading about how STP determines which port to block. I was looking at this url https://ciscoiseasy.blogspot.co.uk/2010/10/lesson-20-spanning-tree-protocol.html explicitly this section

The following algorithm is used to determine the root port or designated port (in order):

  1. Prefer the lowest Root Path Cost.
  2. In case of the same Root Path Cost, prefer the lowest Bridge ID of the designated switch (the neighbor that sends BPDUs).
  3. In case of receiving BPDUs on multiple ports from the same designated switch (BPDU sender), prefer the lowest Port ID (known also as port priority) of the sender. That parameter has a default value 128 and is configurable.
  4. In case of all above are did not resolve the problem, prefer the lowest Port ID of the BPDU sender.

The first 3 parts I understand fine. It's the last one that I wanted some clarification on.

The website goes on to show and example where the BPDU frame is being sent from a switch (SW3) on interfaces Fa0/3 and Fa0/4 to another switch (SW4). SW4 chooses it's port Fa0/1 because that port is connected to Fa0/3 and 3 is lower than 4.

Example

My question is:

Is that really as simple as it sounds? A simple calculation on which port number is lower or is there more to it? What would happen if I had Po1 and Fa0/1 and all other factors were the same?

5

If you do show spanning-tree, the port ID is the Nbr element in the Prio.Nbr column. For this example Gi0/0 is port 1, Gi0/1 is port 2, Po1 is port 65. You will find that all the interfaces of a type are grouped and the port IDs are ordered within that group.

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0000.ab15.f500
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0000.ab15.f500
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  15  sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    Shr 
Gi0/1               Desg FWD 4         128.2    Shr 
Gi0/2               Desg FWD 4         128.3    Shr 
Gi0/3               Desg FWD 4         128.4    Shr 
Gi1/0               Desg FWD 4         128.5    Shr 
Gi1/1               Desg FWD 4         128.6    Shr 
Gi1/2               Desg FWD 4         128.7    Shr 
Po1                 Desg LIS 4         128.65   Shr 
1

Simple: it calculates the lowest port-priority by looking at the interface number of the upstream switch or bridge. If we have two ports connected to the same upstream bridge then the local port connected to the interface of the upstream bridge having the lowest number will have lower port-priority and thus will be elected as root port assuming that they have equal cost and same bridgeID.

Spanning-tree looks at three things to determine the root port and alternate port and the port-priority is at third place.

  1. Cost: Lower is better. So the port with the lower cost to reach the root bridge will be elected as root port.
  2. BridgeID: If the cost is tie, then it will look for the lowest bridgeID upstream.
  3. Port-Priority: If the upstream bridgeID is the same, meaning that both ports are connected to the same upstream bridge then it will look for the lowest Port-Priority of the upstream bridge.

Now Port-Priority number of the upstream bridge can be found by issuing the following command.

SW1(config)#do show spanning-tree vlan 1 detail

 VLAN0001 is executing the rstp compatible Spanning Tree protocol
  Bridge Identifier has priority 32768, sysid 1, address 0051.cf8d.7c01
  Configured hello time 2, max age 20, forward delay 15, transmit hold-count 6
  Current root has priority 32768, address 0053.cf8d.7c03
  Root port is 3 (GigabitEthernet0/2), cost of root path is 4
  Topology change flag not set, detected flag not set
  Number of topology changes 14 last change occurred 00:57:20 ago
          from GigabitEthernet0/2
  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 1 (GigabitEthernet0/0) of VLAN0001 is designated forwarding 
   Port path cost 4, Port priority 128, Port Identifier 128.1.
   Designated root has priority 32768, address 0053.cf8d.7c03
   Designated bridge has priority 32769, address 0051.cf8d.7c01
   Designated port id is 128.1, designated path cost 4
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 2
   Link type is shared by default
   BPDU: sent 7222, received 34

 Port 2 (GigabitEthernet0/1) of VLAN0001 is designated forwarding 
   Port path cost 4, Port priority 128, Port Identifier 128.2.
   Designated root has priority 32768, address 0053.cf8d.7c03
   Designated bridge has priority 32769, address 0051.cf8d.7c01
   Designated port id is 128.2, designated path cost 4
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1

As you can see the upstream Interface Port-Priorities are

Designated port id is 128.1
Designated port id is 128.2

Now in the Port-Priority the value after the . corresponds to the interface number. Since in this case the interface number is Gigabit0/1, so the Port-Priority will become 128.1.

But you can lower it if you want to do some traffic engineering. For example:

SW1(config-if)#spanning-tree vlan 1 port-priority 64

Since 128.1 is lower than 128.2, it will choose port connected to 128.1 as root bridge and will put the other one in blocking state.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.