EN 
30.11.2025 Ondřej WELCOME IN MY WORLD

This website is originally written in the Czech language. Most content is machine (AI) translated into English. The translation may not be exact and may contain errors.

Tento článek si můžete zobrazit v originální české verzi. You can view this article in the original Czech version.
Cisco IOS 10 - Rapid Spanning Tree Protocol

Cisco IOS 10 - Rapid Spanning Tree Protocol

| Petr Bouška - Samuraj |
This article directly follows on from the previous part, where the STP protocol and PVSTP configuration were described in general. In this work, there is a much more concise description, mainly focused on configuration, of the two newer versions of STP, that is, RSTP and MSTP. It also describes my practical experience of switching to RSTP. And there is a small mention of Flex Link.
displayed: 53 177x (51 917 CZ, 1 260 EN) | Comments [6]

Rapid Spanning Tree Protocol (RSTP)

The maximum time for STP convergence is 50s (in practice we can achieve lower values, around 30s), which is too high for practical situations. Therefore, a modified algorithm called Rapid Spanning Tree Protocol (RSTP) was devised, which has a convergence time in practice around 1 or 2s. RSTP was originally defined as an extension by IEEE 802.1w standard, but in 2004 it was incorporated into the IEEE 802.1d standard.

The basic principle is similar to classic STP, but it is modified for faster convergence when topology changes. It has integrated equivalents of Cisco functions PortFast, UplinkFast and BackboneFast.

Note: RSTP is backwards compatible with classic STP. But if it detects any BPDU frame from STP, it switches to this mode.

Changes compared to STP

  • minor change in BPDU format (version 2 is used)
  • all switches generate BPDUs and send them to all ports every hello time (instead of forwarding Root BPDU)
  • Agreement / Proposal BPDUs are sent
  • link types are defined (point-to-point, edge, shared), so some can quickly transition to forwarding state
  • port roles/types have changed, there are four (root, designated, alternate, backup)
  • port states (discarding, learning, forwarding)

Port/Link Types

  • point-to-point, i.e. point-to-point connection, connection to another switch, the link must be full duplex
  • edge, end/border port (PortFast), an end device is connected to it (like a PC or printer)
  • shared, shared link, for example a hub, the link is half duplex

Edge ports are defined using the PortFast function. Point-to-point and shared are configured using link-type. The default state for full duplex links is P2P. For P2P, we must ensure that the link is in full duplex mode.

Port Roles

  • Root Port - best BPDU on the switch
  • Designated Port - best BPDU on the segment
  • Alternate Port - blocked, alternative path to root (root backup)
  • Backup Port - blocked, redundant path to segment (designated backup)

BPDU

size [B] item
2 protocol ID
2 protocol version
2 BPDU type
1 flags
8 root BID
4 path cost to root
8 sender's BID
2 ID of port sending BPDU
2 Message Age
2 Maximum Age
2 Hello Time
2 Forward Delay
1 Version 1 length

Note: A switch running classic STP discards BPDU from RSTP.

All switches send BPDU every hello time, in STP BPDUs received on the Root Port are forwarded/modified. Message Age serves as a hop counter, after depletion the frame is discarded.

Agreement / proposal

Offer and agreement. Switches send an offer to a neighbor, if the neighbor has a larger BID, it responds with agreement and both reconfigure the state (root and designated).

RSTP Configuration on Cisco IOS

Cisco switches run a modified version of the RSTP protocol called Rapid PVSTP+ (abbreviated as RPVSTP or PVRSTP or rapid-PVSTP), where a separate STP instance runs for each VLAN.

