Sunday, September 22, 2013

Understanding Spanning-Tree Root-Port Election

The STP Root Por selections follows the following sequence of FOUR conditions:

1. Lower Root Bridge ID
2. Lower Path Cost to the Root bridge.
3. Lower sending Bridge ID
4. Lower Sending Port ID
Lab1:
case-1-1.png
The root path cost on both fa0/1 and fa0/2 (SW4) is the same
First before looking the port-ID ,SW4 looks the BID of SW2 and SW3 (the neighbors swiches of SW4),SW2 has (advertises) a better BID than SW3 ,The BID= priority+mac address, here since the priority of SW2 and SW3 is the same=32769 , the mac address wil be used ,the mac address of SW2(0010.11BA.32CB) is lower than the mac address of SW3 (0060.7011.98C3) thus fa0/2 receives a better BID of BPDUs so fa0/2 will the root port:

SW2#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 000A.F3CC.3EA1
Cost 19
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 0010.11BA.32CB
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Desg FWD 19        128.2    P2p
Fa0/1            Root FWD 19        128.1    P2p

SW3#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 000A.F3CC.3EA1
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

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

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root FWD 19        128.2    P2p
Fa0/1            Desg FWD 19        128.1    P2p

Now let's configure the BID of SW3 to be better than the BID of SW2:

SW3(config)#spanning-tree vlan 1 priority 8192

Now the BID of SW3 is 8193:0060.7011.98C3 as shown by the show spann of SW3 below and the BID of SW2 is 32769:0010.11BA.32CB ,so fa0/1 receives a better BID from SW3 thus fa0/1 is the root port for SW4 as shown by the show spann on SW4 below:

SW3(config)#do show spann
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 000A.F3CC.3EA1
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 8193 (priority 8192 sys-id-ext 1)
Address 0060.7011.98C3
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root FWD 19        128.2    P2p
Fa0/1            Desg FWD 19        128.1    P2p

SW4#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 000A.F3CC.3EA1
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 0060.2F98.0E5A
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Altn FWD 19        128.2    P2p
Fa0/1            Root FWD 19        128.1    P2p

Lab2:
case2.pngSW1 is the root bridge,Remember all ports of a root bridge are a designated ports not a Root Ports as shown by the following output:

SW1(config)#do show spa
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0006.2A94.4A8D
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
             Address     0006.2A94.4A8D
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

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

let's see with SW2:

SW2 chooses Fa0/10 as a Root Port and fa0/1 as a Bolocked Port.
how SW2 chooses fa0/10 as a Root Port?

SW2 needs to pick a single Root Port to reach the Root Bridge SW1 .After electing SW1 as the Root Bridge, SW2 evaluates Root Path Cost. Because both SW2:fa0/1 and SW2:fa0/10 have the same cost toward the Root Bridge, there is a tie. To break the tie, SW2 considers the Sending BID that it is receiving over both links.But both ports are connected to the same bridge,causing SW2 to receive the same Sending BID on both links. This results in another tie.Finally, SW2 evaluates the Port ID received in Configuration BPDUs on both ports. SW2:fa0/1 is receiving a Port ID of SW1:fa0/10, and SW2:fa0/10 is receiving a Port ID of SW1:fa0/1. SW2 chooses the lower value for a Root Port, finally fa0/10 is the root port while fa0/1 is a blocked port.
So it is the received values that are used here. SW2 does not evaluate its own BID and Port ID; it is looking at the values contained in the BPDUs being received from SW1.

SW2(config)#do show spann
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0006.2A94.4A8D
             Cost        19
             Port        10(FastEthernet0/10)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     00D0.FF26.2375
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

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

The Port-ID is the priority of the port+the interface number
To ensure that fa0/1 becomes the Root Port,we will increase the priority of fa0/10 of SW1:

SW1(config)#int fa0/1
SW1(config-if)#spanning-tree vlan 1 port-priority ?
  <0-240>  port priority in increments of 16
