Jeremy’s IT Lab lecture video:
Day 21 - Spanning Tree Protocol (STP) (2)
Commands
Commands List
Spanning Tree Show Commands
6. Spanning Tree
Link to original
- show spanning-tree
-->
Shows general STP status and information- show spanning-tree vlan vlan-id
-->
Shows spanning-tree information for a specific VLAN- show spanning-tree detail
-->
Shows detailed STP information- show spanning-tree summary
-->
Shows a summary of the current STP configurationSpanning Tree Interface Commands
Spanning Tree
1. General
- spanning-tree mode mode {mst
/
pvst/
rapid-pvst} (Versions)2. Spanning Tree Portfast / BPDU Guard
- spanning-tree portfast
-->
Enables portfast on the current interface.- spanning-tree portfast default
-->
Enables Portfast on all access ports by default.- spanning-tree bpduguard enable
-->
Enables BPDU Guard on the current interface.- spanning-tree portfast bpduguard default
-->
Enables BPDU Guard on all Portfast-enabled interfaces by default.3. Spanning Tree VLAN Related
- spanning-tree vlan vlan-id root primary
-->
Sets the STP bridge priority to 24576 (Or 4096 lower than the current lowest STP priority.)- spanning-tree vlan vlan-id root secondary
-->
Sets the STP bridge priority to 28672- spanning-tree vlan vlan-id cost number
-->
Changes the interface’s STP root cost- spanning-tree vlan vlan-id port-priority number
-->
Changes the interface’s port priority4. Spanning Tree Link Type
Link to original
- spanning-tree link-type type { point-to-point
/
shared }
Classic Spanning Tree Information
The protocol version identifier for classic STP is 0
Spanning Tree Port States
Classic Spanning Tree has 5 different port states, being:
- Blocking / Stable
- Listening / Transitional
- Learning / Transitional
- Forwarding / Stable
- Disabled
A forwarding interface can move directly into a blocking,
However, a blocking cannot move directly into a forwarding state. It must go through the listening and learning states first.
Spanning Tree Timers
There are 3 different spanning tree timers, being:
- Hello / 2 seconds
- Forward delay / 15 seconds
- Max age / 20 seconds (10 multiplied by hello timer)
BPDU forwarding
Switches do not forward the BPDUs out of their root ports and non-designated ports, only their designated ports.
Spanning Tree Optional Features (STP Toolkit)
- Portfast
- Portfast allows a port to move immediately into the forwarding state, bypassing listening and learning. This is used for switchports which are connected to end hosts, as they do not pose a risk to causing loops in the network.
- Portfast will only work on access ports.
- BPDU Guard
- BPDU Guard makes it so when an interface with BPDU Guard enabled receives a BPDU from another switch, the interface will be shut down to prevent a loop from forming.
- Root Guard
- If you enable root guard on an interface, even if it receives a superior BPDU (lower bridge ID) on that interface, the switch will not accept the new switch as the root bridge. The interface will be disabled.
- Loop Guard
- If you enable loop guard on an interface, even if the interface stops receiving BPDUs, it will not start forwarding. The interface will be disabled.
Spanning Tree Primary and Secondary Root Bridges
There are two commands to easily change the bridge priority of a switch, they are:
- spanning-tree vlan vlan-id root primary
- The command sets the STP priority to 24576.
- If another switch already has a priority lower than 24576, it sets this switch’s priority to 4096 less than the other switch’s priority.
- spanning-tree vlan vlan-id root secondary
- The command sets the STP priority to 28672.
Spanning Tree Port Settings
There are two commands you need to know for spanning tree port settings, they are:
- spanning-tree vlan vlan-id cost number
- Changes an interface’s root cost, therefore overriding the default STP port costs.
- spanning-tree vlan vlan-id port-priority number
- Changes an interface’s port priority, therefore overriding the default STP port priority of 128.