The common, and perhaps only possible, configuration procedure is to first configure PVSTP+ (which runs by default) and then switch to RPVSTP+ mode. The transition can be gradual (we probably can't configure all switches at once), because RSTP is backwards compatible with STP. It's important to remember that during the transition, there will be connection outages.

In rapid-PVST, the functions UplinkFast and BackboneFast don't exist. If we switch to RSTP, these functions won't be used, yet it's recommended to turn them off.

SWITCH(config)#no spanning-tree uplinkfast
SWITCH(config)#no spanning-tree backbonefast

To switch from PVST mode to rapid PVST, a single command is sufficient.

SWITCH(config)#spanning-tree mode rapid-pvst

Determining the link type is done on individual ports

SWITCH(config-if)#spanning-tree portfast                 // edge port mode
SWITCH(config-if)#spanning-tree portfast trunk           // if the port is trunk and we want to set it as edge
SWITCH(config-if)#spanning-tree link-type point-to-point // P2P port mode
SWITCH(config-if)#spanning-tree link-type shared         // shared mode

After we set all switches to RPVST, they will still work in PVST mode because the migration process will detect that the neighbor is in PVST mode and won't switch for compatibility reasons. The switch doesn't realize it can already switch to RPVST, we must trigger renegotiation of the protocol. The following command restarts the migration process.

SWITCH#clear spanning-tree detected-protocols

Notes from Practical Deployment of RSTP

I'll mention a few practical notes when I was transitioning from PVSTP+ to Rapid PVSTP+ on about 13 Cisco switches. In this network, there are no intentional loops and STP is used simply in case a loop accidentally occurs.

I was most interested in how the whole transition would actually take place (when it would happen) and what the outages would be like. I couldn't find exact answers anywhere on the net (not even in the Cisco article describing this migration). All information emphasizes that there will be outages during the transition. It's also emphasized that if a switch in RSTP detects a BPDU from STP, it switches to STP (I think the Cisco version) and can't switch back to RSTP. To switch back, we must use the command mentioned above. So it wasn't clear to me, when I gradually switch switches to RSTP, how to trigger new negotiation on all at once. Well, in practice it looked as follows.

At the beginning, I had all end ports on all switches configured using PortFast. I started reconfiguring switches on access switches (not from the core, as recommended for MST). Most ports didn't even have any outage and remained constantly in forwarding state. Edge ports were configured, most others (where there are other Cisco switches) automatically set to P2P. If I looked using show spanning-tree, they were marked as P2P Peer(STP), meaning the neighboring switch is in STP mode. Only a few ports went through states from blocking, but very quickly. On these ports, there was usually some small switch (and occasionally the port set to Shared).

After I configured all access switches, I moved to the core switch. The switch happened similarly to other switches. But subsequently, all P2P ports were marked only as P2P, so they should work in RSTP mode. I also tried to monitor some communication using debug spanning-tree bpdu and show logging and here I saw that RSTP BPDUs are being sent, so everything probably automatically switched to RSTP mode.

If anyone knows how to tell if a switch is really working in RSTP (and not in RSTP switched to STP), or other details, I'd welcome the info.

Multiple Spanning Tree Protocol (MSTP)

MSTP was created as an extension of RSTP and was defined in IEEE 802.1s, but in 2003 it was merged into the IEEE 802.1q standard, which describes VLANs (MSTP is directly related to VLANs). It uses RSTP as a base, but additionally allows grouping VLANs into spanning-tree instances (so a separate STP instance runs for each group). This allows using multiple paths and performing simple load balancing (load distribution, but static). By default, MSTP allows creating up to 65 different logical topologies (instances).

Cisco PVSTP always has one STP instance for one VLAN, so the more VLANs, the more STP instances and the higher the switch load. Classic STP (or RSTP), on the other hand, has only one STP instance for all VLANs, which means less HW intensity, but there is only one virtual topology and we can't distribute the load for different VLANs by different paths.

An important term in MSTP is MST region. It's formed by a group of switches that have the same configuration (same mapping of instances to VLANs). Individual regions or switches without MSTP are interconnected by classic STP. So, for a switch to become part of a region (and thus participate in MSTP), it must have the same configuration as others (meaning the same region name, revision number, and mapping of VLANs to instances).

MST instance represents mapping of VLANs into groups (as mentioned earlier). In one region, we can create a number of instances (numbers 0 to 4094, but maximum 65 instances) with groups of VLANs. By default, all VLANs are included in instance 0 (MST00).

When transitioning to MSTP or changing the assignment of VLANs to MST instance, reinitialization occurs and thus a brief connection outage. The conversion from PVST to MST should be performed from the core (central element) and proceed downwards.

MSTP Configuration on Cisco IOS

One command is enough to switch to MST. By default, all VLANs are in one instance (number 0). It's better to first configure the instances and then switch the switch.

SWITCH(config)#spanning-tree mode mst

Configuration of region and instances is done in MST configuration mode.

SWITCH(config)#spanning-tree mst configuration     // switching to mode
SWITCH(config-mst)#show                            // information about regions
SWITCH(config-mst)#name region1                    // naming configuration/region
SWITCH(config-mst)#revision 10                     // configuration revision number
SWITCH(config-mst)#instance 1 vlan 100, 150        // creating instance and assigning VLANs, use dash and comma

Another series of (tuning) parameters is set for the entire switch or port.

SWITCH(config)#spanning-tree mst 0 root primary          // sets switch as root for given instance
SWITCH(config)#spanning-tree mst 0 priority 32768        // sets switch priority for given instance
SWITCH(config)#spanning-tree mst hello-time 1            // sets hello time
SWITCH(config-if)#spanning-tree mst 0 port-priority 64   // sets port priority

Displaying information about MST.

SWITCH#show spanning-tree mst

Flex Link

I'll just briefly mention an interesting function Flex Link, which is not related to STP. It's just a simple function where I have two links and one is defined as backup. Communication normally goes only through the primary link, but when it fails, it switches to the backup link. The advantage is that the switching time is up to 50ms.

It's configured on the primary interface (it can be a port or EtherChannel) and we determine its backup.

SWITCH(config-if)#switchport backup interface f0/2

To display information about Flex Link, we can use.

SWITCH#show interface switchport backup

Interesting Links

Author:

Related articles:

Cisco IOS

A large series about the operating system of Cisco's active elements. It contains some of the most read articles on this site. The articles describe the configuration of switches and routers, primarily with Cisco IOS. Things about ports, VLANs, STP, ACLs, QoS, etc.

If you want write something about this article use comments.

Comments
  1. [1] Thead

    Flex link je zaujimava featurina ale jedno mi vrta hlavou ked mame dve linky a chceme aby sa navzajom backupovali tak ich nedame radsej spolu ako EtherChannel ? a tak budu oboje vyuzite naraz

    Sunday, 23.03.2008 12:30 | answer
  2. [2] Samuraj

    respond to [1]Thead: Já to nikdy nepoužil, ale myslím, že hlavní rozdíl je v tomto:

    Etherchannel spojuje několik linek mezi jedním a druhým switchem. Kdežto Flexlink může mít jednu linku (třeba i etherchannel) směřující na jeden switch a tu záložní linku na druhý switch. Je to "náhrada" STP.

    Tuesday, 25.03.2008 16:18 | answer
  3. [3] shortty

    Myslím že příkaz "SWITCH(config)# clear spanning-tree detected-protocols" se nedává v glob.konf režimu ale v enable... např. SWITCH# clear spanning-tree detected-protocols

    ;-)

    Wednesday, 02.07.2008 10:31 | answer
  4. [4] anon

    respond to [3]shortty: yep ;-) ... nebo v novějších IOS pomocí "do":

    SWITCH(config)#do clear spanning-tree detected-protocols

    Monday, 11.05.2009 11:14 | answer
  5. [5] miso

    Chcel by som sa opýtať,ako prepne RSTP spätne pri obovení spojenia lepšej prenosovej cesty ( menšia cena cesty, nižší identifikátor- číslo portov), ako zisti že došlo k zmene a že má na dosah lepšiu cest??? vysiela BPDU aj na padnuté porty, ktoré boli pred tým root portami???

    ďakujem

    Tuesday, 13.03.2012 14:00 | answer
  6. [6] Ivo

    Zdravím, chtěl bych se zeptat zda má někdo zkušenost se změnou z MSTP na RSTP. Aktuálně máme v síti i jiné switche než Cisco, které chceme nahradit za Cisco. Chceme přejít na RSTP, ale neví zda začít od Root nebo od access...? Moc dík za názor

    Tuesday, 15.12.2020 20:24 | answer
Add comment

Insert tag: strong em link

Help:
  • maximum length of comment is 2000 characters
  • HTML tags are not allowed (they will be removed), you can use only the special tags listed above the input field
  • new line (ENTER) ends paragraph and start new one
  • when you respond to a comment, put the original comment number in squar brackets at the beginning of the paragraph (line)