Pages

CCNP Switch - Advanced Spanning Tree Protocol (RSTP / MSTP)

- Both MSTP and RSTP improve STP operation and maintain backward compatibility with equipment that is based on: 
   - the (original) IEEE 802.1D spanning tree,
   - CSTP with existing Cisco-proprietary Multiple Instance STP (MISTP),
   - CSTP with existing Cisco per-VLAN spanning-tree plus (PVST+),

   - in RSTP,  Type P2P Peer(STP) represents that the neighbor switch runs PVST+,
   - in order to take full advantage of Rapid-PVST+, all the switches in the spanning tree topology must run the rapid-PVST+ .
   - rapid per-VLAN spanning-tree plus (rapid PVST+).
http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_58_se/configuration/guide/2960scg/swmstp.html


  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


- To allow Cisco switches running RPVST+ or PVST+ to form a common spanning tree with others switches running RSTP, MSTP, or STP, vlan1 (the native VLAN) must be configured as untagged on the Cisco ports connected to the others switches.


 - RSTP switch can detect a neighbor failure in three Hello intervals (default 6 seconds), versus the Max Age timer interval (default 20 seconds) for 802.1D

 - RSTP complete STP convergence of the network as a propagation of handshakes over point-to-point links.
 - TC force CAM flush, this forces the addresses to be relearned after the change, in case hosts now appear on a different link.
 - RSTP is reverting to 802.1D negates the benefits of 802.1w for that particular segment is neighbor switch dosnt support RSTP
 - By default, a switch operates in Per-VLAN Spanning Tree Plus (PVST+) mode using traditional 802.1D STP 

 - MSTP config must me manually configured on each switch within MST region
 - MSTP need same config on all SW: name, revision number, VLANs in same instance


??? RSTP Sync ??

Link:
 - Packet Captures
 - Spanning Tree from PVST+ to Rapid-PVST Migration Configuration Example @ cisco.com
 - PVST Simulation on MST Switches
 - CDP, BPDU and Native VLAN

 - http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3560/software/release/12-2_52_se/configuration/guide/3560scg/swmstp.html
 - http://www.h3c.com/portal/Products___Solutions/Technology/LAN/Technology_White_Paper/200812/623014_57_0.htm

Many STP enhancements that are available in new standards to undergo change quickly and efficiently, with little downtime for today’s applications.

 - Rapid STP (RSTP) provides the foundation for efficient STP activity.  RSTP can be coupled with either per-VLAN STP (PVST+) or Multiple STP modes.
 - MST allows VLANs to be individually mapped into arbitrary STP instances while RSTP operates in the background.

RSTP - Rapid Spanning Tree Protocol
A STP topology change typically takes 30 seconds, with a port moving from the Blocking state to the Forwarding state after two intervals of the Forward Delay timer.
As technology has improved, 30 seconds has become an unbearable length of time to wait for a production network to fail over or “heal” itself during a problem.

 - The IEEE 802.1w (RSTP) standard was developed to use 802.1D’s principal concepts and make the resulting convergence much faster.
 - RSTP’s basic functionality can be applied as a single instance (Rapid PVST+(RPVST+)) or multiple instances (IEEE 802.1s Multiple Spanning Tree (MST)).

Classic 802.1D timers, such as forward delay and max_age, are only used as a backup and should not be necessary if point-to-point links and edge ports are properly identified and set by the administrator.
Also, the timers should not be necessary if there is no interaction with legacy bridges. 

RSTP Port Behavior
RSTP achieves its rapid nature by letting each switch interact with its neighbors through each port.
After the role is determined, each port can be given a state that determines what it does with incoming data.
- The root bridge in a network using RSTP is elected just as with 802.1D—by the lowest Bridge ID.

After all switches agree on the identity of the root, the following port roles are determined:
■ Root port—The one switch port on each switch that has the best root path cost to the root. This is identical to 802.1D. (By definition, the root bridge has no root ports.)
■ Designated port—The switch port on a network segment that has the best root path cost to the root.
■ Alternate port—A port that has an alternative path to the root, different from the path the root port takes. This path is less desirable than that of the root port. (An example of this is an access-layer switch with two uplink ports; one becomes the root port, and the other is an alternate port.)
■ Backup port—A port that provides a redundant (but less desirable) connection to a segment where another switch port already connects. If that common segment is lost, the switch might or might not have a path back to the root

