STP01

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 66

Understanding

and Implementing
Spanning Tree
Protocol (STP)
1. Overview of Spanning Tree Protocol
(STP)
2. Different STP Variants
3. STP Operation
4. Configuring STP on Cisco Switches
5. Best Practices and Troubleshooting
Overview of Spanning Tree Protocol
Purpose of STP:
STP is a protocol used in network bridges and switches to prevent
loops in Ethernet networks, which can cause broadcast storms and
network congestion.
Loops occur when there are redundant links between switches,
creating multiple paths for data to traverse. Without loop
prevention mechanisms like STP, packets may circulate endlessly,
degrading network performance and reliability.
Concept of Spanning Tree:
A spanning tree is a subset of the network topology that includes
all switches (bridges) in the network with the minimum number of
links necessary to connect them without forming any loops.
STP dynamically selects and maintains the spanning tree topology
by designating certain links as active and others as blocked,
effectively creating a loop-free network.
Overview of Spanning Tree Protocol
STP Operation:
STP operates by electing a root bridge, which serves as the
central point in the spanning tree topology. All other
switches determine their distance (cost) to the root bridge,
and the path with the lowest cost becomes the active path.
Each switch in the network then selects one of its ports as
the root port, which provides the shortest path to the root
bridge. Additionally, designated ports are selected on each
segment to forward traffic toward the root bridge, while
other ports are placed in a blocking state to prevent loops.
Overview of Spanning Tree Protocol
Key Components of STP:
Bridge ID (BID): A unique identifier consisting of a priority
value and a MAC address, used to elect the root bridge and
determine the spanning tree topology.
Root Bridge: The switch with the lowest BID, serving as
the reference point for all other switches in the network.
Port Roles: Each port on a switch assumes a specific role in
the spanning tree, such as root port, designated port,
blocking port, or forwarding port, based on its position
relative to the root bridge.
Overview of Spanning Tree Protocol
Benefits of STP:
Ensures network stability by preventing loops and
broadcast storms.
Facilitates automatic failover in case of link or switch
failures, maintaining continuous connectivity.
Optimizes network performance by selecting the most
efficient paths for data transmission.

Overall, the overview of STP highlights its critical role in


maintaining a resilient and efficient network infrastructure
by eliminating loops and ensuring a loop-free topology.
Different STP Variants

• STP (Spanning Tree Protocol):


