How Spanning Tree Works:
1. STP elects a root bridge, all interfaces placed in forwarding state.
2. Each non-root bridge considers one of its ports to have the least
administrative cost between itself and the root bridge. Root port placed
in forwarding state.
3. Bridge with least cost is designated bridge/designated port, placed in forwarding state.
Electing the Root and Discovering Root Ports/Designated Ports:
- Root bridge’s bridge ID: bridge’s priority and MAC address. Lowest priority is chosen first; if all equal, lowest MAC is chosen.
- Message sent to each switch is called Hello BPDU
- If a bridge receives a BPDU that is "beter" than its self, forwards that BPDU, claiming it to be the root port.
- Lowest cost hello: cost calculated by adding the cost in the received hello to the cost of the interface the hello BPDU was received.
[edit section] Default Port Costs
Ethernet Speed | Original Cost | Revised Cost |
10 Mbps | 100 | 100 |
100 Mbps | 10 | 19 |
1 Gbps | 1 | 4 |
10 Gbps | 1 | 2 |
[edit section] Reacting to Changes in the Network
Describes how STP handles breaks in cabling/other network changes.
- Hello Time: How long the root waits before sending periodic Hello BPDUs, which are forwarded by the other bridges/switches. Default is 2 seconds.
- MaxAge: How long any bridge should wait after beginning to not hear hellos, before trying to change the STP topology. Default is 20 seconds.
- Forward Delay: Delay that affects the time involved when an interface changes from blocking state to forwarding state.
Order: Blocking -> Listening -> Learning -> Forwarding
STP Summary
1. The root sends hello BPDU (cost of 0) out all interfaces.
2. Neighboring bridges forward hellos out their nonroot designated ports, identifying root, with their cost added.
3. Each bridge in the network repeats the previous step.
4. Root repeats step 1 every {hello time}.
5. If bridge doesn’t receive hello, continues as normal until time = MaxAge.
a. Switch waits MaxAge time, place in listening state for
{Forward Delay} seconds, place in learning state for {Forward Delay}
seconds, place in forwarding state. Default convergence time = 50 seconds
b. Must also timeout entries in MAC table (send Topology Change Notification, or TCN BPDU)
State | Forward Frames? | Learn MAC Addresses? | State |
Blocking | No | No | Stable |
Listening | No | No | Transitory |
Learning | No | Yes | Transitory |
Forwarding | Yes | Yes | Stable |
Optional STP Features
EtherChannel: Provides a way to prevent STP convergence from
being needed when only a single port/cable failure occurs. Combines from
2-8 parallel Ethernet trunks between same pair of switch, which STP
treats as a single link.
- Also provides more bandwidth
*Both links to the same switch must fail for a switch to need STP convergence*
PortFast: Allows a switch to place a port in forwarding state
immediately when the port becomes physically active (only safely done
when device is not a bridge/switch)
- Used for end-user devices
- Cisco BPDU Guard Feature, if enabled, tells the switch to disable PortFast ports if BPDU is received on those ports.
Rapid Spanning Tree (IEEE 802.1w)
Assignment to forwarding/blocking ports the same. RSTP can be
used alongside 802.1d STP (for switches that support RSTP). Main reason
to use RSTP is to overcome convergence time (default of 50 seconds).
Traditional Convergence Time
MaxAge (20 sec) + Listening (15 sec) + Learning (15 sec) = 50 seconds
RSTP Convergence Time: typically less than 10 seconds.
RSTP Link and Edge Types
Link-Type point-to-point: Links between switches
Edge-Type point-to-point: Link between switch/end user
Link-Type Shared: Link between switch and a hub
- RSTP doesn’t improve convergence for this type
RSTP Port States
Operational State | STP State (802.1d) | RSTP State (802.1w) | Port included in Active RSTP Topology? |
Enabled | Blocking | Discarding | No |
Enabled | Listening | Discarding | No |
Enabled | Learning | Learning | Yes |
Enabled | Forwarding | Forwarding | Yes |
Disable | Disable | Discarding | No |
RSTP Port Roles
RSTP | STP Role | Definition |
Root port | Root Port | A single port that hears best BPDU. |
Designated Port | Designated Port | Port that advertises "best" BPDU |
Alternate Port | -- | Port on a switch that receives sub-optimal BPDU |
Backup Port | -- | When single switch has two links to same segment (hub) |
Disabled | -- | A port that is administratively down |
RSTP Convergence
- Edge-Type: RSTP immediately places Edge-Type into forwarding state (just like PortFast).
- Link-Type Point-to-Point: RSTP recognizes lost hellos must faster than STP (3 times the hello timer, of default of 6 seconds).
- Also removes the need for listening state
- Reduces time for learning state by actively negotiating new state w/ neighboring switches (Proposal and Agreement Messages)
Spanning Tree Protocol Configuration
Cisco switches use STP by default, but
configuration/customizations can be made for different VLANs, or use
something other than default settings.
Command | Description |
spanning-tree vlan [vlan #] root | Global config that changes the switch to the root switch. Priority switched to 24,576 or 100 less than current root bridge. |
Spanning-tree vlan [vlan ID] {priority} | Global config that changes bridge priority for the specified vlan |
spanning-tree cost [cost] | Interface subcommand that changes STP cost to the specified value |
channel-group {channel-group number} mode {auto | desirable | on} | Enables EtherChannel on this interface |
show spanning-tree | Exec command that displays STP on the switch/each port |
show spanning-tree [interface] | Displays STP for specified interface |
show spanning-tree vlan [vlan-id] | Lists STP information for specified VLAN |
debug spanning-tree | Causes switch to provide informational messages about changes in STP topology |
show etherchannel [channel-group #] {brief | detail | port | port-channel | summary} | Lists information about state of EtherChannel on the switch |
EtherChannel Configuration: The modes in channel-group should be
set to on for all channels, or one to auto, and one to desirable. If all
links set to auto, EtherChannel will not initialize.
0 comments:
Post a Comment