RSTP Port Roles

Any port role can have any of these port states:
■ Discarding—Incoming frames simply are dropped; no MAC addresses are learned. (This state combines the 802.1D Disabled, Blocking, and Listening states because all three did not effectively forward anything. The Listening state is not needed because RSTP quickly can negotiate a state change without listening for BPDUs first.)
■ Learning—Incoming frames are dropped, but MAC addresses are learned. (only for Shared links - hubs)
■ Forwarding—Incoming frames are forwarded according to MAC addresses that have been (and are being) learned.
States
Disabled   No MAC learning / No forwarding traffic
Learning   MAC Learning / No forwarding traffic  <-used only when communicating with Switches that use legacy STP (not RSTP)
Forwarding MAC Learning / Forwarding traffic

Roles
Root Port         Port to higher segments (to the Root Bridge)
     Alternate Port    Backup Root Port

Designated Port   Port to lower segments
     Backup Port       Backup Designated Port
Disabled Port     Not participating in RST

BPDUs in RSTP
 - in 802.1D, BPDUs basically are originated ONLY from the root bridge (after STP convergence) and are relayed by all switches down through the tree,
 - RSTP BPDUs are sent out every switch port at Hello Time intervals, regardless of whether BPDUs are received from the root
 - RSTP uses an interactive process so that two neighboring switches can negotiate state changes. Some BPDU bits are used to flag messages during this negotiation.
 - The sending switch port identifies itself by its RSTP role and state,
 - When three BPDUs are missed in a row (6 seconds), that neighbor is presumed to be down, and all information related to the port leading to the neighbor immediately is aged out (BPDUs are now used as a keep-alive mechanism between bridges).

 - RSTP uses the 802.1D BPDU format for backward compatibility,
 - BPDU  BPDU version field also is set to 2 to distinguish RSTP BPDUs from 802.1D BPDUs,
-  RSTP can coexist with switches still using 802.1D. Each port attempts to operate according to the STP BPDU that is received.(802.1D BPDU =version 0)

RSTP Convergence

STP convergence - the process that takes all switches from a state of independence (each thinks it must be the STP root) to one of uniformity, in which each switch has a place in a loop-free tree topology (Only one root, every switch port in the STP domain must be brought from a Blocking state to the appropriate state to prevent loops).

In order to achieve fast convergence on a port, the protocol relies upon two new variables: edge ports and link type.
The link type is automatically derived from the duplex mode of a port.
A port that operates in full-duplex is assumed to be point-to-point, while a half-duplex port is considered as a shared port by default. 

Port Types
 - Edge port—A port at the “edge” of the network, where only a single host connects. Traditionally, this has been identified by enabling the STP PortFast feature. RSTP keeps the PortFast concept for familiarity. By definition, the port cannot form a loop as it connects to one host, so it can be placed immediately in the Forwarding state. However, if a BPDU ever is received on an edge port, the port immediately loses its edge port status (became normal STP port and TCN is generated).
 - Root port—The port that has the best cost to the root of the STP instance. Only one root port can be selected and active at any time, although alternative paths to the root can exist through other ports.
 - Alternative root ports - if alternative paths are detected to root bridge, they are immediately placed in the Forwarding state when the existing root port fails.

 - Point-to-point port—any port that connects to another switch and becomes a designated port. A quick handshake with the neighboring switch, rather than a timer  expiration, decides the port state. BPDUs are exchanged back and forth in the form of a proposal and an agreement. One switch proposes that its port becomes a designated port; if the other switch agrees, it replies with an agreement message.
 - Shared ports - Half-duplex ports are considered to be on a shared medium with possibly more than two switches present. The traditional 802.1D style convergence must be used.

Synchronization
For each nonedge port, the switch exchanges a proposal-agreement handshake to decide the state of each end of the link. 
 - Nonedge ports begin in the Discarding state.
 - After BPDUs are exchanged between the switch and its neighbor, the Root Bridge can be identified.
 - If a port receives a superior BPDU from a neighbor, that port becomes the root port.
 - Notice that the RSTP convergence begins with a switch sending a proposal message.
 - All nonedge ports are blocked until a proposal message can be sent,
 - The entire convergence process happens quickly, at the speed of BPDU transmission, without the use of any timers.

