Search This Blog

Thursday, August 30, 2012

STP and port-priority


Switches running STP are exchanging BPDU’s, using the information received and after selecting the root bridge for the STP domain, the non-root switches uses the following parameters, in the following order, when selecting which will be the port toward the root bridge:

     1.        A lower Root Bridge ID.
     2.       A lower path cost to the Root.
     3.       A lower Sending Bridge ID.
     4.       A lower Sending Port ID.

Now I want to refer to the port-priority issue so let’s take the following example:


SW3560 and SW3550 are connected through two interfaces, 0/1 and 0/24, where both are in trunk mode passing VLAN 1 and 2.

After STP convergence ends SW3550 takes the role of the root bridge and SW3560 needs to select the root port toward SW3550, because the root-bridge, the path cost and the sending bridge ID are the same, the only parameter left is the sending port ID.

The sending port ID is 16 bit parameter which contains two fields: the port priority and port index. The port priority is 128 by default while the port index is unique for each port.
As a result of this SW3560 select port Gi0/1 as the root port, for both VLAN’s, due to lower sending port ID of SW3550, and blocks port gi0/24.

SW3550 Output:
SW3550#sh spanning-tree

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0008.21f6.6980
             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     0008.21f6.6980
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/24           Desg FWD 19        128.24   P2p

         
VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    32770
             Address     0008.21f6.6980
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     0008.21f6.6980
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/24           Desg FWD 19        128.24   P2p

SW3560 Output:
SW3560#sh spanning-tree

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0008.21f6.6980
             Cost        19
             Port        1 (GigabitEthernet0/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     108c.cf99.e980
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi0/1            Root FWD 19        128.1    P2p
Gi0/24           Altn BLK 19        128.24   P2p

         
VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    32770
             Address     0008.21f6.6980
             Cost        19
             Port        1 (GigabitEthernet0/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     108c.cf99.e980
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi0/1            Root FWD 19        128.1    P2p
Gi0/24           Altn BLK 19        128.24   P2p

Now this is quite good as L2 redundancy between these two switches but if we would like to load-sharing between those two links? One VLAN per link?

In order for SW3560 to use Gi0/1 for VLAN 1 and Gi0/24 for VLAN2 we can use port-priority, on SW3550, as follows:
SW3550(config-if)#spanning-tree vlan 2 port-priority ?
  <0-240>  port priority in increments of 16

SW3550(config-if)#spanning-tree vlan 2 port-priority 0

We can select port-priority per port or per VLAN ranging from 0 to 240 where lower is better.
The result on SW3560:
SW3560#sh spanning-tree

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0008.21f6.6980
             Cost        19
             Port        1 (GigabitEthernet0/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     108c.cf99.e980
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi0/1            Root FWD 19        128.1    P2p
Gi0/24           Altn BLK 19        128.24   P2p

         
VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    32770
             Address     0008.21f6.6980
             Cost        19
             Port        24 (GigabitEthernet0/24)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     108c.cf99.e980
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi0/1            Altn BLK 19        128.1    P2p
Gi0/24           Root FWD 19        128.24   P2p

SW3560 has blocked port gi0/24 for VLAN1 and port gi0/1 for VLAN2.
Trying to do the same on the SW3560 won’t do anything and wouldn’t change the topology, the port-priority configuration helps “other” switches to take decision based on this parameter, the port-priority wouldn’t have affect locally on the configured switch.

Now let’s add one more switch to the equation:


 The same for this situation, after STP convergence, SW2950-3 blocked port fa0/24 for both VLAN’s.

After configuring the following on SW3560:
SW3560(config)#int gigabitEthernet 0/23
SW3560(config-if)#spanning-tree vlan 2 port-priority 0

The result on SW2950-3:
SW2950-3#sh spanning-tree

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     0008.21f6.6980
             Cost        38
             Port        1 (FastEthernet0/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0007.eb59.d780
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Root FWD 19        128.1    P2p
Fa0/11           Desg FWD 19        128.11   Edge P2p
Fa0/24           Altn BLK 19        128.24   P2p

         
VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    24578
             Address     0008.21f6.6980
             Cost        38
             Port        24 (FastEthernet0/24)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     0007.eb59.d780
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Altn BLK 19        128.1    P2p
Fa0/24           Root FWD 19        128.24   P2p

We can see that VLAN 2 has changed port Fa0/24 to forwarding and blocked port Fa0/1.












No comments:

Post a Comment