• This is the original version of the protocol
standardized by IEEE 802.1D.
• STP operates by exchanging Bridge Protocol Data
Units (BPDUs) between switches to establish a
loop-free topology.
• It has a slow convergence time, typically taking tens
of seconds to stabilize the network after a change in
topology.
• STP remains widely supported and is the foundation
for other STP variants.
Different STP Variants
• RSTP (Rapid Spanning Tree Protocol):
• RSTP, defined in IEEE 802.1w, is an evolution of STP
designed to improve convergence time.
• It introduces several enhancements over STP, including:
• Rapid convergence: RSTP significantly reduces the
time required to converge the network topology after
a change, typically within a few seconds.
• Port roles: RSTP introduces additional port roles
such as Alternate and Backup ports, allowing for
faster path selection and failover.
• Link types: RSTP distinguishes between point-to-
point and shared segments, optimizing port states
and reducing unnecessary transitions.
• RSTP is backward compatible with STP, allowing RSTP-
enabled switches to interoperate with STP switches.
Different STP Variants
• MSTP (Multiple Spanning Tree Protocol):
• MSTP, specified in IEEE 802.1s, extends the capabilities
of STP/RSTP by supporting multiple spanning tree
instances within a single network.
• Unlike traditional STP and RSTP, which create a single
spanning tree for the entire network, MSTP enables the
creation of multiple spanning tree instances, each tailored
to a specific VLAN or group of VLANs.
• MSTP reduces the overhead associated with maintaining
separate spanning trees for each VLAN, improving
scalability and resource utilization.
• It allows network administrators to map VLANs to
specific spanning tree instances, providing greater
flexibility in network design and optimization.
STP
Operation
STP operates by dynamically
electing a root bridge and
configuring a loop-free topology
within a network to prevent
broadcast storms and ensure
reliable data transmission
STP
Operation
• Root Bridge Election:
• When STP is enabled on switches within a network,
the first step is to elect a root bridge.
• Each switch assigns itself a Bridge ID (BID), which
consists of a configurable priority value and the
switch's MAC address.
• Initially, all switches assume they are the root bridge
and advertise their BID in Bridge Protocol Data
Units (BPDUs), messages exchanged between
switches to negotiate the spanning tree topology.
• The switch with the lowest BID becomes the root
bridge. If multiple switches have the same priority,
the switch with the lowest MAC address is selected
as the root bridge.
STP
Operation
• Root Port Selection:
• Once the root bridge is elected, each non-root
switch determines the shortest path to reach the
root bridge.
• Each switch calculates the cost of its links to
the root bridge based on the configured port
costs. The cost is typically based on the link
speed, with faster links having lower costs.
• The switch selects the port with the lowest cost
as its root port, which provides the shortest
path to the root bridge. If multiple ports have
the same cost, the port connected to the switch
with the lowest BID is chosen.
STP
Operation
• Designated Port Selection:
• After selecting root ports, each segment (collision
domain) in the network must have a designated port
to forward traffic towards the root bridge.
• Switches exchange BPDUs to determine which
switch has the lowest-cost path to the root bridge on
each segment.
• The switch with the lowest path cost on a segment is
designated as the designated switch for that segment,
and its port connected to the segment becomes the
designated port.
• All other switches on the segment place their ports in
a blocking state to prevent loops, except for the
switch with the designated port.
STP
Operation
• Blocking Ports:
• Ports that are not selected as root ports
or designated ports are placed in a
blocking state.
• Blocking ports do not forward traffic
but still listen to BPDUs to monitor the
network topology for changes.
• Blocking ports prevent loops by
effectively "shutting down" redundant
links, ensuring a loop-free topology.
STP
Operation
• Topology Maintenance:
• STP continuously monitors the network
topology by exchanging BPDUs and
recalculating port states as changes
occur.
• If a link or switch failure is detected,
STP dynamically reconfigures the
spanning tree topology to restore
connectivity while maintaining loop
prevention.
Configuring STP on Cisco Switches

Configuring Spanning Tree Protocol


(STP) on Cisco switches involves setting
parameters to control the behavior of STP,
such as bridge priority, port costs, and
optional features like PortFast and BPDU
Guard.
Configuring STP on Cisco Switches
Enter privileged EXEC mode by typing
enable
Enter global configuration mode by typing
configure terminal or conf t

Basic STP Configuration:


To enable STP globally on the switch, use the following command:
switch(config)# spanning-tree mode {stp | rapid-pvst | mst}

stp: Enables traditional STP.


rapid-pvst: Enables Rapid Spanning Tree Protocol (RSTP).
mst: Enables Multiple Spanning Tree Protocol (MSTP).
Configuring STP on Cisco Switches
Enter privileged EXEC mode by typing
enable
Enter global configuration mode by typing
configure terminal or conf t

Basic STP Configuration:


To enable STP globally on the switch, use the following command:
switch(config)# spanning-tree mode {stp | rapid-pvst | mst}

stp: Enables traditional STP.


rapid-pvst: Enables Rapid Spanning Tree Protocol (RSTP).
mst: Enables Multiple Spanning Tree Protocol (MSTP).
Configuring STP on Cisco Switches

Bridge Priority Configuration:


To set the bridge priority to influence root bridge
election, use the following command:
switch(config)# spanning-tree vlan <vlan-id> priority
<priority-value>
switch(config)# spanning-tree vlan 10 priority 24576
Configuring STP on Cisco Switches

Port Cost Configuration:


To adjust the cost of a specific port to influence path selection,
use the following command:
switch(config-if)# spanning-tree vlan <vlan-id> cost <cost-
value>
switch(config-if)# interface GigabitEthernet0/1
switch(config-if)# spanning-tree vlan 10 cost 10
Configuring STP on Cisco Switches

Optional Features Configuration:


• PortFast: To enable PortFast on an interface for
rapid transition to forwarding state, use the
following command:
switch(config-if)# spanning-tree portfast