RSTP Proposal and Agreement

Topology Changes and RSTP
 - 802.1D switch detects a port state change (either up or down), it signals the root bridge by sending TCN BPDUs.
 - The root bridge, in turn, must signal the topology change by sending out a TCN message that is relayed to all switches in the STP domain.

 - RSTP detects a topology change only when a nonedge port transitions to the Forwarding state (link failure is not used as a trigger).
 - RSTP generate TCN when port-edge (portfast) receives a BPDU packet (this port will transition from Port-Edge status to normal STP port),
 - When a topology change is detected, a switch must propagate news of the change to other switches in the network so that they can correct their bridging tables, too.
 -  Topology Change (TC) messages (BPDUs, with their TC bit set) propagate through the network in an ever-expanding wave, are sent out all the nonedge designated ports
 -  all MAC addresses associated with the nonedge designated ports are flushed from the CAM table.

RSTP Configuration
By default, a switch operates in Per-VLAN Spanning Tree Plus (PVST+) mode using traditional 802.1D STP.

Configure a port as an RSTP edge port
Switch(config-if)# spanning-tree portfast
To force the port to act as a point-to-point link
Switch(config-if)# spanning-tree link-type point-to-point
You can improve the efficiency of each STP instance by configuring a switch to begin using RSTP instead (mode is known as Rapid PVST+(RPVST+)).
Switch(config)# spanning-tree mode rapid-pvst
Be careful when you use this command on a production network because any STP process that is currently running must be restarted.
To revert back to the default PVST+ mode, using traditional 802.1D STP, you can use the following command:
Switch(config)# spanning-tree mode pvst
Enable RSTP  (not RPVST+) globally
SW-5(config)#spanning-tree mode ?
  mst         Multiple spanning tree mode    <---Enable MSTP and RSTP
  pvst        Per-Vlan spanning tree mode
  rapid-pvst  Per-Vlan rapid spanning tree mode
The switch can detect the neighbor’s STP type by the BPDU version that is received.
Switch# show spanning-tree vlan 171
VLAN0171
   Spanning tree enabled protocol rstp
   Root ID Priority 4267
           Address 00d0.0457.38aa
           Cost 3
...
Interface   Role Sts Cost Prio.Nbr Type
-----------------------------------------------
Gi7/8       Desg FWD 4    128.392 P2p
Gi9/6       Altn BLK 4    128.518 P2p Peer(STP)
Po1         Root FWD 3    128.833 P2p
Po2         Desg FWD 3    128.834 P2p
Po3         Desg FWD 3    128.835 P2p
Switch#
!   Type P2p Peer(STP) represents that the neighbor switch runs PVST.

MSTP - Multiple Spanning Tree Protocol
CIST Common Internal Spanning Tree
 - Topology of all switches in all regions

CST Common Spanning Tree
 - Topology of all \pseudo bridges"

IST (MSTI0) Internal Spanning Tree
 - Spanning Tree within a region
 - Can communicate with other regions
 - Root Bridge election first based on External Path Cost

MSTIn Multiple Spanning Tree Instance n
 - Spanning Tree within a region
 - Cannot communicate with other regions
 - Every region becomes a "pseudo-bridge" (multiple bridges running as a single bridge)
 - Topology of "pseudo-bridges" is called CST
 - CST has no idea of internal MSTP regions

Two “flavors” of spanning-tree implementations—IEEE 802.1Q and PVST+
■ 802.1Q—Only a single instance of STP is used for all VLANs. If there are 500 VLANs, only 1 instance of STP will be running. This is called the Common Spanning Tree (CST) and operates over the trunk’s native VLAN.
■ PVST+—One instance of STP is used for each active VLAN in the network. If there are 500 VLANs, 500 independent instances of STP will be running.

The Multiple Spanning Tree Protocol was developed to address the lack of and surplus of STP instances.
MST is defined in the IEEE 802.1s standard.

MST Overview
 - MST is built on the concept of mapping one or more VLANs to a single STP instance.
 - MST is different from 802.1Q and PVST+, although it can interoperate with them. 
 - MST BPDUs contain configuration attributes so that switches receiving BPDUs can compare them against their local MST configurations.
 -  MST instance-to-VLAN mapping table is not sent in the BPDUs, instead a digest, or a hash code computed from the table contents, is sent.

