Thursday, July 1, 2010

RSTP

The 802.1D Spanning Tree Protocol (STP) standard was designed at a time when the recovery of connectivity after an outage within a minute or so was considered adequate performance. It is not the case anymore.

Original 802.1D was enhanced with features such as Uplink Fast, Backbone Fast, and Port Fast to speed up the convergence time of a bridged network. The drawback is that these mechanisms are proprietary and need additional configuration.

Rapid Spanning Tree Protocol (RSTP; IEEE 802.1w) can be seen as an evolution of the 802.1D standard more than a revolution. The 802.1D terminology remains primarily the same. Most parameters have been left unchanged so users familiar with 802.1D can rapidly configure the new protocol comfortably. 802.1w can also revert back to 802.1D in order to interoperate with legacy bridges on a per-port basis. This drops the benefits it introduces.

The new edition of the 802.1D standard, IEEE 802.1D-2004, incorporates IEEE 802.1t-2001 and IEEE 802.1w standards.

Port States and Port Rolest
802.1D is defined in these four different port states: listening, learning,blocking,forwarding.

The state of the port is mixed, whether it blocks or forwards traffic, and the role it plays in the active topology (root port, designated port, and so on). RSTP decouples the role and the state of a port.
There are only three port states left in RSTP that correspond to the three possible operational states: discarding, Leanring, Forwarding. The 802.1D disabled, blocking, and listening states are merged into a unique 802.1w discarding state.

Port Roles
The role is now a variable assigned to a given port. The root port and designated port roles remain, while the blocking port role is split into the backup and alternate port roles. The Spanning Tree Algorithm (STA) determines the role of a port based on Bridge Protocol Data Units (BPDUs).

Root Port Roles
The port that receives the best BPDU on a bridge is the root port. This is the port that is the closest to the root bridge in terms of path cost. The STA elects a single root bridge in the whole bridged network (per-VLAN). The root bridge is the only bridge in the network that does not have a root port.

Designated Port Role
A port is designated if it can send the best BPDU on the segment to which it is connected. On a given segment, there can only be one path toward the root bridge. All bridges connected to a given segment listen to the BPDUs of each and agree on the bridge that sends the best BPDU as the designated bridge for the segment. The port on that bridge that corresponds is the designated port for that segment.


Alternate and Backup Port Roles
These two port roles correspond to the blocking state of 802.1D. A blocked port is defined as not being the designated or root port. A port absolutely needs to receive BPDUs in order to stay blocked.
An alternate port receives more useful BPDUs from another bridge and is a port blocked.
A backup port receives more useful BPDUs from the same bridge it is on and is a port blocked.

New BPDU
Only two flags, Topology Change (TC) and TC Acknowledgment (TCA), are defined in 802.1D. RSTP now uses all six bits of the flag byte.

01234567
0 - Topology change
1 - Proposal
2 3 - port role: 00 Unknown, 01 Alternate/Backup, 10 Root, 11 Designated
4 - Learning
5 - Forwarding
6 - Agreement
7 - Topology change Ack

RSTP BPDU is type 2, version 2. The implication is that legacy bridges must drop this new BPDU.

BPDU are Sent Every Hello-Time
BPDU are sent every hello-time. With 802.1D, a non-root bridge only generates BPDUs when it receives one on the root port. In 802.1w, A bridge now sends a BPDU with its current information every seconds (2 by default), even if it does not receive any from the root bridge.

Faster Aging of Information
On a given port, if hellos are not received three consecutive times, protocol information can be immediately aged out (or if max_age expires). BPDUs are now used as a keep-alive mechanism between bridges. A bridge considers that it loses connectivity to its direct neighbor root or designated bridge if it misses three BPDUs in a row. This fast aging of the information allows quick failure detection.

Note: Failures are detected even much faster in case of physical link failures.

Accepts Inferior BPDUs
This concept is what makes up the core of the BackboneFast engine. When a bridge receives inferior information from its designated or root bridge, it immediately accepts it and replaces the one previously stored.

Rapid Transition to Forwarding State
The legacy STA passively waited for the network to converge before it turned a port into the forwarding state. The new rapid STP is able to actively confirm that a port can safely transition to the forwarding state without having to rely on any timer configuration. There is now a real feedback mechanism that takes place between RSTP-compliant bridges. In order to achieve fast convergence on a port, the protocol relies upon two new variables: edge ports and link type.