SW1(config-if)#spanning-tree vlan 1 port-priority 240

verify the priority of fa0/1 on SW1:
SW1(config-if)#do show span
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0006.2A94.4A8D
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
             Address     0006.2A94.4A8D
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        240.1    P2p
Fa0/10           Desg FWD 19        128.10   P2p

As expected ,On SW2 now fa0/1 is the Root Port and fa0/10 is the Blocked port because now fa0/1 receives the lowest port-ID 128 from the port fa0/10 and fa0/10 receives the port-ID 240.1 from the port fa0/1 as shown by the following output:

SW2#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0006.2A94.4A8D
             Cost        19
             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     00D0.FF26.2375
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

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

Lab3:
case3.png
SW1 is the root bridge and it's connected to SW2 via a Hub:

SW1 is the root bridge,we know that all ports of a Root Bridge are in Designated roles as shown in the following output:

SW1#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     00E0.B0D2.5A23
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
             Address     00E0.B0D2.5A23
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

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


Let's see on SW2,fa0/2 is the Root Port while fa0/3 is a Blocked Port:
SW2#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     00E0.B0D2.5A23
             Cost        19
             Port        2(FastEthernet0/2)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     00D0.BA83.2AA4
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Root FWD 19        128.2    Shr
Fa0/3            Altn BLK 19        128.3    Shr

Let's look SW2 which is the interesting case.
SW2 needs to select one Root Port.After electing SW1 as the Root Bridge, SW2 evaluates Root Path Cost. Because both SW2:fa0/2 and SW2:fa0/3 have the same cost toward the Root Bridge, there is a tie. To break the tie, SW2 considers the Sending BID that it receives over both links.But both ports are connected to the same Root Bridge, which causes SW2 to receive the same Sending BID on both links. There is another tie. SW2 evaluates the Port ID received in Configuration BPDUs on both ports. SW2:fa0/2 is receiving a Port ID 128.1 of SW1:fa0/1, and SW2:fa0/3 is receiving a Port ID 128.1 of SW1:fa0/1. There is a tie because the sender Port ID is the same from SW1 which is 128.1 on both ports of SW2. To override the tie, SW2 will evaluate its own local Port ID values (the lower Port ID will be the Root Port),so fa0/2 is RP and fa0/3 is BP.
Notice that the condition: "Using the Local Port ID Value As a Tie-Breaker "is not included in the four conditions described above.
 
STP Root port selection becomes:

1. Lower Root Bridge ID
2. Lower Path Cost to the Root bridge.
3. Lower sending Bridge ID
4. Lower Sending Port ID
5. Lower Local port-id

the fifth tie breaker is the local Switch port-id, the lowest is prefered.
This is the only case where the local Port ID is used.

To ensure that fa0/3 becomes the root port we will either increase the port-priority of fa0/2 or decrease the port-priority of fa0/3:

Let' go:

SW2(config)#int fa0/3
SW2(config-if)#spanning-tree vlan 1 port-priority 16

Now fa0/3 is the Root port and fa0/2 is the Blocked Port as shown by the following output:

Switch#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     00E0.B0D2.5A23
             Cost        19
             Port        3(FastEthernet0/3)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     00D0.BA83.2AA4
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Altn BLK 19        128.2    Shr
Fa0/3            Root FWD 19        16.3     Shr


Notice when connecting the Switch with a Hub the link Type displayed in the show spanning-tree which is Shr.

By definition:
RSTP uses three Link Types. 
-Point-to-Point Link - This is connected to another switch. If a switchport is operating at full duplex and is receiving Hellos, then it is a Point-to-Point Link.
-Shared Link - This is connected to something like a hub. Hellos are being received but it is operating at half duplex.
-Edge - This is connected to an end-device. Equivalent to PortFast in traditional 802.1d.
Related Posts Plugin for WordPress, Blogger...