BPDU Guard: To enable BPDU Guard on an


interface to protect against unauthorized switches,
use the following command:
switch(config-if)# spanning-tree bpduguard enable
Configuring STP on Cisco Switches

Viewing STP Configuration:


To verify the STP configuration and status, use the
following commands:
switch# show spanning-tree
switch# show spanning-tree vlan <vlan-id>
• Saving Configuration:
• After configuring STP, remember to save the
configuration to the startup configuration to persist
across reboots:
switch# copy running-config startup-config
So What is STP?
STP is a network protocol used in Ethernet switches to
prevent loops in bridged or switched networks. It operates by
dynamically electing a root bridge and configuring a loop-free
topology within the network.

The purpose of STP is to address the inherent problem of


loops that can occur in networks with redundant links.
Without loop prevention mechanisms, such as STP, loops can
lead to broadcast storms and network congestion, causing
significant degradation in network performance or even
network failure.
So What is STP?
Loop Detection:
STP detects and identifies potential loops within the network
topology by exchanging special messages called Bridge Protocol
Data Units (BPDUs) between switches.
Loop Elimination:
After identifying potential loops, STP calculates the shortest path
to the root bridge (the central switch in the network) from each
switch and blocks specific ports to eliminate loops while
ensuring a loop-free topology.
Root Bridge Election:
STP elects a root bridge based on a combination of factors,
including the bridge priority and MAC address. The root bridge
becomes the reference point for the spanning tree topology, and
all switches in the network determine their position relative to
the root bridge.
So What is STP?
Port Blocking:
STP selects specific ports on switches to block,
effectively "shutting down" redundant links and
preventing loops. These blocked ports remain in a
standby state and do not forward traffic unless the active
path fails, ensuring a redundant backup link is available.
Dynamic Adaptation:
STP continuously monitors the network topology for
changes, such as link failures or additions, and
dynamically adjusts the spanning tree topology as
needed to maintain a loop-free environment. This
adaptive behavior ensures network stability and
resilience in the face of evolving network conditions.
Loop prevention
Loop prevention is crucial in Ethernet
networks due to the inherent
characteristics of Ethernet technology
and the potential risks associated with
network loops
Loop prevention
Broadcast Storms:
In Ethernet networks, broadcast frames are used for various purposes,
such as address resolution (ARP) and network discovery protocols.
When a loop exists in the network, broadcast frames can circulate
endlessly, creating a broadcast storm. This flood of broadcast traffic
consumes network bandwidth and resources, leading to network
congestion and performance degradation.
Uncontrolled Traffic Flooding:
Network loops cause packets to continuously circulate between
switches without reaching their intended destinations. This
phenomenon, known as traffic looping or flooding, results in
inefficient use of network resources and can overwhelm network
devices, leading to packet loss and service disruptions.
Loop prevention
MAC Address Table Instability:
Ethernet switches use MAC address tables to forward traffic to the
appropriate destination ports. In the presence of network loops,
switches may receive frames with MAC addresses already learned on
multiple ports due to looping. This can cause instability in the MAC
address table, leading to incorrect forwarding decisions and potential
data forwarding issues.
Duplication of Frames:
Network loops can cause duplicate frames to be delivered to the same
destination, resulting in data duplication and potential inconsistencies
in network communication. This duplication can lead to data
corruption, out-of-order delivery, and other issues affecting network
reliability and integrity.
Loop prevention
Spanning Tree Protocol (STP) Limitations:
While Spanning Tree Protocol (STP) effectively prevents loops in
Ethernet networks, it operates by blocking redundant links, which can
result in suboptimal network paths and reduced bandwidth utilization.
Furthermore, STP's convergence time may not be fast enough to
prevent temporary network disruptions caused by link failures or
topology changes.
Service Disruptions:
In the worst-case scenario, network loops can lead to complete
service disruptions, rendering the network inaccessible to users and
causing significant downtime. These disruptions can have severe
consequences for businesses, leading to lost productivity, revenue,
and customer dissatisfaction.
STP Variants:

