2.6.a STP mode (PVST+ and RPVST+)
STP or Spanning Tree Protocol allows for redundant links to be installed in switched networks without create switching loops where the same packet is forwarded again and again around the network.
PVST and RPVST refer to Per VLAN Spanning Tree Protocol and Rapid Per VLAN Spanning Tree Protocol.
Consider the above topology. First we must configure VTP to distrubute the VLAN database. Here will make IOU1 the server and the rest clients:
IOU1#conf t Enter configuration commands, one per line. End with CNTL/Z. IOU1(config)#vtp mode server Device mode already VTP Server for VLANS. IOU1(config)#vtp domain clinetworking Domain name already set to clinetworking. IOU1(config)#vtp password supasecret Password already set to supasecret IOU1(config)#^Z IOU1#
Perform the above config on each switch substituting “server” for client.
Next configure trunk ports (do this on each switch):
IOU1(config)#int range e0/0-2 IOU1(config-if-range)#switchport trunk encapsulation dot1q IOU1(config-if-range)#switchport mode trunk IOU1(config-if-range)#^Z IOU1#
Next configure STP mode to be PVST.
IOU1(config)#spanning-tree mode pvst
2.6.b STP root bridge selection
Electing the root bridge
Spanning Tree Protocol begins with the Spanning Tree Alogorithm choosing a root bridge. To do this each bridge sends a Hello BPDU (Bridge Protocol Data Unit) containing the bridge’s BID and it’s root cost. Below is a packet capture from IOU1 containing the Hello BPDU sent to IOU4 on e0/2. Notice the this frame is for VLAN 30.
This is a Hello BPDU and is a superior hello as the priority + mac address is lower than the corresponding Hello BPDU send by IOU4 just moments earlier on the same link:
IOU4 receives IOU1’s Hello packet on it’s e0/2 interface and immediately stops transmitting it’s BID as IOU1 has a superior hello.
Root bridge’s are elected based on:
- Lowest priority (all switches have the default 32768 + VLAN id)
- Lowest mac address (IOU1 has the lowest)
Now IOU4 will retransmit IOU1’s BID packet until it receives a superior hello. See packet capture from IOU4 on e0/1 interface. This process continues until only the superior hello’s from IOU1 are forwarded.
Notice in this packet capture that the root bridge is listed as IOU1 but the bridge identifier is listed as IOU4. This is simply IOU4 retransmitting the bid from IOU1 with it’s cost added (called the root cost).
Choosing the root ports
Each non-root switch must then choose it’s only root port. This is done by choosing the port with the lowest root cost (to the root switch/bridge).
In the case of IOU4 it chooses it’s e0/2 as it’s root port as it has the lowest root cost to the root bridge IOU1.
IOU4#show spanning-tree vlan 30 VLAN0030 Spanning tree enabled protocol ieee Root ID Priority 32798 Address aabb.cc00.0100 Cost 100 Port 3 (Ethernet0/2) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32798 (priority 32768 sys-id-ext 30) Address aabb.cc00.0300 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 sec Interface Role Sts Cost Prio.Nbr Type ------------------- ---- --- --------- -------- -------------------------------- Et0/0 Altn BLK 100 128.1 Shr Et0/1 Desg FWD 100 128.2 Shr Et0/2 Root FWD 100 128.3 Shr IOU4#
Choosing the Designated Port
The Designated Port is the port which forwards traffic into a LAN segment. To choose the Designated Port switches battle it out and choose the switch with the lowest BID.
If this is a tie (ie the switch is connected to a hub with several links and hears it’s own hello packets) the lowest interface STP priority if that fails the lowest interface number.
So here are the steps:
- Lowest bid
- Lowest interface STP priority
- Lowest interface number
Let look at IOU2 and IOU4:
IOU2#show spanning-tree vlan 30 VLAN0030 Spanning tree enabled protocol ieee Root ID Priority 32798 Address aabb.cc00.0100 Cost 100 Port 1 (Ethernet0/0) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32798 (priority 32768 sys-id-ext 30) Address aabb.cc00.0400 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 sec Interface Role Sts Cost Prio.Nbr Type ------------------- ---- --- --------- -------- -------------------------------- Et0/0 Root FWD 100 128.1 Shr Et0/1 Altn BLK 100 128.2 Shr Et0/2 Altn BLK 100 128.3 Shr IOU2# IOU4#show spanning-tree vlan 30 VLAN0030 Spanning tree enabled protocol ieee Root ID Priority 32798 Address aabb.cc00.0100 Cost 100 Port 3 (Ethernet0/2) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32798 (priority 32768 sys-id-ext 30) Address aabb.cc00.0300 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 sec Interface Role Sts Cost Prio.Nbr Type ------------------- ---- --- --------- -------- -------------------------------- Et0/0 Altn BLK 100 128.1 Shr Et0/1 Desg FWD 100 128.2 Shr Et0/2 Root FWD 100 128.3 Shr IOU4#
IOU2 and IOU4 share link e0/1. IOU4 has the lowest bid (32798 + aabb.cc00.0300) vs (32798 + aabb.cc00.0400) so it wins the bid to have it’s DP on this link.
Now lets look at IOU3:
IOU3#show spanning-tree vlan 30 VLAN0030 Spanning tree enabled protocol ieee Root ID Priority 32798 Address aabb.cc00.0100 Cost 100 Port 2 (Ethernet0/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32798 (priority 32768 sys-id-ext 30) Address aabb.cc00.0200 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 sec Interface Role Sts Cost Prio.Nbr Type ------------------- ---- --- --------- -------- -------------------------------- Et0/0 Desg FWD 100 128.1 Shr Et0/1 Root FWD 100 128.2 Shr Et0/2 Desg FWD 100 128.3 Shr IOU3#
IOU3 has a lower bid than IOU2 on e0/2 so it wins the bid to have it’s DP on this link.
2.6.a STP mode (PVST+ and RPVST+)
Rapid Per VLAN SPT works similar to PVST:
- it elects a root switch using bids and tie breakers
- it elects the root port on each non root switch with the same rules
- it elects designated ports the same
- it places ports in a forwarding or blocking state (discarding state)
To configure RPVST:
IOU4(config)#spanning-tree mode rapid-pvst
RPVST introduces a few new port roles:
- Alternate port (backup root port)
- Backup port (backup designated port)