How to configure STP root and load balancing using Cisco PVST/PVST+?
Configuring STP on Cisco switches is straightforward since STP is on by default. This default ensures loop-free topologies when connecting Cisco Switches and is very useful in Campus and Access LANs.
For our example, we’ll be using the network topology below.
The switches are in a triangle with switchA as ROOT of the STP. All switch port connections between switches are using an ISL trunk and are configured using the port default. SwitchC port fa0/1 is blocking.
SWITCH | BRIDGE ID | VLAN | SWITCH | BRIDGE ID | VLAN | SWITCH | BRIDGE ID | VLAN | ||
A | 32769 000f.2323.6800 | 1 | A | 32770 000f.2323.6800 | 2 | A | 32771 000f.2323.6800 | 3 | ||
B | 32769 0011.5c00.ba80 | 1 | B | 32770 0011.5c00.ba80 | 2 | B | 32771 0011.5c00.ba80 | 3 | ||
C | 32769 0011.925f.aa80 | 1 | C | 32770 0011.925f.aa80 | 2 | C | 32771 0011.925f.aa80 | 3 |
sh vlan VLAN Name Status Ports ---- -------------------------------- ------- --------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 2 Sales active 3 Accounting active
interface FastEthernet0/1 switchport mode dynamic desirable ! interface FastEthernet0/2 switchport mode dynamic desirable !
switchA#sh spanning-tree
VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address 000f.2323.6800 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 000f.2323.6800 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/2 Desg FWD 19 128.2 P2p Fa0/30 Desg FWD 19 128.30 P2p VLAN0002 Spanning tree enabled protocol ieee Root ID Priority 32770 Address 000f.2323.6800 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 000f.2323.6800 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/2 Desg FWD 19 128.2 P2p VLAN0003 Spanning tree enabled protocol ieee Root ID Priority 32771 Address 000f.2323.6800 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32771 (priority 32768 sys-id-ext 3) Address 000f.2323.6800 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/2 Desg FWD 19 128.2 P2p SwitchA#
SwitchB#sh spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address 000f.2323.6800 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 0011.5c00.ba80 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/2 Desg FWD 19 128.2 P2p VLAN0002 Spanning tree enabled protocol ieee Root ID Priority 32770 Address 000f.2323.6800 Cost 19 Port 1 (FastEthernet0/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32770 (priority 32768 sys-id-ext 2) Address 0011.5c00.ba80 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/2 Desg FWD 19 128.2 P2p VLAN0003 Spanning tree enabled protocol ieee Root ID Priority 32771 Address 000f.2323.6800 Cost 19 Port 1 (FastEthernet0/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32771 (priority 32768 sys-id-ext 3) Address 0011.5c00.ba80 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/2 Desg FWD 19 128.2 P2p SwitchB#
SwitchC#sh spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address 000f.2323.6800 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 0011.925f.aa80 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/2 Root FWD 19 128.2 P2p VLAN0002 Spanning tree enabled protocol ieee Root ID Priority 32770 Address 000f.2323.6800 Cost 19 Port 2 (FastEthernet0/2) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32770 (priority 32768 sys-id-ext 2) Address 0011.925f.aa80 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/2 Root FWD 19 128.2 P2p VLAN0003 Spanning tree enabled protocol ieee Root ID Priority 32771 Address 000f.2323.6800 Cost 19 Port 2 (FastEthernet0/2) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32771 (priority 32768 sys-id-ext 3) Address 0011.925f.aa80 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/2 Root FWD 19 128.2 P2p SwitchC#
To ensure that SwitchA will always be root for VLAN 1, we reduce it’s priority. Another switch with a lower MAC address could steal away root by causing a STP election. The modification reduces the priority to 25477 but otherwise everything else remains the same.
SWITCH | BRIDGE ID | VLAN | SWITCH | BRIDGE ID | VLAN | SWITCH | BRIDGE ID | VLAN | ||
A | 25477 000f.2323.6800 | 1 | A | 32770 000f.2323.6800 | 2 | A | 32771 000f.2323.6800 | 3 | ||
B | 32769 0011.5c00.ba80 | 1 | B | 32770 0011.5c00.ba80 | 2 | B | 32771 0011.5c00.ba80 | 3 | ||
C | 32769 0011.925f.aa80 | 1 | C | 32770 0011.925f.aa80 | 2 | C | 32771 0011.925f.aa80 | 3 |
SwitchA(config)#spanning-tree vlan 1 root primary
SwitchA(config)#end
SwitchA#sh spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 000f.2323.6800
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 000f.2323.6800
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/2 Desg FWD 19 128.2 P2p
Fa0/30 Desg FWD 19 128.30 P2p
VLAN0002
Spanning tree enabled protocol ieee
Root ID Priority 32770
Address 000f.2323.6800
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 000f.2323.6800
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/2 Desg FWD 19 128.2 P2p
VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 32771
Address 000f.2323.6800
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32771 (priority 32768 sys-id-ext 3)
Address 000f.2323.6800
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/2 Desg FWD 19 128.2 P2p
SwitchA#
SwitchB#sh spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 000f.2323.6800
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 0011.5c00.ba80
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/2 Desg FWD 19 128.2 P2p
<—–Output Omitted—–>
SwitchC#sh spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 24577 Address 000f.2323.6800 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 0011.925f.aa80 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/2 Root FWD 19 128.2 P2p
<-----Output Omitted----->
Now to get load balancing across the unused link, we modify the STP priority for VLAN 2 on switchB. SwitchA is root for all VLANs presently, thus all data follows the same path and does not use the link between switchBand switchC.
SWITCH | BRIDGE ID | VLAN | SWITCH | BRIDGE ID | VLAN | SWITCH | BRIDGE ID | VLAN | ||
A | 25477 000f.2323.6800 | 1 | A | 32770 000f.2323.6800 | 2 | A | 32771 000f.2323.6800 | 3 | ||
B | 32769 0011.5c00.ba80 | 1 | B | 25478 0011.5c00.ba80 | 2 | B | 32771 0011.5c00.ba80 | 3 | ||
C | 32769 0011.925f.aa80 | 1 | C | 32770 0011.925f.aa80 | 2 | C | 32771 0011.925f.aa80 | 3 |
SwitchB(config)#spanning-tree vlan 2 root primary SwitchB(config)#end SwitchB#sh spanning-tree <-----Output Omitted-----> VLAN0002 Spanning tree enabled protocol ieee Root ID Priority 24578 Address 0011.5c00.ba80 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 0011.5c00.ba80 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 15 Interface Role Sts Cost Prio.Nbr Type ------------------- ---- --- --------- -------- -------------------------------- Fa0/1 Desg FWD 19 128.1 P2p Fa0/2 Desg FWD 19 128.2 P2p
>—–Output Omitted—–>
SwitchA#sh spanning-tree <-----Output Omitted-----> VLAN0002 Spanning tree enabled protocol ieee Root ID Priority 24578 Address 0011.5c00.ba80 Cost 19 Port 1 (FastEthernet0/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32770 (priority 32768 sys-id-ext 2) Address 000f.2323.6800 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/2 Desg FWD 19 128.2 P2p
>—–Output Omitted—–>
SwitchC#sh spanning-tree <-----Output Omitted-----> VLAN0002 Spanning tree enabled protocol ieee Root ID Priority 24578 Address 0011.5c00.ba80 Cost 19 Port 1 (FastEthernet0/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32770 (priority 32768 sys-id-ext 2) Address 0011.925f.aa80 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/2 Altn BLK 19 128.2 P2p
<-----Output Omitted----->
We can try to optimize our load balancing to ensure each VLAN takes a slightly different STP tree in the topology by making switchC the STP root for VLAN3.
SWITCH | BRIDGE ID | VLAN | SWITCH | BRIDGE ID | VLAN | SWITCH | BRIDGE ID | VLAN | ||
A | 25477 000f.2323.6800 | 1 | A | 32770 000f.2323.6800 | 2 | A | 32771 000f.2323.6800 | 3 | ||
B | 32769 0011.5c00.ba80 | 1 | B | 25478 0011.5c00.ba80 | 2 | B | 32771 0011.5c00.ba80 | 3 | ||
C | 32769 0011.925f.aa80 | 1 | C | 32770 0011.925f.aa80 | 2 | C | 25479 0011.925f.aa80 | 3 |
SwitchC(config)#spanning-tree vlan 3 root primary SwitchC(config)#end
SwitchC#sh spanning-tree
<-----Output Omitted----->
VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 24579
Address 0011.925f.aa80
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24579 (priority 24576 sys-id-ext 3)
Address 0011.925f.aa80
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
<-----Output Omitted----->
SwitchA# sh spanning-tree
<-----Output Omitted----->
VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 24579
Address 0011.925f.aa80
Cost 19
Port 2 (FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32771 (priority 32768 sys-id-ext 3)
Address 000f.2323.6800
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/2 Root FWD 19 128.2 P2p
SwitchA#
switchB# show spanning-tree
<-----Output Omitted----->
VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 24579
Address 0011.925f.aa80
Cost 19
Port 2 (FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32771 (priority 32768 sys-id-ext 3)
Address 0011.5c00.ba80
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/2 Root FWD 19 128.2 P2p
SwitchB#
PVST+ uses 802.1q versus ISL, to enable it on the switches, we modify the trunking encapsulation to use the standards based protocol 802.1q.
interface FastEthernet0/1 switchport switchport trunk encapsulation dot1.q switchport mode trunk
!
interface FastEthernet0/2 switchport switchport trunk encapsulation dot1.q switchport mode trunk
In summary, Cisco’s proprietary implementation of STP, PVST/PVST+, allows for load balancing across links by ensuring all links get used if different switches are the STP root switch of different VLANs.
###
<-PREVIOUS What is 802.1D Spanning Tree Protocol?
NEXT-> Why use link aggregation?
Comments
No comment yet.