Understanding STP for Network Redundancy
Understanding STP for Network Redundancy
Instructor Materials
—
1990 IEEE 802.1D
Module Objectives
Module Title: STP Concepts
• Ethernet LANs require a loop-free topology with a single path between any two devices. A loop
in an Ethernet LAN can cause continued propagation of Ethernet frames until a link is disrupted
and breaks the loop.
Spanning Tree Protocol
The Extended System ID je hodnota 1 až 4095 odpovídající číslu VLANy participující na STP.
Struktura BPDU
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25
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.
• 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.
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. The administrator should configure the desired
root bridge switch with a lower priority.
• 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.
• Although switch ports have a default port cost associated with them, the port cost is configurable. The ability to
configure individual port costs gives the administrator the flexibility to manually control the spanning tree paths to the
root bridge.
Forwarding Data
Port State BPDU MAC Address Table
Frames
Blocking Receive only No update No
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 39
C čeká na RP max. 20 sec na BPDU od A.
Po 20 sec zapracuje časovač Max Age, na BP 15 s. naslouchá.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 40
Pak se dalších 15 s. učí adresy z BPDU a prohodí RP a BP. Celkem 50 s.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 41
Per-VLAN Spanning Tree
STP can be configured to operate in an environment with multiple VLANs. In Per-VLAN Spanning Tree
(PVST) versions of STP, there is a root bridge elected for each spanning tree instance. This makes it
possible to have different root bridges for different sets of VLANs. STP operates a separate instance
of STP for each individual VLAN. If all ports on all switches are members of VLAN 1, then there is only
one spanning tree instance.
[Link]
Filtry jsou na [Link]
5.3 Evolution of STP
Different Versions of STP
• Many professionals generically use spanning tree and STP to refer to the various implementations
of spanning tree, such as Rapid Spanning Tree Protocol (RSTP) and Multiple Spanning Tree
Protocol (MSTP). In order to communicate spanning tree concepts correctly, it is important to refer
to the implementation or standard of spanning tree in context.
• The latest IEEE documentation on spanning tree (IEEE-802-1D-2004) says, "STP has now been
superseded by the Rapid Spanning Tree Protocol (RSTP)."The IEEE uses "STP" to refer to the
original implementation of spanning tree and "RSTP" to describe the version of spanning tree
specified in IEEE-802.1D-2004.
• Because the two protocols share much of the same terminology and methods for the loop-free
path, the primary focus will be on the current standard and the Cisco proprietary implementations
of STP and RSTP.
• Cisco switches running IOS 15.0 or later, run PVST+ by default. This version incorporates many
of the specifications of IEEE 802.1D-2004, such as alternate ports in place of the former non-
designated ports. Switches must be explicitly configured for rapid spanning tree mode in order to
run the rapid spanning tree protocol.
Evolution of STP
Different Versions of STP (Cont.)
STP
Description
Variety
This is the original IEEE 802.1D version (802.1D-1998 and earlier) that provides a loop-free topology in a
STP network with redundant links. Also called Common Spanning Tree (CST), it assumes one spanning tree
instance for the entire bridged network, regardless of the number of VLANs.
Per-VLAN Spanning Tree (PVST+) is a Cisco enhancement of STP that provides a separate 802.1D
PVST+ spanning tree instance for each VLAN configured in the network. PVST+ supports PortFast, UplinkFast,
BackboneFast, BPDU guard, BPDU filter, root guard, and loop guard.
802.1D-
This is an updated version of the STP standard, incorporating IEEE 802.1w.
2004
Rapid Spanning Tree Protocol (RSTP) or IEEE 802.1w is an evolution of STP that provides faster
RSTP
convergence than STP.
Rapid This is a Cisco enhancement of RSTP that uses PVST+ and provides a separate instance of 802.1w per
PVST+ VLAN. Each separate instance supports PortFast, BPDU guard, BPDU filter, root guard, and loop guard.
Multiple Spanning Tree Protocol (MSTP) is an IEEE standard inspired by the earlier Cisco proprietary
MSTP Multiple Instance STP (MISTP) implementation. MSTP maps multiple VLANs into the same spanning tree
instance.
Multiple Spanning Tree (MST) is the Cisco implementation of MSTP, which provides up to 16 instances of
MST RSTP and combines many VLANs with the same physical and logical topology into a common RSTP
instance. Each instance supports PortFast, BPDU guard, BPDU filter, root guard, and loop guard.
RSTP Concepts
• RSTP (IEEE 802.1w) supersedes the original 802.1D while retaining backward compatibility. The
802.1w STP terminology remains primarily the same as the original IEEE 802.1D STP
terminology. Most parameters have been left unchanged. Users that are familiar with the original
STP standard can easily configure RSTP. The same spanning tree algorithm is used for both STP
and RSTP to determine port roles and topology.
• RSTP increases the speed of the recalculation of the spanning tree when the Layer 2 network
topology changes. RSTP can achieve much faster convergence in a properly configured network,
sometimes in as little as a few hundred milliseconds. If a port is configured to be an alternate port
it can immediately change to a forwarding state without waiting for the network to converge.
Note: Rapid PVST+ is the Cisco implementation of RSTP on a per-VLAN basis. With Rapid PVST+ an
independent instance of RSTP runs for each VLAN.
RSTP Port States and Port Roles
There are only three port states Root ports and designated ports are the
in RSTP that correspond to the same for both STP and RSTP. However,
three possible operational states there are two RSTP port roles that
in STP. The 802.1D disabled, correspond to the blocking state of STP. In
blocking, and listening states are STP, a blocked port is defined as not being
merged into a unique 802.1w the designated or root port. RSTP has two
discarding vyřazený)state. port roles for this purpose.
RSTP Port States and Port Roles (Cont.)
The alternate port has an alternate path to the root bridge. The backup port is a backup to a shared
medium, such as a hub. A backup port is less common because hubs are now considered legacy
devices.
Změny v časovačích
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 51
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 52
Pole Flags je naplno využíváno
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 53
Místo časovačů systém proposal/agreement
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 54
PortFast and BPDU Guard
• When a device is connected to a switch port or when a switch powers up, the switch port goes
through both the listening and learning states, each time waiting for the Forward Delay timer to
expire. This delay is 15 seconds for each state for a total of 30 seconds. This can present a
problem for DHCP clients trying to discover a DHCP server because the DHCP process may
timeout. The result is that an IPv4 client will not receive a valid IPv4 address.
• When a switch port is configured with PortFast, that port transitions from blocking to forwarding
state immediately, avoiding the 30 second delay. You can use PortFast on access ports to allow
devices connected to these ports to access the network immediately. PortFast should only be
used on access ports. If you enable PortFast on a port connecting to another switch, you risk
creating a spanning tree loop.
• A PortFast-enabled switch port should never receive BPDUs because that would indicate that
switch is connected to the port, potentially causing a spanning tree loop. Cisco switches support a
feature called BPDU guard. When enabled, it immediately puts the switch port in an errdisabled
(error-disabled) state upon receipt of any BPDU. This protects against potential loops by
effectively shutting down the port. The administrator must manually put the interface back into
service.
Příkazy STP Portfast
STP portfast disables the topology notification notification (TCN) generation and causes
access ports that come up to bypass the learning and listening states and enter the
forwarding state immediately. If a BPDU is received on a portfast-enabled port, the portfast
functionality is removed from that port.
Command Description
spanning-tree portfast Interface command to enable portfast on a
specific access port
spanning-tree portfast default Global command to enable portfast on all
access ports
spanning-tree portfast disable Disable portfast on a port
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 56
Switch(config)#interface fa0/1
Switch(config-if)#spanning-tree portfast
Portfast nikdy
ne na trunk!
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 57
Bpduguard
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 58
SW1(config-if)#spanning-tree guard root
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 59
BPDU Guard
BPDU guard is a safety mechanism that shuts down ports configured with STP portfast
upon receiving a BPDU.
Command Description
spanning-tree portfast bpduguard default Global command to enable BPDU guard on
all STP portfast ports
spanning-tree portfast bpduguard default Interface command to enables or disable
{enable | disable} BPDU guard on a specific interface
show spanning-tree interface interface-id Displays whether BPDU guard is enabled for
detail the specified interface
Note: BPDU Guard is typically configured with all host-facing ports that are enabled with
portfast.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 60
BPDU Guard Error Recovery
The Error Recovery service can be used to reactivate ports that are shut down. Ports that
are put into the ErrDisabled mode due to BPDU guard do not automatically restore
themselves. Use the following commands to recover ports that were shutdown from BPDU
guard:
Command Description
errdisable recovery cause bpduguard Recovers ports shutdown by BPDU guard
errdisable recovery interval time-seconds The period that Error Recovery checks for ports
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 61
BPDU Filter
BPDU filter blocks BPDUs from being transmitted out of a port. It can be enabled globally
or on a specific interface.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 63
Problems with Unidirectional Links – problémy optiky
Network devices that utilize fiber-optic cables for connectivity can encounter
unidirectional traffic flows if one strand is broken. BPDUs will not able to be
transmitted causing other switches on the network to eventually time out the
existing root port and change root ports resulting in a forwarding loop.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 64
STP Loop Guard
STP Loop guard prevents any alternative or root ports from becoming designated ports due
to loss of BPDUs on the root port. Loop guard places the original port into an ErrDisabled
state while BPDUs are not being received and transitions back through the STP states
when it begins receiving BPDUs again.
Command Description
spanning-tree loopguard default Global command to enable loop guard
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 66
Všude v kruhu
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 67
STP Loop Guard
STP Loop guard prevents any alternative or root ports from becoming designated ports due
to loss of BPDUs on the root port. Loop guard places the original port into an ErrDisabled
state while BPDUs are not being received and transitions back through the STP states
when it begins receiving BPDUs again.
Command Description
spanning-tree loopguard default Global command to enable loop guard
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 69
Všude v kruhu
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 70
STP Loop Guard
STP Loop guard prevents any alternative or root ports from becoming designated ports due
to loss of BPDUs on the root port. Loop guard places the original port into an ErrDisabled
state while BPDUs are not being received and transitions back through the STP states
when it begins receiving BPDUs again.
Command Description
spanning-tree loopguard default Global command to enable loop guard
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 72
Výpadek
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 73
A jde to v protisměru a cyklí
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 74
Jednosměrnost je detekována
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 75
B to zablokuje i ve druhém směru
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 76
Co se nesmí kombinovat?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 77
• Root je ke switchi
• BPDU k PC
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 78
Jak byste na to šli v kruhové topologii?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 79
Umístění STP Root Guards v kruhové
topologii
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 80
Co označují jednotlivé barvy?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 81
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 82
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 83
Alternatives to STP
• Over the years, organizations required greater resiliency and availability in the LAN. Ethernet
LANs went from a few interconnected switches connected to a single router, to a sophisticated
hierarchical network design including access, distribution and core layer switches.
• Depending on the implementation, Layer 2 may include not only the access layer, but also the
distribution or even the core layers. These designs may include hundreds of switches, with
hundreds or even thousands of VLANs. STP has adapted to the added redundancy and
complexity with enhancements, as part of RSTP and MSTP.
• An important aspect to network design is fast and predictable convergence when there is a failure
or change in the topology. Spanning tree does not offer the same efficiencies and predictabilities
provided by routing protocols at Layer 3.
• 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.
5.4 Module Practice and Quiz
What Did I Learn In This Module?
• Redundant paths in a switched Ethernet network may cause both physical and logical Layer 2 loops.
• A Layer 2 loop can result in MAC address table instability, link saturation, and high CPU utilization on switches and end-
devices. This results in the network becoming unusable.
• STP is a loop-prevention network protocol that allows for redundancy while creating a loop-free Layer 2 topology. Without
STP, Layer 2 loops can form, causing broadcast, multicast and unknown unicast frames to loop endlessly, bringing down a
network.
• Using the STA, STP builds a loop-free topology in a four-step process: elect the root bridge, elect the root ports, elect
designated ports, and elect alternate (blocked) ports.
• During STA and STP functions, switches use BPDUs to share information about themselves and their connections. BPDUs
are used to elect the root bridge, root ports, designated ports, and alternate ports.
• When the root bridge has been elected for a given spanning tree instance, the STA determines 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.
• After the root bridge has been determined the STA algorithm selects the root port. The root port is the port closest to the root
bridge in terms of overall cost, which is called the internal root path cost.
• After each switch selects a root port, switches will select designated ports. The designated port is a port on the segment
(with two switches) that has the internal root path cost to the root bridge.
• 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.
What Did I Learn In This Module? (Cont.)
• When a switch has multiple equal-cost paths to the root bridge, the switch will determine a port using the following criteria:
lowest sender BID, then the lowest sender port priority, and finally the lowest sender port ID.
• STP convergence requires three timers: the hello timer, the forward delay timer, and the max age timer.
• Port states are blocking, listening, learning, forwarding, and disabled.
• In PVST versions of STP, there is a root bridge elected for each spanning tree instance. This makes it possible to have
different root bridges for different sets of VLANs.
• STP is often used to refer to the various implementations of spanning tree, such as RSTP and MSTP.
• RSTP is an evolution of STP that provides faster convergence than STP.
• RSTP port states are learning, forwarding and discarding.
• PVST+ is a Cisco enhancement of STP that provides a separate spanning tree instance for each VLAN configured in the
network. PVST+ supports PortFast, UplinkFast, BackboneFast, BPDU guard, BPDU filter, root guard, and loop guard.
• Cisco switches running IOS 15.0 or later, run PVST+ by default.
• Rapid PVST+ is a Cisco enhancement of RSTP that uses PVST+ and provides a separate instance of 802.1w per VLAN.
• When a switch port is configured with PortFast, that port transitions from blocking to forwarding state immediately, bypassing
the STP listening and learning states and avoiding a 30 second delay.
• Use PortFast on access ports to allow devices connected to these ports, such as DHCP clients, to access the network
immediately, rather than waiting for STP to converge on each VLAN.
Module Practice and Quiz
What Did I Learn In This Module? (Cont.)
• Cisco switches support a feature called BPDU guard which immediately puts the switch port in an error-disabled state upon
receipt of any BPDU to protect against potential loops.
• Over the years, Ethernet LANs went from a few interconnected switches that were connected to a single router, to a
sophisticated hierarchical network design. Depending on the implementation, Layer 2 may include not only the access layer,
but also the distribution or even the core layers. These designs may include hundreds of switches, with hundreds or even
thousands of VLANs. STP has adapted to the added redundancy and complexity with enhancements as part of RSTP and
MSTP.
• 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.