Advanced STP: RSTP and MSTP

Rapid Spanning Tree Protocol

  • IEEE 802.1w defines RSTP. Works based on 802.1d principal concept.
  • BPDU version field set to 2.
  • Root bridge is elected as in 802.1d
  • Port Roles:
    • Root port: A switch port which has best root path cost to reach the root.
    • Designated port: A switch port in a network segment which has best root path cost.
    • Alternate Port: An alternate port to reach the root. Receives useful BPDU from another bridge. In blocking state. If the root port goes down, the alternate port is immediately moved to root port. Root port and alternate port are tied to an uplink group.
    • Backup port: A port in the same switch which has redundancy to the same segment. Backup port is not part of uplink group.
  • Port states:
    • Discarding: Port does not accept/forward frames. No mac-address learning. Combines disabled, blocking and listening states of 802.1d.
    • Learning: Mac-address learning occurs. Port does not accept/forward frames
    • Forwarding: Port can accept/forward frames and can learn MAC address.
  • BPDU format:
    • Same format as 802.1d BPDU. But uses all flag byte.
    • BPDU Type and version are set to 2, indicating RSTP PBDU
    • Flag byte:
      • 0 – Topology change (TC)
      • 1- Proposal
      • 2, 3 – Port Role of the port from where packet was originated.
        • { 00- unknown, 01 – Alternate/Backup, 10 – Root, 11- Designated}
      • 4,5 – Port states of the port from where packet was originated
        • { Bit 4 set – Learning, Bit 5 – Forwarding}
      • 6- Agreement
      • 7 – Topology change ACK.
  • Changes compared to 802.1d:
    • BPDU from all bridges;
      • In 802.1d, only root port generates BPDU and all bridges forward the BPDU.
      • In RSTP, all bridges send RSTP BPDU every hello interval (Default: 2 sec) even if it doesn’t receive any BPDU from root.
    • Faster Aging time:
      • If 3 hello packets are missed from a neighbor, the switch assumes the other end is dead. And deletes all information learns on that port.
    • Accepts inferior BPDU:
      • When a port receives inferior BPDU (high priority ID, cost etc) than the one stored for that interface, it is processed immediately (not wait for max_time to expire) and it sends its own BPDU (which is now superior)
    • Convergence doesn’t depend on any timers:
      • Depends on BPDU handshake mechanism.
  • Interop with 802.1d:
    • When a port comes UP, ‘migrate delay timer’ ( 3 seconds) is started and the current STP or RSTP state is locked till the timer expires. Once expires, the port adapts to the next BPDU type it receives.
    • If 802.1d switch is added to a network segment which has RSTP running switch, the RSTP enabled port starts sending 802.1d BPDU (‘migrate delay timer’ expires) and both switches works in 802.1d mode. No quick convergence possible as in RSTP.
    • User intervention is required to move a port from 802.1d mode to RSTP mode. “Clear spanning-tree detected-protocols”
    • Configured timers (forward-delay, max_age) are used only when interop with 802.1d.
  • Port Types:
    • Edge port: Similar to ‘Portfast’ feature in PVST+. Port immediately placed to forwarding state. If any BPDU is received, the port losses its edge port status.
    • Point-point Link: Switch automatically detects all full duplex links as point-point (assuming other end has only one switch). RSTP quickly decides the port state by BPDU exchange. Need not to wait for any timers to expire.
    • RSTP fast convergence can occur only on edge port and ptp link. For half-duplex links, traditional 802.1d convergence takes place.
  • RSTP convergence:
    • Doesn’t depend on any timer expiration. BPDUs are exchanged between two neighboring devices and decide its port states. This process continues from root to the edge of network.
    • When a switch boots up, all nonedge ports are placed in discarding state. Switch (A) assumes it as designated bridge for all connected network segment and sends a ‘proposal’ message (configuration BPDU with bit-1 set).
    • Neighbor device ( say switch B) on receiving the proposal, decides which switch has to be designated for that segment. If the received proposal is superior BPDU, it has to place the received port as ‘root’ port and other end switch port (in switch A) has to be ‘designated port’.
    • But before deciding, synchronization process has to take place;
      • During syn state, all nonedge forwarding ports are moved to discarding state.
      • A port is in syn if;
        • The port is already in blocking state or
        • The port is edge port
    • An agreement BPDU is sent back to switch-A with local port states and role by switch-B.
    • Switch-A on receiving this agreement, moves its port to forwarding immediately.
      • Switch-A need not to wait for any timer to expire. BPDU exchange is enough.
    • Switch-B sends proposal message to its non-edge ports in discarding state.
      • This process repeats till the leaf of the network.
    • If there is no reply for proposal message, the port has to follow 802.1d rules (moves through listening , learning and then forwarding state)
    • Port role in proposal message is always set to  “designated port”
    • Port role in agreement message is always set to  “root port”
    • RSTP has no separate TCN BPDU as in 802.1d. Uses TCA flag.
  • Topology change:
    • In RSTP, Only when a non-edge port moves to forwarding state, TC is detected.
    • When TC occurs, ‘TC while’ timer (set to twice the hello-time = 4 secs) is started and BPDU with TC bit set is sent to all non-edge designated ports (including root port) till the ‘TC while’ timer expires.
    • It deletes all the MAC-address learned on all non-edge designated ports as (under the assumption)  the same mac-address might be learn on new forwarding-moved port.
    • Neighbor device, on receiving BPDU with TC bit set, clears mac-address learned on all non-edge designated ports except the one on which TC set BPDU was received. Also, step 2 is repeated starting ‘TC while’ timer for all its non-edge designated ports.
    • This ‘wave’ process repeats throughout the network and TC was notified to all bridges. No timers are involved and quick convergence takes place.
    • When RVPST+ is configured, the switch supports both RSTP and 802.1d neighbors. 802.1d neighbors can be seen in the output where the interface type is shown as ‘p2p peer(STP)’.
    • PortFast, uplink fast, backbone fast features are inbuilt in RSTP.
  • Few points:
    • If a superior BPDU is received on a port, it sends agreement message after ‘sync’ process
    • If the superior BPDU is 802.1d, the port becomes new root port after 2xforward_delay.
    • If a superior BPDU makes a port to discard state, the switch blocks the port and does not send any agreement message. Other end port moves to forwarding after 2xf_d.
    • If an inferior BPDU is received, the switch immediately sends its own BPDU.
  • RSTP configuration:
    • spanning-tree mode rapid-pvst” to enable RSTP.
    • spanning-tree link-type point-to-point”. Interface configuration command to hard set an interface as p2p.
    • spanning-tree portfast”. Interface configuration command to enable edgeport in RSTP.

