Finally I have decided to place all STPs in one place. Recall on these concepts become easy if all of them are in a single place.
[1.] Spanning-Tree Protocol (STP) (802.1d) :
It prevents loops from being formed when switches or bridges are interconnected via multiple paths (to provide redundancy). STP is 802.1D implementation by exchanging BPDU messages with other switches to detect loops, and then removes the loop by shutting down selected bridge interfaces. This algorithm guarantees that there is one and only one active path between two network devices. (Flex links with MAC move update, a non-stp loop-free redundancy).
STP Bridge Port Roles:
– root port (RP): Port connecting to root bridge through a least-cost path. Forwarding State.
– designated port (DP) : Port connecting the bridge to the network segment with least-cost path to the root. Forwarding state.
– blocked port (BP) : All other ports are blocked. Blocked state.
This provides us with a single active path to root and a redundant path.
In case of same path cost, following is used as tie breaker:
– Lowest Root Bridge ID
– Lower Path Cost to Root
– Lowest Sender Bridge ID
BPDU:
– All the computation is done on the basis of a message exchange called Bridge Protocol Data Units (BPDU).
– A bridge sends a BPDU frame using the unique MAC address of the port itself as a source address, and a destination address of the STP multicast address 01:80:C2:00:00:00.
– BPDUs are exchanged regularly (every 2 seconds by default)
– The designated port transmits BPDUs, and the non-designated port receives BPDUs.
STP Port States:
– Disabled : Administrativly on/off.
– Blocking : Only received BPDU data.
– Listening : Processing BPDU and awaiting more BPDUs. (Time spent here = 15sec)
– Learning : Learns source MAC addresses from data received, but no data forwarding. (Time spent here = 15sec)
– Forwarding : Normal operation, full send/receive.
Time taken to transition from Blocked->Forwarding is Forwarding delay (Listening time + Learning time = 30sec).
STP Enhancement Features:
[1 (a)]STP Uplink Fast : On a given bridge, the root port and all blocked ports (root/blocked/alternate) that are not self-looped form the uplink group. This feature places a port from uplink group in forwarding mode immediately, to restore connectivity to uplink switch.
(config)# spanning-tree uplinkfast
When uplink fast feature runs it flood dummy packets with the different MAC addresses that it has in its CAM table as a source, to ensure that rest of the switches update their CAM table accordingly.
NOTE: This feature increased switch priority to a significantly higher value than the default. This ensures that the switch is not likely to be elected root bridge. All the ports of the switch have their cost increased by 3000. This ensures that switch ports are not likely be elected designated ports.
[1 (b)] STP Backbone Fast : Switch processes the inferior BPDUs to check for any indirect link faliures using Root Link Query (RLQ) PDU. Saves on max_age time (20sec).
(config)# spanning-tree backbonefast
If enabled, needs to be there on all switches.
[2.] Rapid Spanning Tree Protocol (RSTP) (802.1w) :
It provides for faster spanning tree convergence after a topology change. It includes features equivalent to PortFast, UplinkFast and BackboneFast for faster network re-convergence.
RSTP bridge port roles:
– Root Port (RP) : Port connecting to root bridge through a least-cost path. Forwarding State.
– Designated Port (DP) : Port connecting the bridge to the network segment with least-cost path to the root. Forwarding state.
– Alternate Port (AP) : Port in a network segment that sends inferior BPDU as compared to BPDUs received. Analogos to blocked port in STP.
– Backup Port (BP) : It receives more useful BPDUs from the same bridge it is on and is a port blocked. Analogos to bloked port in STP. Self-looped.
STP Port States:
– Discarding : Administrativly on/off, Only received BPDU data, Processing BPDU and awaiting more BPDUs.
– Learning : Learns source MAC addresses from data received, but no data forwarding.
– Forwarding : Normal operation, full send/receive.
There are no timers involved, there is proposal and acknowledgement through BPDUs. Using ‘sync’ operation topology changes are implemented. In ‘Sync’ operation non-edge designated ports are blocked while BPDUs are processed.
The RSTP topology change mechanism clears the appropriate entries in the Content Addressable Memory (CAM) tables of the upstream bridge. In-built Uplink Fast feature.
The RSTP processes the inferior BPDUs to detect any in-direct link failure. In-built BackboneFast feature.
Features/Tools for STP:
[A] STP PortFast BPDU Guard: If a port with PortFast enabled sends BPDU. That port goes into errdisabled state. This is done generally for Host/Servers.
(config)# spanning-tree portfast bpduguard
[B] STP Root Guard: It is used to enforce the position of Root bridge in the network. Enabled on non-root ports that are connected to devices that are not supposed to be root.
Superior BPDU -> Root Guard enabled port -> Listening (Root-inconsistent) -> If superior BPDU stops -> Learning -> Forwarding
(config)# interface <interface-name>
(config-if)# spanning-tree guard root | spanning-tree rootguard
[C] STP Loop Guard : If BPDUs are not received on a non-designated port, and loop guard is enabled, that port is moved into the STP loop-inconsistent blocking state, instead of the listening / learning / forwarding state. Without the loop guard feature, the port assumes the designated port role.
It needs to be configured on Root and alternate/backup ports in STP. Excluding edge ports (portFast).
(config)#interface <interface-name>
(config-if)#spanning-tree guard loop
Loop guard blocks inconsistent ports on a per-VLAN basis.
[D] Unidirectional Link Detection (UDLD) : Detects physical link connectivity problems. Fundamentally, protection against miswiring.
!— For all fiber-optic LAN ports
(config)# udld {enable | aggressive}
!— Per-port configurtaion. Use ‘aggressive’ to put port in errdisable during error,
(config)# interface <interface-name>
(config-if)# udld port [aggressive]
!— Verification
# show udld <interface-name>
STP Loop Guard + UDLD = Good
[3.] Common Spanning-Tree (CST) :
It assumes one spanning-tree instance for the entire bridged network, regardless of the number of VLANs. This implementation reduces CPU load since only one Spanning Tree instance is maintained for the entire network. This implementation can be used when only one Layer 2 topology is needed in the network.
[4.] Per-VLAN Spanning Tree (PVST) :
It maintains a spanning tree instance for each VLAN configured in the network. It uses ISL Trunking and allows a VLAN trunk to be forwarding for some VLANs while blocking for other VLANs. Since PVST treats each VLAN as a separate network, it has the ability to load balance traffic (at layer-2) by forwarding some VLANs on one trunk and other Vlans on another trunk without causing a Spanning Tree loop.
(config)# spanning-tree mode pvst
(config)# spanning-tree vlan <vlan-range-A> root primary
(config)# spanning-tree vlan <vlan-range-B> root secondary
Example of load-balancing concept.
[5.] Per VLAN Spanning Tree Plus (PVST+) :
It provides the same functionality as PVST using 802.1Q trunking technology rather than ISL. PVST+ is an enhancement to the 802.1Q specification and is not supported on non-Cisco devices.
(config)# spanning-tree mode rapid-pvst
(config)# spanning-tree vlan <vlan-range-A> root primary
(config)# spanning-tree vlan <vlan-range-B> root secondary
[6.] Multiple (Instance)? STP (MISTP/MST) (802.1s) :
It is an IEEE standard which allows several VLANs to be mapped to a reduced number of spanning-tree instances. This is possible since most networks do not need more than a few logical topologies. Each instance handles multiple VLANs that have the same Layer 2 topology.
The MST feature is the IEEE 802.1s and is an amendment to 802.1Q. MST extends the 802.1w Rapid Spanning Tree (RST) algorithm to multiple spanning trees. This extension provides for both rapid convergence and load balancing in a VLAN environment. PVST+ and Rapid-PVST+ run spanning tree instance for each VLAN. In MST, you can group VLANs into a single instance. It uses Bridge Protocol Data Unit (BPDU) version 3 which is backward compatible with the 802.1D STP which uses BPDU version 0.
By default, all the VLANs are grouped into IST0, which is called an Internal Spanning Tree (IST). You can manually create instances numbered 1 to 4094, and they are labeled MSTn (n =1 to 4094), but the region can support only up to 65 instances. Some of the releases supports only 16 instances.
IST/CST/CIST: IST is the only instance that can send and receive BPDUs in the MST network. An MSTn instance is local to the region. ISTs in different regions are interconnected through a Common Spanning Tree (CST). The collection of ISTs in each MST region and the CST that connects the ISTs are called the Common and Internal Spanning Tree (CIST).
!— This needs to be applied on all switches
(config)# spanning-tree mst configuration
(config-mst)# name <region-name>
(config-mst)# revision <number>
(config-mst)# instance <number> vlan <vlan-range-A>
(config-mst)# instance <number+1> vlan <vlan-range-B>
(config-mst)# exit
Default Instance 0 will have all vlans that are not defined under any instance.
!— This needs to go on distribution switches for load-balancing (only an example)
(config)# spanning-tree mst 0-1 priority 0 | spanning-tree mst 0-1 priority primary
(config)# spanning-tree mst 2 priority 4096 | spanning-tree mst 2 priority secondary
0,1,2 are MST ‘instance’ numbers.
!— This needs to be on all switches
(config)# spanning-tree mode mst