Spanning tree is used to avoid network loop in layer 2 switch
Common Spanning tree characteristics :
- Long forwarding time (50 seconds)
- Blocking (20 seconds -> max-age)
- Listening (15 seconds -> forward delay)
- Learning (15 seconds -> forward delay) -> building mac table
- Forwarding -> up/up
- Disabled
Spanning tree timers :
- Blocking - Listening 20 seconds
- Listening - Learning 15 seconds
- Learning - Forwarding 15 seconds
For faster forwarding state when you connect to workstation/pc, you can use spanning tree portfast.
Spanning tree portfast characteristics :
- Connecting only to workstation, not switch or there will be a loop network
- Decreasing forwarding time to zero
- No TCN (topology change notification)
If you connect switch to a portfast port, there is opportunity for network loop. Although it will no happen because of the stp algorithm. But in the first time, the network will be overwhelmed by the broadcast storm.
Common spanning-tree result :
W1#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 24577
Address 0019.f5d5.4256
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address 0019.f5d5.4256
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- ---------------------------
Fa0/1 Desg FWD 19 128.3 P2p
Global Config (per port access)
interface fa0/0
shutdown
interfacen fa0/0
spanning-tree portfast
int fa0/0
no shutdown
SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 24577
Address 0019.f5d5.4256
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address 0019.f5d5.4256
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- ---------------------------
Fa0/1 Desg FWD 19 128.3 P2p Edge
There is identifier of edge in spanning-tree type. The port switches to forwarding directly without dealing listening, learning state.
Configuring Spanning Tree for all access ports (GLOBAL)
Global Config
spanning-tree portfast default
SW1#show spanning-tree summary
Switch is in rapid-pvst mode
Root bridge for: VLAN0001
Extended system ID is enabled
Portfast Default is enabled
PortFast BPDU Guard Default is disabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is enabled
UplinkFast is disabled
BackboneFast is disabled
Configured Pathcost method used is short
Name Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0001 0 0 0 1 1
---------------------- -------- --------- -------- ---------- ----------
1 vlan 0 0 0 1 1
Spanning-tree Portfast & Spanning-tree Portfast Trunk Difference
Access port,
spanning-tree portfast and spanning-tree
portfast trunk make the port as PortFast-enabled (edge
port). That port will be Forwarding state after coming up.
Trunk Port
spanning-tree portfast has no effect on trunk ports. For Trunk port if you want immediately to make the trunk in forwarding state,use
spanning-tree porfast trunk command. But this command must not be used when connecting to switch. Because it will no detect looping in your network. This command only suitable when connecting to Layer 3 devices for examples routers (with encapsulation vlans).
Spanning-tree Rapid (802.1w) RW
The forward delay is not used (synchronization process)
Faster,Max age timer is used (6 seconds -> three missed
BPDUs in a row)
RSTP bridge port roles:
- Root port – The closest port to the root bridge (forwarding) cost
- Designated port – A forwarding port
- Alternate port – The best alternate path to the root
bridge. .
- Backup port – Two Ports/more connected to a hub. The port will be in fwd in case one of them in trouble
- Disabled port
Spanning-tree States :
- Discarding
- Learning
- Forwarding
Spanning-tree Compatibility
RSTP - STP (backward to STP in that port boundary)
PVRSTP - RSTP (compatible using vlan 1 instance with switch in rstp mode, other instances will be tunneled without connecting to switch running rstp mode)
MSTP - RSTP, RPVST+,PVST+ ->compatible with instance 0 in mst -> common spanning tree (CST).
RSTP,RPVST+, PVST+ see MST region as a single switch.
MSTP - MSTP pre standard (MISTP) -> must set spanning-tree mst pre-standard in mst switch
Table 17-2 PVST+, MSTP, and Rapid-PVST+ Interoperability
|
PVST+
|
MSTP
|
Rapid PVST+
|
PVST+
|
Yes
|
Yes (with restrictions)
|
Yes (reverts to PVST+)
|
MSTP
|
Yes (with restrictions)
|
Yes
|
Yes (reverts to PVST+)
|
Rapid PVST+
|
Yes (reverts to PVST+)
|
Yes (reverts to PVST+)
|
Yes
|
MSTP instance 0 is the IST/CST region inside MST.
MSTP instance 0 as the CST region outside of MST.
The MST to PVST+ interaction replicates the BPDU from IST for each vlan. Simulating PVST+ neighbour.