Multiple spanning tree protocol:

  • IEEE 802.1s defines MSTP. Multiple VLANs are mapped to MST instance. R-PVST+ runs on each MST instances.
  • A region is defined where all switches within that region runs same MST instance(like AS in BGP)
  • Within a region, all switches should have;
    • Same MST configuration name (alphanumeric)
    • Same configuration revision number.
    • Same VLANs to MST instances.
  • Configuration names and revision number are included in MSTP BPDU.  A digest is generated from VLANs-MST mapping table and included in the MSTP BPDU.
  • Neighbor switch on receiving MSTP BPDU, compares the name, revision number and digest with its own copy and only if all three attributes are matched, STP information are shared.
  • If not, the switch assumes the received port as “boundary port” where the other end might be different region or 802.1D network.
  • Within a MST region, internal spanning tree (IST) runs analogous to CST. IST represents the whole MST region as a virtual switch when interacting with CST switch.
  • By default, all VLANs are automatically mapped to IST which is MST instance-0.
  • Independent of number of MST instances, each switch sends single MSTP BPDU by IST instance which has information about IST (MSTI-0) and other MST instances (M-record).
  • Though a port is designated for some MST instance and blocked for other MST instance, the port sends BPDU with has all MST instances (IST + all MSTIs)
  • When interacting with CST, the MSTP BPDU (for IST instance alone) is sent on the trunk connecting CST region via native VLAN.
  • When interacting with PVST+, the MSTP BPDU (for IST instance alone) is replicated for each VLAN and sent on the trunk connecting PVST+ region. (Caution: when pruning VLANs on trunk)
  • Common and Internal Spanning tree (CIST)
    • Collection of ISTs runs on each MST region and CST which interconnects MST region.
    • CIST inside a MST region is same as CST outside the region.
    • Root of IST in an MST region becomes ‘CIST regional root’ (IST master)
      • It is the switch which has lowest path cost to CIST root.
      • CIST regional root = CIST root, if there is only one region.
    • ‘CIST external root cost’ is the cost to CIST root.
    • ‘CIST internal root cost’ is the cost to CIST regional root.
  • Hop-count:
    • MSTP uses hop-count similar to IP TTL mechanism. Max_age parameter is not used.
    • The root switch of an instance sends MSTP BPDU with root-cost=0 and hop count set to 20(default). Each switch on receiving the BPDU decrements the hop counts by 1.
    • When the count becomes zero, the switch discards the BPDU and expire the information on the received port.
  • Boundary Ports:
    • Which receives external message (from other region or 802.1d switch)
    • This port is detected when it receives legacy BPDU or MSTP BPDU (version 3) from other region or RSTP BPDU (version 2).
    • Should be a designated port for packet exchange between MST region and other regions/RSTP/legacy switch. So, select the switch as CST master.
  • Port  Cost:
    • When the switch is in MST mode, long path-cost calculation (32 bits) is used:
      • 100 Gbps – 200
      • 10 Gbps – 2000
      • 1 Gbps – 20000
      • 100 Mbps – 200000
  • Few points:
    • If two MSTP switches are in different region, only CIST runs on that interface.
    • C3560 supports up to 65 MST instances. The number of vlans that can map to an instance is unlimited. But a vlan can map to only one instance.
    • VTP propagation of MST instances (in VTPv3) is not supported on C3560.

MST configuration: (based on Cat3560)

  • Spanning-tree mode mst
  • Spanning-tree mst configuration
    • Instance <id> vlan <range>
    • Name <>
    • Revision <>
    • Show pending
  • Spanning-tree mst <id> root {primary | secondary } diameter <> hello-time <>
  • Spanning-tree mst <id> priority <>
  • Spanning-tree mst <id> { hello-time | forward-time | max_age | max-hops }
  • Spanning-tree mst pre-standard
  • Inside interface configuration mode;
    • Spanning-tree mst <id> port-priority <>
    • Spanning-tree mst <id> cost <>
  • Show commands:
    • Show Spanning-tree mst configuration
    • Show Spanning-tree mst configuration digest
    • Show Spanning-tree mst <id>
    • Show Spanning-tree mst interface <id>


This entry was posted in IOS, L2 switch and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s