STP
RSTP (Rapid Spanning Tree Protocol)
MSTP (Multiple Spanning Tree Protocol)
STP (Spanning Tree Protocol):
• STP is the original spanning tree protocol
standardized by IEEE 802.1D.
• It operates by electing a root bridge and configuring
a loop-free topology within the network.
• STP has a relatively slow convergence time,
typically taking tens of seconds to stabilize the
network after a change in topology.
• While effective in preventing loops, STP's slow
convergence time may not be suitable for modern
networks with stringent latency requirements.
RSTP (Rapid Spanning Tree
Protocol):
• RSTP, defined in IEEE 802.1w, is an evolution of STP
designed to improve convergence time.
• It introduces several enhancements over STP, including:
• Rapid convergence: RSTP significantly reduces the
time required to converge the network topology after
a change, typically within a few seconds.
• Port roles: RSTP introduces additional port roles
such as Alternate and Backup ports, allowing for
faster path selection and failover.
• Link types: RSTP distinguishes between point-to-
point and shared segments, optimizing port states
and reducing unnecessary transitions.
• RSTP is backward compatible with STP, allowing RSTP-
enabled switches to interoperate with STP switches.
MSTP (Multiple Spanning Tree
Protocol):
• MSTP, specified in IEEE 802.1s, extends the capabilities
of STP/RSTP by supporting multiple spanning tree
instances within a single network.
• Unlike traditional STP and RSTP, which create a single
spanning tree for the entire network, MSTP enables the
creation of multiple spanning tree instances, each tailored
to a specific VLAN or group of VLANs.
• MSTP reduces the overhead associated with maintaining
separate spanning trees for each VLAN, improving
scalability and resource utilization.
• It allows network administrators to map VLANs to
specific spanning tree instances, providing greater
flexibility in network design and optimization.
Key Differences and Considerations
• STP is the original spanning tree protocol with
slow convergence time.
• RSTP offers faster convergence and additional
port roles for optimized path selection.
• MSTP provides scalability and flexibility by
supporting multiple spanning tree instances for
VLAN-based segmentation.
Choosing the Right Variant
• Consider the network's requirements for
convergence time, scalability, and VLAN
segmentation.
• Use RSTP or MSTP in modern networks that
require faster convergence and support for
multiple VLANs.
• STP may still be suitable for smaller networks
with less stringent latency requirements.
When to use each variant based on network
requirements

Choosing the appropriate


Spanning Tree Protocol (STP)
variant depends on various
network requirements,
including convergence time,
scalability, and VLAN
segmentation needs.
STP (Spanning Tree Protocol):
• Use traditional STP in smaller networks
with relatively simple topologies and no
stringent latency requirements.
• STP is suitable for environments where
convergence time is not a critical factor, and
the network topology remains relatively
static.
• Consider STP for networks with limited
VLANs and where the overhead of
managing multiple spanning tree instances
is unnecessary.
RSTP (Rapid Spanning Tree Protocol):
• Choose RSTP for networks that require
faster convergence times and improved loop
prevention mechanisms.
• RSTP is ideal for environments where
network stability and rapid recovery from
topology changes are essential, such as in
enterprise networks, data centers, and real-
time applications.
• Consider RSTP in larger networks with
more complex topologies or where network
growth and changes are frequent.
MSTP (Multiple Spanning Tree Protocol):
• Opt for MSTP in networks with VLAN
segmentation requirements and scalability
needs.
• MSTP is suitable for environments where
VLAN-based segmentation is necessary,
allowing for the creation of multiple spanning
tree instances tailored to different VLANs or
groups of VLANs.
• Use MSTP in larger and more complex
networks, such as enterprise networks, service
provider networks, and campus environments,
where VLAN management and scalability are
critical.
Key Considerations

• Convergence Time: Choose RSTP or MSTP


for networks requiring faster convergence times
to minimize downtime and optimize network
performance.
• Scalability: Use MSTP for networks with
scalability requirements, especially those with
multiple VLANs and dynamic growth.
• VLAN Segmentation: Opt for MSTP in
environments where VLAN-based segmentation
is necessary for network segmentation and
optimization.
Hybrid Approaches:

• In some cases, a hybrid approach combining


