How-to: Configure Spanning Tree Protocol Part3

After explaining how STP works to ensure your network is free of bridging loops in previous posts, we are going directly to a configuration example. We will use a simple topology in the diagram below and configure the switches to accomplish the tasks listed below.

Task1: Configure SW0 as a root bridge for both VLAN1,2.

For SW0 to be a root switch you have to manipulate the BID to make it the lowest in the network. The command spanning-tree vlan 1,2 root primary is used to automatically set the priority.

SW0(config)#spanning-tree vlan 1,2 root primary

Task2: Configure SW1 as a backup root bridge for VLAN1 only.

For SW1 to act as a backup in case of SW0 failure; its BID value must be manipulated to be lower that SW2 but higher than SW0. You can use the command spanning-tree vlan 1 root secondary to accomplish the task automatically.

SW1(config)#spanning-tree vlan 1 root secondary

Task3: Configure SW2 F0/14 as a root port for both VLAN1,2.

Root port election is based firstly on the lowest cost, but in our case both ports (13,14) have the same cost and both are connected to the same bridge, so if everything was left to default F0/13 will be elected as a root port using the last tie breaker (lowest PID). This task can be configured by manipulating port cost or PID. Let us will use the port cost method for VL1 and the PID to the VL2.

!--- increase the cost of f0/13 over 19 or lower the cost of f0/14 below 19
SW2(config-if)#int f0/13
SW2(config-if)#spanning-tree vlan 1 cost 100

!--- PID must be configured on SW0 not SW2
SW0(config)#int f0/17
SW0(config-if)#spanning-tree vlan 2 port-priority 64

Task4: Make sure SW1 is the designated switch for the segment between SW1&SW2 for VLAN1

Changing the priority on SW1 in task2 ensures that it has a lower BID for VLAN1 than SW2, hence it is selected as a designated switch and its ports are in the forwarding state.

Verification and Troubleshooting:

  • SW0 is root bridge for both VLAN1,2 and all its ports are in the forwarding state as shown below.
SW0#show spanning-tree vlan 1,2

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     001b.90b4.6900
             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     001b.90b4.6900
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13           Desg FWD 19        128.15   P2p
Fa0/16           Desg FWD 19        128.18   P2p
Fa0/17           Desg FWD 19        128.19   P2p 

VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    24578
             Address     001b.90b4.6900
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24578  (priority 24576 sys-id-ext 2)
             Address     001b.90b4.6900
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13           Desg FWD 19        128.15   P2p
Fa0/16           Desg FWD 19        128.18   P2p
Fa0/17           Desg FWD 19         64.19   P2p

  • SW1 is a backup for the root bridge for VLAN1 only.
  • SW1 is the designated switch for VLAN1 and both ports f0/16-17 are forwarding for VL1.
SW1#sh spanning-tree vlan 1,2

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     001b.90b4.6900
             Cost        19
             Port        15 (FastEthernet0/13)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    28673  (priority 28672 sys-id-ext 1)
             Address     001b.904f.ec00
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13           Root FWD 19        128.15   P2p
Fa0/16           Desg FWD 19        128.18   P2p
Fa0/17           Desg FWD 19        128.19   P2p 

VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    24578
             Address     001b.90b4.6900
             Cost        19
             Port        15 (FastEthernet0/13)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     001b.904f.ec00
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13           Root FWD 19        128.15   P2p
Fa0/16           Altn BLK 19        128.18   P2p
Fa0/17           Altn BLK 19        128.19   P2p

  • F0/14 on SW2 is a root port for both VL1 and VL2.
  • SW2 is the designated switch for VL2 without any configuration (lower MAC).
SW2#sh spanning-tree vlan 1,2

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     001b.90b4.6900
             Cost        19
             Port        16 (FastEthernet0/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     001b.904f.cc00
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13           Altn BLK 100       128.15   P2p
Fa0/14           Root FWD 19        128.16   P2p
Fa0/16           Altn BLK 19        128.18   P2p
Fa0/17           Altn BLK 19        128.19   P2p 

VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    24578
             Address     001b.90b4.6900
             Cost        19
             Port        16 (FastEthernet0/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     001b.904f.cc00
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/13           Altn BLK 19        128.15   P2p
Fa0/14           Root FWD 19        128.16   P2p
Fa0/16           Desg FWD 19        128.18   P2p
Fa0/17           Desg FWD 19        128.19   P2p

Thats all for this post, I hope it was clear enough to improve your understanding of STP. In coming posts we may explore more subjects related to STP.

Check Also

Best AI tools list