Module 5 - STP Concepts
Module 5 - STP Concepts
Purpose of
STP Explain common problems in a redundant, L2 switched network.
Topic Title Topic Objective
STP
Operations Explain how STP operates in a simple switched network.
Evolution of
STP Explain how Rapid PVST+ operates.
Loop-Free Topology
Link Failure Causes Recalculation
STA Scenario Topology
This STA scenario uses an Ethernet LAN with redundant connections between
multiple switches.
STP prevents loops from occurring by configuring a loop-free path through the
network using strategically placed “blocking-state” ports. The switches running
STP are able to compensate for failures by dynamically unblocking the previously
blocked ports and permitting traffic to traverse the alternate paths.
The BID includes the Bridge Priority, the Extended System ID, and the
MAC Address of the switch.
Bridge Priority
The default priority value for all Cisco switches is the decimal value 32768. The
range is 0 to 61440 in increments of 4096. A lower bridge priority is preferable. A
bridge priority of 0 takes precedence over all other bridge priorities.
Extended System ID
The extended system ID value is a decimal value added to the bridge priority
value in the BID to identify the VLAN for this BPDU.
Early implementations of IEEE 802.1D were designed for networks that did not
use VLANs. There was a single common spanning tree across all switches. For
this reason, in older switches, the extended system ID was not included in the
BPDUs. As VLANs became common for network infrastructure segmentation,
802.1D was enhanced to include support for VLANs, which required that the 12-
bit VLAN ID be included in the BPDU frame. VLAN information is included in the
BPDU frame through the use of the extended system ID.
The extended system ID allows later implementations of STP, such as Rapid
STP (RSTP) to have different root bridges for different sets of VLANs. This can
allow for redundant, non-forwarding links in a STP topology for one set of VLANs
to be used by a different set of VLANs using a different root bridge.
MAC address
When two switches are configured with the same priority and have the same
extended system ID, the switch having the MAC address with the lowest value,
expressed in hexadecimal, will have the lower BID.
5.2.2
1. Elect the Root Bridge
The STA designates a single switch as the root bridge and uses it as the
reference point for all path calculations. Switches exchange BPDUs to build the
loop-free topology beginning with selecting the root bridge.
An election process determines which switch becomes the root bridge. All
switches in the broadcast domain participate in the election process. After a
switch boots, it begins to send out BPDU frames every two seconds. These
BPDU frames contain the BID of the sending switch and the BID of the root
bridge, known as the Root ID.
The switch with the lowest BID will become the root bridge. At first, all switches
declare themselves as the root bridge with their own BID set as the Root ID.
Eventually, the switches learn through the exchange of BPDUs which switch has
the lowest BID and will agree on one root bridge.
In the figure, S1 is elected the root bridge because it has the lowest BID.
5.2.3 Impact of Default BIDs
Because the default BID is 32768, it is possible for two or more switches to have
the same priority. In this scenario, where the priorities are the same, the switch
with the lowest MAC address will become the root bridge. To ensure that the root
bridge decision best meets network requirements, it is recommended that the
administrator configure the desired root bridge switch with a lower priority.
In the figure, all switches are configured with the same priority of 32769. Here the
MAC address becomes the deciding factor as to which switch becomes the root
bridge. The switch with the lowest hexadecimal MAC address value is the
preferred root bridge. In this example, S2 has the lowest value for its MAC
address and is elected as the root bridge for that spanning tree instance.
Note: In the example, the priority of all the switches is 32769. The value is
based on the 32768 default bridge priority and the extended system ID (VLAN 1
assignment) associated with each switch (32768+1).
5.2.4 Determine the Root Path Cost
When the root bridge has been elected for a given spanning tree instance, the
STA starts the process of determining the best paths to the root bridge from all
destinations in the broadcast domain. The path information, known as the
internal root path cost, is determined by the sum of all the individual port costs
along the path from the switch to the root bridge.
Note: The BPDU includes the root path cost. This is the cost of the path from
the sending switch to the root bridge.
When a switch receives the BPDU, it adds the ingress port cost of the segment
to determine its internal root path cost.
The default port costs are defined by the speed at which the port operates. The
table shows the default port costs suggested by IEEE. Cisco switches by default
use the values as defined by the IEEE 802.1D standard, also known as the short
path cost, for both STP and RSTP. However, the IEEE standard suggests using
the values defined in the IEEE-802.1w, also known as long path cost, when using
10 Gbps links and faster.
Note: RSTP is discussed in more detail later in this module.
Link Speed STP Cost: IEEE 802.1D-1998 RSTP Cost: IEEE 802.1w-2004
10 Gbps 2 2,000
1 Gbps 4 20,000
5.2.5
2. Elect the Root Ports
After the root bridge has been determined, the STA algorithm is used to select
the root port. Every non-root switch will select one root port. The root port is the
port closest to the root bridge in terms of overall cost (best path) to the root
bridge. This overall cost is known as the internal root path cost.
The internal root path cost is equal to the sum of all the port costs along the path
to the root bridge, as shown in the figure. Paths with the lowest cost become
preferred, and all other redundant paths are blocked. In the example, the internal
root path cost from S2 to the root bridge S1 over path 1 is 19 (based on the
IEEE-specified individual port cost) while the internal root path cost over path 2 is
38. Because path 1 has a lower overall path cost to the root bridge, it is the
preferred path and F0/1 becomes the root port on S2.
5.2.6
3. Elect Designated Ports
The loop prevention part of spanning tree becomes evident during these next two
steps. After each switch selects a root port, the switches will then select
designated ports.
Every segment between two switches will have one designated port. The
designated port is a port on the segment (with two switches) that has the internal
root path cost to the root bridge. In other words, the designated port has the best
path to receive traffic leading to the root bridge.
What is not a root port or a designated port becomes an alternate or blocked
port. The end result is a single path from every switch to the root bridge.
Click each button for an explanation of how STA elects the designated ports.
5.2.7
4. Elect Alternate (Blocked) Ports
If a port is not a root port or a designated port, then it becomes an alternate (or
backup) port. Alternate ports and backup ports are in discarding or blocking state
to prevent loops. In the figure, the STA has configured port F0/2 on S3 in the
alternate role. Port F0/2 on S3 is in the blocking state and will not forward
Ethernet frames. All other inter-switch ports are in forwarding state. This is the
loop-prevention part of STP.
The Fa0/2 interface of S3 is not a root port or a designated port, so it
becomes an alternate or blocked port.
The port is an alternate port and does not participate in frame forwarding.
The port receives BPDU frames to determine the location and root ID of the
root bridge. BPDU frames also determine which port roles each switch port
should assume in the final active STP topology. With a Max Age timer of 20
seconds, a switch port that has not received an expected BPDU from a
Blocking neighbor switch will go into the blocking state.
After the blocking state, a port will move to the listening state. The port
receives BPDUs to determine the path to the root. The switch port also
transmits its own BPDU frames and informs adjacent switches that the
Listening switch port is preparing to participate in the active topology.
Learning A switch port transitions to the learning state after the listening state. During
the learning state, the switch port receives and processes BPDUs and
prepares to participate in frame forwarding. It also begins to populate the
Port State Description
MAC address table. However, in the learning state, user frames are not
forwarded to the destination.
A switch port in the disabled state does not participate in spanning tree and
does not forward frames. The disabled state is set when the switch port is
Disabled administratively disabled.
STP Description
Variety
This is the original IEEE 802.1D version (802.1D-1998 and earlier) that
provides a loop-free topology in a network with redundant links. Also called
Common Spanning Tree (CST), it assumes one spanning tree instance for the
STP entire bridged network, regardless of the number of VLANs.
802.1D-
2004 This is an updated version of the STP standard, incorporating IEEE 802.1w.
Layer 3 routing allows for redundant paths and loops in the topology, without
blocking ports. For this reason, some environments are transitioning to Layer 3
everywhere except where devices connect to the access layer switch. In other
words, the connections between access layer switches and distribution switches
would be Layer 3 instead of Layer 2, as shown in the next figure.