different STP variants may be appropriate. For
example, using RSTP at the core layer for faster
convergence and MSTP at the distribution or
access layers for VLAN segmentation.
• Evaluate network requirements, topology
complexity, and growth projections to
determine the most suitable combination of STP
variants for your specific environment.
STP Operations

 Bridge ID (BID)
determination
 Root bridge
election
 Designated and
non-designated
ports
Bridge ID (BID) determination

Bridge ID (BID) is a crucial


concept in Spanning Tree
Protocol (STP) used to
uniquely identify switches
and prioritize the selection of
the root bridge within a
network.
The BID consists of two
components: Bridge Priority
and MAC Address.
Bridge ID (BID) determination

• Bridge Priority:
• Bridge Priority is a configurable value
(ranging from 0 to 65535) that indicates the
priority of a switch in the spanning tree
topology.
• Lower Bridge Priority values take
precedence in the selection process. The
default value is typically 32768 for most
switches.
• Administrators can manually configure the
Bridge Priority to influence the selection of
the root bridge within the network.
Bridge ID (BID) determination

• MAC Address:
• Every switch has a unique Media
Access Control (MAC) address
assigned to its hardware interface.
• MAC addresses are used as tiebreakers
in the Bridge ID determination process.
If two switches have the same Bridge
Priority, the switch with the lower
MAC address becomes the root bridge.
Bridge ID (BID) determination
• BID Determination Process:
• When a switch boots up or joins the network, it
generates its BID by combining its configured
Bridge Priority and MAC Address.
• The resulting BID uniquely identifies the
switch within the network and serves as its
identifier in the spanning tree topology.
• Switches exchange Bridge Protocol Data Units
(BPDUs) containing their BIDs during the STP
election process.
• During the root bridge election process,
switches compare BIDs received from
neighboring switches to determine the root
bridge.
• The switch with the lowest BID (comprising
the lowest Bridge Priority and, if necessary, the
lowest MAC Address) is elected as the root
bridge for the network.
Bridge ID (BID) determination
• Root Bridge Election:
• Once all switches exchange BPDUs
and determine their BIDs, the root
bridge election process begins.
• Switches compare the BIDs received
from neighboring switches to select the
switch with the lowest BID as the root
bridge.
• The root bridge serves as the central
point in the spanning tree topology and
determines the shortest path to reach all
other switches in the network.
Root bridge election

Root bridge election is a fundamental


process in the STP where switches within a
network determine which switch will serve
as the root bridge.
The root bridge plays a central role in STP
by serving as the reference point for the
spanning tree topology and determining the
shortest path to reach all other switches in
the network.
Root bridge election
• Bridge ID (BID) Determination:
• Each switch participating in STP generates its Bridge
ID (BID) by combining its Bridge Priority and MAC
Address. The BID uniquely identifies the switch within
the network.
• Bridge Priority is a configurable value (ranging from 0
to 65535) that determines the priority of a switch in the
spanning tree topology. A lower Bridge Priority value
indicates a higher priority.
• If two switches have the same Bridge Priority, the
switch with the lower MAC Address becomes the root
bridge.
Root bridge election
• Exchange of Bridge Protocol Data Units
(BPDUs):
• Switches exchange Bridge Protocol Data Units
(BPDUs) with neighboring switches to
communicate information about their BIDs.
• BPDUs contain information such as the sender's
BID, the root bridge's BID, and the sender's cost to
reach the root bridge.
• During the root bridge election process, switches
compare the BIDs received from neighboring
switches to determine the root bridge.
Root bridge election
• Selection of Root Bridge:
• Switches select the root bridge based on the BIDs
received from neighboring switches.
• The switch with the lowest BID (comprising the
lowest Bridge Priority and, if necessary, the lowest
MAC Address) is elected as the root bridge.
• If a switch receives multiple BPDUs with different
root bridge BIDs, it selects the BPDU with the
lowest root bridge BID and propagates that
information to neighboring switches.
Root bridge election
Propagation of Root Bridge Information:
Once the root bridge is elected, switches propagate
information about the root bridge throughout the
network.
Each switch forwards BPDUs containing information
about the root bridge's BID, allowing all switches to
converge on the same root bridge selection.
Topology Calculation:
With the root bridge elected, switches calculate the
shortest path to reach the root bridge using the spanning
tree algorithm.
Switches designate root ports, designated ports, and
blocking ports based on their distance to the root
bridge, forming a loop-free spanning tree topology.
Designated and
non-designated
ports

