#

Sunday, December 17, 2017

Sync Operation of RSTP

Rapid Spanning Tree protocol, commonly known as RSTP (802.1w) does not rely on timers to converge like in Classic STP (802.1d). Convergence mechanism of RSTP is very simple. It is called the Sync Operation / Process.

Goal of a switch is to elect and synchronize its Root Port with the rest of the topology..

The logic behind electing the Root Port is very simple and straight forward just like in Classic STP.
It is the logic of identifying the superior BPDU (Bridge Protocol Data Unit - L2 data frames which contains STP information).

Following is the format of a BPDU..

















RSTP uses Type 2 BPDU while Classic STP uses Type 0 BPDU. You can see in the picture above that 802.1d (Classic STP) uses only 2 bits in the flags field while 802.1w (RSTP) uses all the bits in the flags field.

Switches compare the BPDUs received on their ports and determine which one is better. They are compared in the following order, lower the value is better..

1. Root Bridge ID
2. Root Path Cost
3. Sender Bridge ID
4. Sender Port ID
5. Receiver Port ID (not included in the BPDU, evaluated locally)

Also each port in STP stores the superior BPDU that it has either sent or received. Only the Designated Ports send superior BPDUs while Root Ports & Alternate Ports only receive BPDUs.

Note:- There are 2 types of BPDUs called Configuration BPDUs and TCN BPDUs used in Classic STP for initial convergence and to deal with topology changes. But RSTP only use one type of BPDU. Also in STP, configuration BPDUs are originated only in Root switch and all other switches just relay them on their designated ports downstream accoring to the timers configured in Root switch. In RSTP, all switches generate their own BPDUs and send them on their designated ports downstream according to the local timers set on them.

Sync mechanism is simple. It uses few BPDUs to negotiate the port roles. There are 2 BPDUs are involved in the process. They are;

1. Proposals
2. Agreements

Proposals are the BPDUs sent with the Proposal bit set which signifies the willingness of a port to become Designated-Forwarding & the Agreements are the BPDUs sent with the Agreement bit set which signifies permission to do so..

Let's analyze a network segment with 2 switches..
Steps of the Sync are like the following..











As soon as a new point-to-point Non Edge (ports which are connected to other switches) link is up ports of both ends will become Designated-Discarding which is the default port type and role of a Non Edge port..

Both Designated-Discarding and Designated-Learning ports send Proposals.
















Superior BPDU will be from the SW-A obviously and once it hits SW-B, SW-B will change the port role of e0/2 to be the Root-Discarding immediately & put its all Non-Edge Designated ports to be Designated-Discarding..
















Now SW-B sends an Agreement to SW-A saying now it's safe to move from Designated-Discarding to Designated-Forwarding.. After receiving the Agreement from SW-B, SW-A changes the role of it's e0/1port to Designated-Forwarding..









Still the other Non-Edge Designated ports on SW-2 are in Designated-Discarding state. Which means they send Proposals too. Same above Sync operation will happen on their downstream segments until all the network gets converged..

As you know Classic STP takes 50 seconds to converge a link by default timers.
If you want to see how much time will it take for RSTP, watch the following video.


Instantly becomes green ryt?

Let's power on a switched network..

For the lab I am using actual Catalyst 3750 as the SW-1 and Catalyst 2960s as other switches..
So the ports will be Gi1/0/1 and Gig1/0/2 in SW-1 and others will be Fastethernet but the numbers represent the same as in the diagram.. For the sake of getting more understandable debug outputs, I am connecting one link by one link.

I am connecting the SW-1 to SW-2 segment 1st..

Here are the related outputs debug spanning-tree events command of SW-1 & SW-2..
(click on the images to see in full size)






Next I am connecting SW-1 & SW-4 segment.
Here are the related outputs debug spanning-tree events command..


Finally I am connecting both the links of SW-3 at once..
Here are the related outputs debug spanning-tree events command..








As you can see Fa0/1 (e0/1) of SW-3 has become the Alternate Port..

1 comment:

  1. Greetings from Ohio! I'm bored to tears at work so I
    decided to check out your site on my iphone during lunch break.
    I love the info you present here and can't wait to take a look when I get home.
    I'm amazed at how quick your blog loaded on my phone .. I'm not even using WIFI, just 3G ..
    Anyhow, wonderful site!

    ReplyDelete