To implement MST in a network, you need to determine the following:
■ The number of STP instances needed to support the desired topologies
■ Whether to map a set of VLANs to each instance

Within the region, all switches must run the instance of MST that is defined by the following attributes:
■ MST configuration name (32 characters)
■ MST configuration revision number (0 to 65535)
■ MST instance-to-VLAN mapping table (4096 entries)

Spanning-Tree Instances Within MST
MST was designed to interoperate with all other forms of STP.

IST (Internal Spanning Tree) Instances - something other than CST must work out a loop-free topology inside each MST region between the links where CST meets the region boundary and all switches inside the region.
Think of the IST instance as a locally significant CST, bounded by the edges of the region.
BPDUs are exchanged at the region boundary only over the native VLAN of trunks, as if a single CST were in operation.

To do this, CST must regard each MST region as a single “black box” bridge because it has no idea what is inside the region, nor does it care. 
Concepts Behind the IST Instance
MST Instances
Inside a region, the actual MST instances (MSTI) exist alongside the IST.
Cisco supports a maximum of 16 MSTIs in each region. The IST always exists as MSTI number 0, leaving MSTIs 1 through 15 available for use.
Concepts Behind MST Instances
In MST cloud, there are now three independent STP instances coexisting: MSTI1, MSTI 2, and the IST (MSTI 0).
 - Only the IST (MSTI 0) is allowed to send and receive MST BPDUs.
 - Information about each of the other MSTIs is appended to the MST BPDU as an M-record.
 - Therefore, even if a region has all 16 instances active, only 1 BPDU is needed to convey STP information about them all.
 - only IST BPDUs are sent into and out of a region.

Keep in mind that the IST instance is active on everyport on a switch.
If BPDUs are heard from more than one VLAN (the CST), PVST+ must be in use.
When the MST region sends a BPDU toward the PVST+ switch, the IST BPDUs are replicated into all the VLANs on the PVST+ switch trunk.

MST Configuration
MST manually configuration must be done on each switch in a region.
Switch(config)# spanning-tree mode mst           <---Enable MST on the switch
Switch(config)# spanning-tree mst configuration  <---Enter the MST configuration mode
Switch(config-mst)# name <name>                  <---Assign a region configuration name (up to 32 characters)
Switch(config-mst)# revision <version>           <---Assign a region configuration revision number (0 to 65,535)
 revision number  - gives you a means of tracking changes to the MST region configuration.
                    Each time you make changes to the configuration, you should increase the number by one. (it is not automatically incremented)
                    The region configuration (incl. the revision number) must match on all switches in the region.
                    Therefore, you also need to update the revision numbers on the other switches to match.
Switch(config-mst)# instance <instance-id> vlan <vlan-list>    <---Map VLANs to an MST instance
 instance-id(0 to 15) - carries topology information for the VLANs listed in <vlan-list>.
                    The list can contain one or more VLANs separated by commas.
                    You also can add a range of VLANs to the list by separating numbers with a hyphen.
                    VLAN numbers can range from 1 to 4,094. (Remember that, by default, all VLANs are mapped to instance 0, the IST)
Switch(config-mst)# show pending                 <---Show the pending changes you have made
Switch(config-mst)# exit         <---commit the changes by exit the MST configuration mode
After MST is enabled and configured, PVST+ operation stops and the switch changes to RSTP operation.
A switch cannot run both MST and PVST+ at the same time.

Tune the parameters that MST uses when it interacts with CST (traditional 802.1D). Timer configurations are applied to MST as a whole, not to a specific MST instance.
Switch(config)# spanning-tree mst <instance-id> root{primary| secondary} [diameter diameter]   Set root bridge (macro).
Switch(config)# spanning-tree mst <instance-id> priority <bridge-priority>                Set bridge priority.
Switch(config)# spanning-tree mst <instance-id> cost <cost>                               Set port cost
Switch(config)# spanning-tree mst <instance-id> port-priority <port-priority>             Set port priority
Switch(config)# spanning-tree mst hello-time <seconds>                                       Set STP timers
Switch(config)# spanning-tree mst forward-time <seconds>
Switch(config)# spanning-tree mst max-age <seconds>