STP, designated and non-


designated ports play
crucial roles in constructing
a loop-free spanning tree
topology within a network.
Designated and non-
designated ports
Designated Ports:
• Designated ports are selected on each network
segment (collision domain) to forward traffic toward
the root bridge.
• Each segment in the network has only one designated
port, responsible for forwarding frames to the root
bridge.
• The switch with the lowest cost path to the root bridge
on a segment is designated as the designated switch
for that segment, and its port connected to the segment
becomes the designated port.
• Designated ports are in the forwarding state, allowing
traffic to flow freely through them.
Designated and non-
designated ports
• Non-Designated Ports:
• Non-designated ports are ports that are not selected as
designated ports on a network segment.
• These ports are typically placed in a blocking state to
prevent loops by effectively "shutting down"
redundant links.
• Non-designated ports do not forward traffic but
instead listen to Bridge Protocol Data Units (BPDUs)
to monitor the network topology for changes.
• If a designated port fails or becomes unavailable, a
non-designated port may transition to the designated
state, allowing traffic to flow through it.
Designated and non-
designated ports
• Designated ports ensure that traffic on each
network segment is forwarded toward the root
bridge, preventing loops and ensuring efficient
data forwarding.
• Non-designated ports help eliminate redundancy
by blocking certain links, thus ensuring a loop-
free spanning tree topology. They act as backup
links and only become active if the primary path
fails.
Designated and non-
designated ports
• Port Roles Transition:
• The transition between designated and non-designated
port roles occurs dynamically as the network topology
changes.
• If a designated port fails or becomes unavailable,
neighboring switches may reevaluate the topology and
select a new designated port, allowing traffic to be
rerouted through an alternate path.
• Conversely, if a non-designated port becomes the best
path to the root bridge due to changes in the network
topology, it may transition to the designated state,
enabling traffic forwarding.
Key Points
In the lecture on Spanning Tree
Protocol (STP) in Cisco
environments, several key points
were covered
Key Points
• Overview of Spanning Tree Protocol
(STP):
• STP is a network protocol used to prevent
loops in Ethernet networks by
dynamically electing a root bridge and
configuring a loop-free topology.
• STP operates by exchanging Bridge
Protocol Data Units (BPDUs) between
switches and selecting designated ports,
root ports, and blocking ports to construct
a loop-free spanning tree topology.
Key Points
• Different STP Variants:
• STP: The original spanning tree protocol
with slow convergence time.
• RSTP (Rapid Spanning Tree Protocol):
Improves convergence time and
introduces additional port roles for
optimized path selection.
• MSTP (Multiple Spanning Tree Protocol):
Supports multiple spanning tree instances
for VLAN-based segmentation and
scalability.
Key Points
• Choosing the Right STP Variant:
• Consider factors such as convergence
time, scalability, and VLAN segmentation
needs when selecting the appropriate STP
variant for a network environment.
• Use RSTP or MSTP in modern networks
requiring faster convergence, scalability,
and support for VLAN segmentation.
• STP may still be suitable for smaller
networks with less stringent latency
requirements.
Key Points
• STP Operation:
• STP dynamically elects a root bridge,
selects root ports and designated ports,
and places redundant links in a
blocking state to prevent loops.
• It continuously monitors the network
topology for changes and adapts
dynamically to maintain network
stability and reliability.
Key Points
Configuring STP on Cisco Switches:

Configure STP using commands such as


spanning-tree mode, spanning-tree vlan, and
spanning-tree portfast on Cisco switches.
Verify STP configuration and status using
commands like
show spanning-tree
and
show spanning-tree vlan.
Key Points
Bridge ID (BID) Determination:
Bridge ID (BID) uniquely identifies
switches within the network and
influences root bridge election based on
bridge priority and MAC address.
Port Roles in STP:
Different port roles include Root Port,
Designated Port, Blocking Port, and
Forwarding Port, each serving specific
functions in the spanning tree topology.

You might also like