Edge Ports
All ports directly connected to end stations cannot create bridging loops in the network. Therefore, the edge port directly transitions to the forwarding state, and skips the listening and learning stages. Neither edge ports or PortFast enabled ports generate topology changes when the link toggles. An edge port that receives a BPDU immediately loses edge port status and becomes a normal spanning tree port.

Link Type
RSTP can only achieve rapid transition to the forwarding state on edge ports and on point-to-point links. 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. This automatic link type setting can be overridden by explicit configuration.

Convergence with 802.1w
A link between the root bridge and Bridge A is added. Suppose there already is an indirect connection between Bridge A and the root bridge (via C - D in the diagram).



Both ports on the link between A and the root are put in designated blocking as soon as they come up. At this stage, a negotiation takes place between Switch A and the root. As soon as A receives the BPDU of the root, it blocks the non-edge designated ports. This operation is called sync. Once this is done, Bridge A explicitly authorizes the root bridge to put its port in the forwarding state.

The link between Switch A and the root bridge is blocked, and both bridges exchange BPDUs.

Once Switch A blocks its non-edge designated ports, the link between Switch A and the root is put in the forwarding state and you reach the situation:



There still cannot be a loop. Instead of blocking above Switch A, the network now blocks below Switch A. However, the potential bridging loop is cut at a different location. This cut travels down the tree along with the new BPDUs originated by the root through Switch A. At this stage, the newly blocked ports on Switch A also negotiate a quick transition to the forwarding state with their neighbor ports on Switch B and Switch C that both initiate a sync operation. Other than the root port towards A, Switch B only has edge designated ports. Therefore, it has no port to block in order to authorize Switch A to go to the forwarding state. Similarly, Switch C only has to block its designated port to D. The state shown in this diagram is now reached:


The final network topology is reached, just in the time necessary for the new BPDUs to travel down the tree. No timer is involved in this quick convergence. The only new mechanism introduced by RSTP is the acknowledgment that a switch can send on its new root port in order to authorize immediate transition to the forwarding state, and bypasses the twice-the-forward-delay long listening and learning stages.

Proposal/Agreement Sequence
When a port is selected by the STA to become a designated port, 802.1D still waits twice seconds (2x15 by default) before it transitions it to the forwarding state. In RSTP, this condition corresponds to a port with a designated role but a blocking state. These diagrams illustrate how fast transition is achieved step-by-step. Suppose a new link is created between the root and Switch A. Both ports on this link are put in a designated blocking state until they receive a BPDU from their counterpart.



When a designated port is in a discarding or learning state (and only in this case), it sets the proposal bit on the BPDUs it sends out. This is what occurs for port p0 of the root bridge, as shown in step 1 of the preceding diagram. Because Switch A receives superior information, it immediately knows that p1 is the new root port. Switch A then starts a sync to verify that all of its ports are in-sync with this new information. A port is in sync if it meets either of these criteria:
* The port is in the blocking state, which means discarding in a stable topology.
* The port is an edge port.

UplinkFast
Another form of immediate transition to the forwarding state included in RSTP is similar to the UplinkFast spanning tree extension. Basically, when a bridge loses its root port, it is able to put its best alternate port directly into the forwarding mode.
UplinkFast does not need to be configured further because the mechanism is included natively and enabled in RSTP automatically.

Topology Change Detection

In RSTP, only non-edge ports that move to the forwarding state cause a topology change. When a RSTP bridge detects a topology change, these occur:

* It starts the TC While timer with a value equal to twice the hello-time for all its non-edge designated ports and its root port, if necessary.
* It flushes the MAC addresses associated with all these ports.

Topology Change Propagation
When a bridge receives a BPDU with the TC bit set from a neighbor, these occur:
* It clears the MAC addresses learned on all its ports, except the one that receives the topology change.
*It starts the TC While timer and sends BPDUs with TC set on all its designated ports and root port (RSTP no longer uses the specific TCN BPDU, unless a legacy bridge needs to be notified).

This way, the TCN floods very quickly across the whole network. The initiator of the topology change floods this information throughout the network, as opposed to 802.1D where only the root did.

Compatibility with 802.1D

RSTP is able to interoperate with legacy STP protocols. However, the inherent fast convergence benefits of 802.1w are lost when it interacts with legacy bridges.

1 comment: