STP PDF
STP PDF
STP PDF
31 – Aaron Balchunas 1
If HostA sends out a broadcast, SwitchD will forward the broadcast out all
ports in the same VLAN, including the trunk ports connecting to SwitchB
and SwitchE. In turn, those two switches will forward that broadcast out all
ports, including the trunks to the neighboring SwitchA and SwitchC.
The broadcast will loop around the switches infinitely. In fact, there will be
two separate broadcast storms cycling in opposite directions through the
switching loop. Only powering off the switches or physically removing the
loop will stop the storm.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 2
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 3
SwitchB SwitchC
Priority: 32,768 Priority: 32,768
MAC: 0000.2222.3333 MAC: 0000.6666.7777
SwitchD SwitchE
Priority: 100 Priority: 32,768
MAC: 0000.4444.5555 MAC: 0000.8888.9999
Switches exchange BPDU’s to perform the election process, and the lowest
Bridge ID determines the Root Bridge:
• SwitchB, SwitchC, and SwitchE have the default priority of 32,768.
• SwitchA and SwitchD are tied with a lower priority of 100.
• SwitchA has the lowest MAC address, and will be elected the Root
Bridge.
By default, a switch will always believe it is the Root Bridge, until it
receives a BPDU from a switch with a lower Bridge ID. This is referred to
as a superior BPDU. The election process is continuous – if a new switch
with the lowest Bridge ID is added to the topology, it will be elected as the
Root Bridge.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 4
Each 1Gbps link has a path cost of 4. SwitchA has a cumulative path cost of
0, because it is the Root Bridge. Thus, when SwitchA sends out BPDU’s, it
advertises a root path cost of 0.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 5
The lowest cumulative path cost is considered superior, thus the port
directly connecting to SwitchA will become the root port. A BPDU
advertising a higher path cost is often referred to as an inferior BPDU.
SwitchD also has two paths to the Root Bridge:
• A path through SwitchB, with a path cost of 8.
• A path through SwitchE, with a path cost of 12.
• The port to SwitchB is preferred, and will become the root port.
Recall that the Root Bridge will advertise BPDU’s with a path cost of 0. As
the downstream switches receive these BPDU’s, they will add the path cost
of the receiving port, and then advertise the cumulative cost to neighbors.
For example, SwitchC will receive a BPDU with a path cost of 0 from
SwitchA, which is the Root Bridge. SwitchC will add the path cost of its
receiving port, and thus SwitchC’s cumulative path cost will be 4.
SwitchC will advertise a path cost of 4 to SwitchE, which will add the path
cost of its receiving port. SwitchE’s cumulative path cost will thus be 8.
Path cost can be artificially adjusted on a per-port basis:
SwitchD(config)# int gi2/22
SwitchD(config-if)# spanning-tree vlan 101 cost 42
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 6
Ports on the Root Bridge are never placed in a blocking state. Thus, the two
ports off of SwitchA will automatically become designated ports.
Remember, every network segment must have one designated port,
regardless if a root port already exists on that segment.
Thus, the network segments between SwitchB and SwitchD, and between
SwitchC and SwitchE, both require a designated port. The ports on SwitchD
and Switch E have already been identified as root ports, thus the ports on
Switch B and C will become the designated ports.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 7
Because two ports on this segment are eligible to become the designated
port, STP recognizes that a loop exists. One of the ports must be elected as
the designated port, and the other must be placed in a blocking state.
Normally, whichever switch has the lowest cumulative path cost will have
its port become designated. The switch with the highest path cost will have
its port blocked.
In the above example, there is a tie in cumulative path cost. Both SwitchD
and SwitchE have a path cost of 12 to reach the Root Bridge on that
segment.
The lowest Bridge ID is used as the tiebreaker. SwitchD has a priority of
100, and SwitchE has the default priority of 32,768.
Thus, the port on SwitchD will become the designated port. The port on
SwitchE will be placed in a blocking state.
As with electing the Root Bridge, if there is a tie in priority, the lowest
MAC address is used as the tie breaker.
Remember: Any port not elected as a root or designated port will be placed
in a blocking state.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 8
Port ID
When electing root and designated ports, it is possible to have a tie in both
path cost and Bridge ID. Consider the following example:
The bandwidth of both links is equal, thus both ports on SwitchB have an
equal path cost to the Root Bridge. Which port will become the root port
then? Normally, the lowest Bridge ID is used as the tiebreaker, but that is
not possible in this circumstance.
Port ID is used as the final tiebreaker, and consists of two components:
• 4-bit port priority
• 12-bit port number, derived from the physical port number
By default, the port priority of an interface is 128, and a lower priority is
preferred. If there is a tie in priority, the lowest port number is preferred.
The sender port ID determines the tie break, and not the local port ID. In the
above example, SwitchB must decide whether gi2/23 or gi2/24 becomes the
root port. SwitchB will observe BPDU’s from SwitchA, which will contain
the port ID’s for gi2/10 and gi2/11.
If priorities are equal, the sender Port ID from gi2/10 is preferred, due to the
lower port number. Thus, gi2/23 on SwitchB will become the root port.
The port number is a fixed value, but port priority can be changed on a per-
interface basis:
Switch(config)# int gi2/11
Switch(config-if)# spanning-tree vlan 101 port-priority 32
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 9
Port ID (continued)
Note: Some reference material may state that the Port ID is comprised of an
8-bit priority and 8-bit port number. This was accurate in the original
802.1D specification.
However, IEEE 802.1t revised the original specification to provide the
larger 12-bit port number field, to accommodate modular switches with high
port density.
Even more confusing – some whitepapers on Cisco’s website will define the
Port ID as a combination of port priority and MAC address, instead of port
number. This is not accurate in modern STP implementations.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 10
Versions of STP
There are three flavors of the original 802.1D version of STP:
• Common Spanning Tree (CST)
• Per-VLAN Spanning Tree (PVST)
• Per-VLAN Spanning Tree Plus (PVST+)
CST utilizes a single STP instance for all VLANs, and is sometimes referred
to as mono spanning tree. All CST BPDU’s are sent over the native VLAN
on a trunk port, and thus are untagged.
PVST employs a separate STP instance for each VLAN, improving
flexibility and performance. PVST requires trunk ports to use ISL
encapsulation. PVST and CST are not compatible.
The enhanced PVST+ is compatible with both CST and PVST, and supports
both ISL and 802.1Q encapsulation. PVST+ is the default mode on many
Cisco platforms.
STP has continued to evolve over time. Modern extensions of STP will be
covered later in this guide:
• Rapid Spanning Tree Protocol (RSTP)
• Multiple Spanning Tree (MST)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 11
Extended system IDs increase the number of supported VLANs in the STP
topology from 1005 to 4094.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 12
The switch with the lowest Bridge ID is elected as the Root Bridge. The
priority can be adjusted from its default of 32,768, to increase the likelihood
that a switch is elected as the Root Bridge.
Priority can be configured on a per-VLAN basis. Remember that the priority
must be in multiples of 4,096 when extended system IDs are enabled:
SwitchA(config)# spanning-tree vlan 101 priority 8192
A switch can be indirectly forced to become the Root Bridge for a specific
VLAN:
SwitchA(config)# spanning-tree vlan 101 root primary
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 14
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 15
STP Timers
Switches running STP exchange BPDUs to build and converge the topology
database. There are three timers that are crucial to the STP process:
• Hello timer
• Forward delay timer
• Max age timer
The hello timer determines how often switches send BPDUs. By default,
BPDUs are sent every 2 seconds.
The forward delay timer determines how long a port must spend in both a
learning and listening state:
• Introducing this delay period ensures that STP will have enough time
to detect and eliminate loops.
• By default, the forward delay is 15 seconds.
• Because a port must transition through two forward delays, the total
delay time is 30 seconds.
The max age timer indicates how long a switch will retain BPDU
information from a neighbor switch, before discarding it:
• Remember that BPDUs are sent every two seconds.
• If a switch fails to receive a BPDU from a neighboring switch for the
max age period, it will assume there was a change in the switching
topology.
• STP will then purge that neighbor’s BPDU information.
• By default, the max age timer is 20 seconds.
Timer values can be adjusted. However, this is rarely necessary, and can
negatively impact STP performance and reliability.
Timers must be changed on the Root Bridge. The Root Bridge will
propagate the new timer values to all switches using BPDUs. Non-root
switches will ignore their locally configured timer values.
To manually adjust the three STP timers for a specific VLAN:
Switch(config)# spanning-tree vlan 101 hello-time 10
Switch(config)# spanning-tree vlan 101 forward-time 20
Switch(config)# spanning-tree vlan 101 max-age 40
The timer values are measured in seconds, and the above represents the
maximum possible value for each timer.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 16
STP Diameter
The default values of each STP timer are based on the diameter of the
switching topology.
The diameter is the length of the topology, measured in the number of
switches including the Root Bridge. The following example has a diameter
of 4 switches:
SwitchA
Root Bridge
SwitchB
SwitchC
SwitchD
The diameter command adjusts the hello, forward delay, and max age
timers. This is the recommended way to adjust timers, as the timers are
tuned specifically to the diameter of the switching network.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 17
When a switch receives this root BPDU, it will temporarily reduce its CAM
aging timer from 300 seconds to a value equal to the forward delay timer -
15 seconds by default. This allows any erroneous MAC addresses to be
quickly flushed from the CAM table.
The CAM aging timer will remain at a reduced value for the duration of one
forward delay plus one max age period – a total of 35 seconds by default.
Two types of failures can occur in the STP topology, depending on the
perspective of a switch:
• Direct failures
• Indirect failures
For example, if the root port on SwitchB fails, SwitchB would consider this
a direct failure. SwitchB will detect immediately that the physical port is
down, and STP will react accordingly.
That same port failing would represent an indirect failure for SwitchD.
SwitchD would lose its path to the Root Bridge. However, because the port
is not local on SwitchD, it must learn of the topology change from its
neighbors.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 19
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 20
PortFast
By default, all ports on a switch participate in the STP topology. This
includes any port that connects to a host, such as a workstation. In most
circumstances, a host represents no risk of a loop.
The host port will transition through the normal STP states, including
waiting two forward delay times. Thus, a host will be without network
connectivity for a minimum of 30 seconds when first powered on.
This is not ideal for a couple reasons:
• Users will be annoyed by the brief outage.
• A host will often request an IP address through DHCP during bootup.
If the switch port is not forwarding quickly enough, the DHCP
request may fail.
• Devices that boot from network may fail as well.
PortFast allows a switch port to bypass the usual progression of STP states.
The port will instead transition from a blocking to a forwarding state
immediately, eliminating the typical 30 second delay.
PortFast should only be enabled on ports connected to a host. If enabled on a
port connecting to a switch or hub, any loop may result in a broadcast storm.
Note: PortFast does not disable STP on a port - it merely accelerates STP
convergence. If a PortFast-enabled port receives a BPDU, it will transition
through the normal process of STP states.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 21
PortFast (continued)
SwitchA
Root Bridge
SwitchB SwitchC
SwitchD SwitchE
gi1/14
HostA
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 22
UplinkFast
Often, a switch will have multiple uplinks to another upstream switch:
SwitchA
Root Bridge
gi2/23 gi2/24
SwitchB
If the links are not bundled using an EtherChannel, at least one of the ports
will transition to a blocking state to eliminate the loop. In the above
example, port gi2/24 was placed into a blocking state on SwitchB.
Normally, if the root port fails on the local switch, STP will need to perform
a recalculation to transition the other port out of a blocking state. At a
minimum, this process will take 30 seconds.
UplinkFast allows a blocking port to be held in a standby state. If the root
port fails, the blocking port can immediately transition to a forwarding state.
Thus, UplinkFast improves convergence time for direct failures in the STP
topology.
If multiple ports are in a blocking state, whichever port has the lowest root
path cost will transition to forwarding.
UplinkFast is disabled by default, and must be enabled globally for all
VLANs on the switch:
Switch(config)# spanning-tree uplinkfast
UplinkFast functions by tracking all possible links to the Root Bridge. Thus,
UplinkFast is not supported on the Root Bridge. In fact, enabling this
feature will automatically increase a switch’s bridge priority to 49,152.
UplinkFast is intended for the furthest downstream switches in the STP
topology.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 23
BackboneFast
UplinkFast provides faster convergence if a directly-connected port fails. In
contrast, BackboneFast provides improved convergence if there is an
indirect failure in the STP topology.
If the link between SwitchB and SwitchA fails, SwitchD will eventually
recalculate a path through SwitchE to reach the Root Bridge. However,
SwitchD must wait the max age timer before purging SwitchB’s superior
BPDU information. By default, this is 20 seconds.
BackboneFast allows a switch to bypass the max age timer. The switch will
accept SwitchE’s inferior BPDU’s immediately. The blocked port on
SwitchE must still transition to a forwarding state. Thus, BackboneFast
essentially reduces total convergence time from 50 seconds to 30 seconds for
an indirect failure.
This is accomplished by sending out Root Link Queries (RLQs). The Root
Bridge will respond to these queries with a RLQ Reply:
• If a RLQ Reply is received on a root port, the switch knows that the
root path is stable.
• If a RLQ Reply is received on a non-root port, the switch knows that
the root path has failed. The max age timer is immediately expired to
allow a new root port to be elected.
BackboneFast is a global command, and should be enabled on every switch:
Switch(config)# spanning-tree backbonefast
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 24
Protecting STP
STP is vulnerable to attack for two reasons:
• STP builds the topology by accepting BPDUs from neighboring
switches.
• The Root Bridge is always determined by the lowest Bridge ID.
A switch with a low priority can be maliciously or inadvertently installed on
the network, and then elected as the Root Bridge. STP will reconverge, often
resulting in instability or a suboptimal topology.
Cisco implemented three mechanisms to protect the STP topology:
• Root Guard
• BPDU Guard
• BPDU Filtering
All three mechanisms are configured on a per-port basis, and are disabled by
default.
Root Guard
Root Guard prevents an unauthorized switch from advertising itself as a
Root Bridge. If a BPDU superior to the Root Bridge is received on a port
with Root Guard enabled, the port is placed in a root-inconsistent state.
In this state, the port is essentially in a blocking state, and will not forward
frames. The port can still listen for BPDUs.
Root Guard is enabled on a per-port basis, and is disabled by default:
Switch(config)# interface gi1/14
Switch(config-if)# spanning-tree guard root
BPDU Guard
Recall that PortFast allows a switch port to bypass the usual progression of
STP states. However, PortFast does not disable STP on a port - it merely
accelerates STP convergence. However, a PortFast-enabled port will still
accept BPDUs.
PortFast should only be enabled on ports connected to a host. If enabled on a
port connecting to a switch, any loop may result in a broadcast storm.
To prevent such a scenario, BPDU Guard can be used in conjunction with
PortFast. Under normal circumstances, a port with PortFast enabled should
never receive a BPDU, as it is intended only for hosts.
BPDU Guard will place a port in an errdisable state if a BPDU is received,
regardless if the BPDU is superior or inferior. The STP topology will not be
impacted by another switch that is inadvertently connected to that port.
BPDU Guard should be enabled on any port with PortFast enabled. It is
disabled by default, and can be enabled on a per-interface basis:
Switch(config)# interface gi1/14
Switch(config-if)# spanning-tree bpduguard enable
BPDUs will still be sent out ports enabled with BPDU Guard.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 26
BPDU Filtering
BPDU Filtering prevents BPDUs from being sent out a port, and must be
enabled in conjunction with PortFast.
If a BPDU is received on a port, BPDU Filtering will react one of two ways,
depending on how it was configured.
• If filtering is enabled globally, a received BPDU will disable PortFast
on the port. The port will then transition normally through the STP
process.
• If filtering is enabled on a per-interface basis, a received BPDU is
ignored.
Great care must be taken when manually enabling BPDU Filtering on a port.
Because the port will ignore a received BPDU, STP is essentially disabled.
The port will neither be err-disabled nor progress through the STP process,
and thus the port is susceptible to loops.
If BPDU Filtering is enabled globally, it will only apply to PortFast ports:
Switch(config)# spanning-tree portfast bpdufilter default
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 27
The enable parameter sets UDLD into normal mode, and the aggressive
parameter is for aggressive mode. The message time parameter modifies
how often ID frames are sent out, measured in seconds.
UDLD can be configured on a per-interface basis:
Switch(config-if)# udld enable
Switch(config-if)# udld aggressive
Switch(config-if)# udld disable
To view UDLD status on ports, and reset any ports disabled by UDLD:
Switch# show udld
Switch# udld reset
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 28
Loop Guard
STP relies on the exchange of BPDUs to maintain a loop free environment.
If a software or hardware failure causes a switch to stop receiving BPDUs, a
switch will eventually discard that BPDU information, after the max age
timer has expired.
This may result in the switch incorrectly transitioning a blocking port to a
forwarding state, thus creating a loop.
UDLD addresses only one of the possible causes of this scenario – a
unidirectional link. Other issues may prevent BPDUs from being received or
processed, such as the CPU on a switch being at max utilization.
Loop Guard provides a more comprehensive solution – if a blocking port
stops receiving BPDUs on a VLAN, it is moved into a loop-inconsistent
state for that VLAN.
A port in a loop-inconsistent state cannot forward traffic for the affected
VLANs, and is essentially in a pseudo-errdisable state.
However, Loop Guard can automatically recover. As soon as BPDUs are
received again, the port will transition normally through STP states.
Loop Guard can be enabled globally:
Switch(config)# spanning-tree loopguard default
Loop Guard should only be enabled on trunk ports, or ports that connect to
other switches. Loop Guard should never be enabled on a port connecting to
a host, as an access port should never receive a BPDU.
(Reference: http://astorinonetworks.com/2011/09/01/understanding-spanning-tree-loopguard/)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 29
Troubleshooting STP
To view general STP information for all VLANs:
Switch# show spanning-tree
VLAN0101
Spanning tree enabled protocol ieee
Root ID Priority 32869
Address 000a.f43b.1b80
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Topology for
All VLANs
SwitchB
If a port on SwitchB enters a blocking state to eliminate the loop, that port
will block traffic from all VLANs. Redundancy is not lost, as STP will
recognize if the non-blocked port goes down, and reactivate the blocked
port.
However, this is inefficient, as the potential bandwidth of the blocked port is
unavailable for any VLAN. In contrast, PVST supports load balancing
VLANs across the switching topology:
PVST runs a separate instance for each VLAN, allowing a port to enter a
blocking state only for that specific VLAN. This provides both redundancy
and more efficient use of available bandwidth.
Note: An even better solution for the above example is to use an
EtherChannel, which STP will treat as a single logical interface.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 31
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 34
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 35
All other MST parameters are configured identically to 802.1D STP, with
two exceptions:
• The mst parameter must be used on all commands
• All commands reference the MST instance instead of a VLAN.
Thus, to configure a switch as the Root Bridge for MST instance 2:
Switch(config)# spanning-tree mst 2 root primary
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.