3. IntroductionIntroduction
Layer 2 Bridge-to-Bridge Protocol
Loop Avoidance Mechanism
Developed by Radia Perlman
Defined in IEEE 802.1d standard
Enabled by default on Cisco Catalyst
switches
Uses the Spanning Tree Algorithm
Creates Loop-free Logical Topology
CCNA Project Report 3
4. Why Use STP?Why Use STP?
The Need for STP
In a layer 2 switched network, while multiple links between
devices provide protection against single points of failure,
they also introduce physical loops in the network.
Redundant links can cause a lot of problems, including:
• Broadcast storms
• Multiple copies of Ethernet frame
• Thrashing of the MAC table
STP prevents physical networking loops from occurring
by identifying the redundant links in the network, and blocking
some of them to create a loop-free logical topology.
CCNA Project Report 4
5. Spanning Tree TermsSpanning Tree Terms
Root Bridge – the focal point of
the network that influences all STP
decisions
Root Port – the port (on a
nonroot bridge) used to reach the
root bridge
Designated Port – the port with
the least advertised path cost to the
root bridge
CCNA Project Report 5
6. Spanning Tree Terms (contd.)Spanning Tree Terms (contd.)
Bridge ID – Priority + MAC Address, used
to identify each switch in the network,
default priority = 32,768
BPDU – Bridge Protocol Data Unit, used
by switches to exchange STP information
among themselves
Path/Port Cost – determined by the
bandwidth of a link
CCNA Project Report 6
8. STP Port StatesSTP Port States
Disabled – Administratively down
Blocking – Receives BPDUs only
Listening – Building active topology
Learning – Building bridging table
Forwarding – Building MAC table,
sending/receiving user data
CCNA Project Report 9
9. STP TimersSTP Timers
Hello Time – how often BPDUs are
sent (default = 2 seconds)
Max Age – maximum time to retain the
received BPDU information (default = 20
seconds)
Forward Delay – time to wait before
transitioning from listening to learning
state, and from learning to forwarding state
(default = 15 seconds)
CCNA Project Report 10
10. STP VersionsSTP Versions
Spanning Tree Protocol (IEEE 802.1d)
Per VLAN Spanning Tree (PVST+)
Rapid Spanning Tree Protocol, or RSTP
(IEEE 802.1w)
CCNA Project Report 11
STP is a layer 2 protocol that is used to maintain a loop-free switched network. Its main task is to stop network loops from occurring on the layer 2 network.
STP uses the Spanning Tree Algorithm (STA) to first create a topology database and then search out and disable redundant links.
STP creates a tree structure of loop-free leaves and branches that spans the entire Layer 2 network.
Layer 2 broadcast frames, such as Ethernet frames, do not have a TTL (Time To Live) field like the IP header. Once an Ethernet frame starts to loop, it will probably continue until someone shuts off one of the switches or breaks a link.
Switching loops can occur any time there is a redundant path in the network. The switches will flip flop the MAC table entry for a connected device, resulting in a phenomenon known as Thrashing of the MAC Table, creating extremely high CPU utilization.
- One Root Bridge Per Broadcast Domain
- One Root Port Per Non-root Bridge
- One Designated Port Per Segment
- The switch with the lowest BID becomes the Root Bridge, which acts as the focal point of the network. All other switches in the network will be Non-root bridges, and will select a single path to the root bridge. The port with the best path (least path/port cost) to the root bridge is called the Root Port.
- Bridge Identifier (BID) is used to identify each bridge/switch in the network. BID is 8 bytes long – Bridge Priority (2 bytes), Base MAC Address (6 bytes). It is used in determining the center of the network, in respect to STP, known as the Root Bridge.
- Designated Port has the lowest advertised cost to reach the root bridge. It is always in forwarding mode.
- Bridge Identifier (BID) is used to identify each bridge/switch in the network. BID is 8 bytes long – Bridge Priority (2 bytes), Base MAC Address (6 bytes). It is used in determining the center of the network, in respect to STP, known as the Root Bridge.
- Bridge Protocol Data Unit (BPDU) are layer 2 frames exchanged between switches to determine the root bridge and subsequently the root and designated ports.
- STP path costs are incremented as BPDUs are received on a port, not as they are sent out a port.
If the Path Cost and Bridge IDs are equal (as in the case of parallel links), the switch goes to the Port Priority as a tiebreaker.
Lowest port priority wins (all ports are set to 32).
Port Priority can be set in the range 0 – 63.
If all ports have the same priority, the port with the lowest Port Number forwards frames.
Root Path Cost is the cumulative cost of all links to the root bridge. This is the value transmitted in the BPDU, indicated by the Cost of Path field. It is calculated by adding the receiving port’s Path Cost to the value contained in the BPDU.
Each segment in a bridged network has one Designated Port, chosen based on cumulative Root Path Cost to the Root Bridge. The switch containing the designated port is referred to as the Designated Bridge for that segment.
All other ports, which are not Root Ports or Designated Ports, become Non-Designated Ports, which are put in blocking mode.
Disabled – No frames forwarded, no BPDUs heard
Blocking – No frames forwarded, BPDUs heard
Listening – No frames forwarded, listening for frames
Learning – No frames forwarded, learning addresses
Forwarding – Frames forwarded, learning addresses
When a switch is first powered on, all the ports are in blocking mode.
PortFast can be used for ports connected to end devices such as PCs or servers.
Max Age Timer: Time to wait before transitioning to learning state if three BPDUs are missed (default = 20 seconds)
STP 802.1d – Common Spanning Tree (CST), Mono Spanning Tree (MST)
Cisco Enhancements (First Evolution) – Portfast, Uplink fast, Backbone fast
Cisco Enhancements (Second Evolution) – PVST (ISL), PVST+ (ISL+802.1q), additional BPDU Guard & Root Guard, includes previous enhancements
Cisco MISTP – Uses PVST+, includes previous enhancements, Catalyst 4000/6000
RSTP 802.1w – Edge Fast (Cisco Portfast), Uplink Fast RSTP (Cisco Uplink fast), Backbone Fast Engine (Cisco Backbone fast)
MST (Multiple Spanning Tree) – 802.1s, uses RSTP