Você está na página 1de 5

S P E C I A L F E A T U R E

TELECOM

Rapid Spanning Tree Protocol: A new solution


from an old technology By Wald Wojdak

The PICMG 2.16 specification trans- later standardized by the IEEE-802.1 can quickly learn the new algorithm since
formed the CompactPCI backplane into Internet Work Task Force (IEEE-802.1D). both the terminology and basic parame-
an Ethernet network, the center being The purpose of STP was and is to prevent ters have been left unchanged.
the switching fabric (Ethernet switch). loops in a bridged network while allowing
A fundamental requirement of switched redundant connections. Rapid Spanning Tree Protocol
networks is to provide redundant con- Before a discussion of how STP and
nections without creating loops. Tradi- Unlike routers, switches and bridges do RSTP work can begin, some basic con-
tionally, Spanning Tree Protocol (STP) not age-out old packets. This causes prob- cepts employed by both should be under-
has been used for this purpose, but its lems such as unicast frame duplication stood. Figure 1 depicts a simple network
slow convergence has made it nearly and multicast frame multiplication. When of four switches (bridges) that will be use-
obsolete. Fortunately, a solution exists two or more bridges are connected in a ful in understanding these concepts.
to this persistent network problem – loop, they can multiply multicast frames,
Rapid Spanning Tree Protocol (RSTP), sending them round and round until the Tree Topology
a new twist to an old technology. This network becomes clogged. The inability Spanning Tree topology can be thought of
article provides an introduction to RSTP to tolerate active loops is a fundamental as a tree: it includes a root (a Root Bridge),
and explains its improvements and restriction of bridged networks. branches (LANs and Designated Switch-
advantages over STP. es), and leaves (End Nodes). On a tree
Redundant connections are often essential there are no disconnected parts that are
The CompactPCI Packet Switching when designing high-availability (HA) considered part of the tree; that is, the tree
Backplane (cPSB) is a network systems, and that’s where STP is used. encompasses all of its leaves. In addition,
Since its inception in the fall of 2001, the By blocking redundant connections, STP there are no loops in a tree. If you trace a
PICMG 2.16 specification has trans- enables a single/primary data path be- path from one leaf to any other leaf, you
formed the way systems are designed – by tween nodes. If a device or a link failure will find there is one, and only one, possi-
overlaying an Ethernet-based packet causes this primary path to become unus- ble path. This is true of the Spanning Tree
switching architecture on top of Comp- able, STP will enable a secondary path. topology as well. It organizes and connects
actPCI. The heart of the 2.16 concept is its switches into a loop-free topology while
use of switch fabrics (Ethernet Switches) Switch fabrics or switches act as bridges. leaving no segments isolated. Figure 2
that link all boards inside the chassis. They ensure no loops exist on the network depicts a loop-free network with active
Switching fabrics enable multiple chassis by using the spanning tree protocol. connections that span from the root (Root
to be connected or even extended beyond Bridge). In this example, switch 111 has
the constraints of the CompactPCI world Spanning Tree: STP or RSTP been selected as a Root Bridge.
by forming virtual backplanes. These vir- STP has been around for some time and
tual backplanes may be used to connect may still seem perfectly suited for build- Root Bridge
other networking equipment such as hubs, ing HA systems. However, by today’s Just as a tree has a root from which all
switches, and routers directly to the switch standards, it is very slow. This slowness is branches spring, Spanning Tree has a Root
fabric via Rear Transition Modules the result of its re-convergence time, Bridge. Only one Root Bridge can exist in
(RTMs). RTMs plug into the back-end of which can take 30 to 50 seconds. any given network. Although any switch
the midplane, and make some or all of the can be a Root Bridge, the switch with the
network interfaces available externally for Most current applications require HA sys- best Bridge ID becomes the Root Bridge.
more traditional networking applications. tems to switch over in less than a second.
Since STP is so slow, it’s not practical for There are two parts to the Bridge ID: a user-
Switch fabrics are switches and today’s applications – a faster protocol is selected priority and the MAC address. The
switches are bridges needed. The IEEE-802.1w working group switch with the lowest numerical value of
Systems built around the PICMG 2.16 has delivered just that – a newer protocol the priority component becomes the Root
specification are networks and must com- called Rapid Reconfiguration or Rapid Bridge. When all switches have the same
ply with networking rules. Switch fabric Spanning Tree Protocol (RSTP). priority value, the one with the lowest MAC
manufacturers have provided various tech- address becomes the Root Bridge.
nologies to aid system integrators in deal- RSTP is not so much a new protocol, but
ing with various network problems. One of rather an improved and faster version of Designated Bridges
these technologies has been Spanning Tree STP. It preserves all the basic concepts of A simple way to prevent loops in the net-
Protocol (STP). The STP was originally STP and interoperates with it as well. work is to ensure only one bridge is respon-
developed in the late 80s by DEC, and was Users familiar with the operation of STP sible for forwarding traffic from the direc-

Reprinted from CompactPCI Systems / March 2003


S P E C I A L F E A T U R E

Figure 2
A backup port is connected to the same
LAN as a designated port. Spanning tree
blocks backup ports since the designated
port provides a better path from this LAN
to the root bridge. Figure 4 shows the
backup port.

An alternate port provides a redundant


connection to the Root Bridge and can
Figure 1
become a new Root Port in the event the
current Root Port loses its connection to a
tion of the root into any given link (branch). has multiple paths connecting it to the root, Root Bridge. Figure 4 shows the alternate
As long as only one active path from a root the best path is determined based on the port. In many cases, the alternate port can
to any end node (leaf) exists, there will be message priority vector carried inside the become a new root port and transition into
no loops in the topology. The bridge respon- Bridged Protocol Data Unit (BPDU) and the Forwarding state without a delay.
sible for forwarding traffic in the direction the receiving port ID. The port with the best
from the root to a given link is known as the priority vector becomes a root port while BPDU format
Designated Bridge of that link. the remaining ports become alternates. Bridges learn and exchange information
Figure 3 depicts root ports. about each other in order to calculate
Port States spanning tree by sending small hello
There are three operational states assigned Designated Port Role packets called Bridge Protocol Data Units
to each port by RSTP: Discarding, Learn- A port is designated if it can send the best (BPDUs). Some differences exist between
ing, and Forwarding. Discarding ports do BPDU on the segment to which it is con- STP and RSTP BPDUs.
not participate in the active topology and nected. All bridges connected to a given
do not learn MAC addresses. Ports in segment listen to each other’s BPDUs and STP BPDUs
Learning states learn MAC addresses, but agree that the bridge sending the best STP uses two different BPDUs: Con-
do not forward user traffic. Ports in BPDU is the designated bridge for the seg- figuration BPDUs and Topology Change
Forwarding states fully participate in both ment. Figure 3 depicts the designated ports. BPDUs. Configuration BPDUs originate
data forwarding and MAC learning. RSTP from the root bridge every hello time and
states differ somewhat from STP states. Alternate and backup port roles carry all information required to calculate
Table 1 depicts these differences. Alternate or backup ports do not forward spanning tree topology. Other bridges listen
user data, but serve as backups for the root for Configuration BPDUs on their root ports
Port roles and designated ports. and forward them on their designated ports.
A port role is a function STP and RSTP
STP Port State RSTP Port State Is Port Included Is Port Learning
assign to each port. STP assigns one of the
in Active Topology? MAC Addresses?
following roles: Root Port, Designated
Port, or Blocking Port. RSTP splits the Disabled Discarding No No
Blocking Port role into Backup and Blocking Discarding No No
Alternate port roles. Listening Discarding No No
Learning Learning No Yes
Root port role
Forwarding Forwarding Yes Yes
A root port is the port closest to the root
bridge in terms of path cost. When a switch Table 1

Reprinted from CompactPCI Systems / March 2003


STP bridges do not flush their filter-
ing databases when they detect a topol-
ogy change. Instead, they send Topology
Change Notification BPDUs (TCN
BPDUs) in the direction of the root
bridge, which then informs all bridges a
topology change has occurred. It may
take several seconds before the TCN
BPDU reaches the root bridge and sev-
eral more seconds before the BPDUs
(with the TC flag set) reach other bridges
on the network. Even then, STP switches
do not flush old information immediately.
Instead, they switch their aging timer
from long to short (a default value for the
short timer is Forward Delay which
equals 15 seconds). After this time, if
Figure 4
entries are not refreshed they are
removed from the database.
Figure 3 RSTP re-converges in less than a second.
Although computation of the Spanning RSTP uses a more efficient mechanism to
Topology Change BPDUs (TCN BPDUs) Tree is identical between STP and RSTP, purge old information. First of all, every
are sent in the direction of the root by the there are differences in the behavior of the switch that detects a topology change
bridge which detected a topology change. two algorithms. sends BPDUs with the TC flag set.
When the root bridge receives a TCN Secondly, the switch that detects a change
BPDU, it must then inform other switches Faster filtering database aging purges old entries immediately. Finally,
a change has occurred in the current to- Switches listen for network traffic to every switch that receives a BPDU with a
pology. It does so by setting a Topology learn which nodes (MAC addresses) are set TC flag, purges the old entries and
Change (TC) flag in every BPDU it sends on which ports, then store these MAC-to- relays this BPDU to other switches.
for a period of time (specified as Forward port entries in their databases. Later,
Delay + Max Age). When a switch re- when a frame arrives destined for one of The improvement with which switches
ceives a BPDU with a TC flag set, it these MAC address, it will be switched to eliminate old information is tremendous.
switches its aging time from long to short the proper port. A database of these Rather than waiting several seconds for
in order to age out Filtering Database MAC-to-port entries is called a filtering the TCN BPDU to reach the root bridge,
entries more rapidly. database. and several more seconds before the
BPDU is received from the root bridge,
RSTP BPDUs This database needs to be relearned every and additional time for the Forward Delay
RSTP uses only one type of BPDU called time a network topology changes or time before aging out incorrect entries –
RSTP BPDUs. They are similar to STP frames may be sent to the wrong ports. A switches purge old entries immediately
Configuration BPDUs with the exception topology change such as a link failure can and ask other switches to do the same.
of a type field set to “version 2” for RSTP cause some nodes to become connected to
and “version 0” for STP, and a flag field different switches. Even though no sta- BPDUs as “keep-alive”
carrying additional information. tions have been physically moved, it can STP switches do not generate their own
appear to the switches as though stations BPDUs, they wait to receive them on their
The STP BPDUs use only two flags: have been lifted from one part of the net- root ports then relay them (after some pro-
Topology Change (TC) and TC Acknowl- work and reconnected into another. In cessing) to their designated ports. If
edgement (TCA). RSTP uses six ad- order for traffic to reach these stations, the STP Bridge does not receive a BPDU
ditional bits to encode the role and the switches need to age old information and for a “max age time” (default 20 seconds),
state of the port originating the BPDU, relearn new node locations. it declares the root bridge dead. It then
and two flags to handle the proposal/
agreement mechanism. Figure 5 shows
the difference between STP and RSTP
flag fields.

How RSTP differs from STP


In many respects STP and RSTP work the
same. They reduce the bridged network to
a single spanning tree topology in order to
eliminate loops. Either algorithm reacti-
vates redundant connections in the event
of a link or component failure. The main
difference is convergence time. While it
may take STP 30 to 50 seconds to re-con-
verge, RSTP does it in dramatically less
time. In a carefully designed network, Figure 5

Reprinted from CompactPCI Systems / March 2003


S P E C I A L F E A T U R E
assumes itself to be a root bridge and ■ It monitors MAC operational states max age timer (default 20 seconds) before
starts a new root bridge selection process. and retires ports that are no longer deciding their path to the root bridge is no
functional. longer operational. During that time,
RSTP also differs in this respect. First, ■ It processes inferior BPDUs to detect switch 444 discards BPDUs received on
every switch sends its own BPDUs whether topology changes. port 02 as inferior. Finally, after the max
it received one on its root port or not. ■ It keeps track of ports that provide age timer expires, switch 444 ages out pro-
Instead of waiting for a “max age time,” an alternative paths to the Root Bridge. tocol information on port 01 recognizing it
RSTP switch expects to receive a BPDU If a Root Port fails, RSTP can quickly has a path to the root bridge through port
within three hello times. If the BPDU is not retire the Port and make an 02. It elects this port to be its new root port
received within this time, the switch pre- Alternative port its new Root Port. and advertises it to switch 222 through port
sumes it has lost connection with its neigh- This new Root Port can be placed in 01 (a designated port). In order to ensure
bor. Of course, if a switch detects a loss of the forwarding state without delay. all switches on the LAN agree with this
a link on a port, it immediately assumes its ■ When bridges are connected via new topology, switch 444 will not forward
neighboring connection is lost. point-to-point links (directly con- user data on ports 01 and 02 for an addi-
nected), they use handshake (sync), tional 30 seconds (two times Forward
Edge Ports rather than timers to transition a Delay). Instead, it transitions both ports
Spanning tree takes great care to ensure Designated Port to Forwarding. through listening and learning (15 seconds
that no loops exist in the network. That’s each) before placing them in a forwarding
why switch ports will not send traffic until To illustrate this, see Figure 6. It depicts a state. Switch 222 notices its new path to
all switches agree on the network topol- network made of four switches: 111, 222, the root bridge is now through switch 444
ogy. There are, however, situations where 333, and 444 connected via a ring topology: and makes its port 03 a new root port,
ports connect directly to end stations – which also needs to transition through lis-
and cannot create loops. RSTP recognized ■ Switch 111 is elected a Root Bridge. tening and learning. The total network out-
this and allows configuring ports which do ■ Ports that connect switches 222 and 333 age perceived by stations connected to
not connect to other bridges as edge ports. to the Root Bridge become Root Ports. switch 222 and 444 will be:
Edge ports do not need to transition ■ Switch 444 has two paths to the Root
through regular spanning tree states; they Bridge: via bridge 222 and 333. It 20 seconds (Max Age Time)
go directly to forwarding. If a switch elects port 01 as its Root Port (it has + 15 seconds (listening)
detects a BPDU on the edge port, it auto- the best port priority vector) and + 15 seconds (learning)
matically makes it a non-edge port. blocks port 02. Total: 50 seconds.

How RSTP works What happens when the connection What happens when the link between
The main difference in the operation of between bridge 111 and 222 breaks? First, switch 111 and 222 gets restored?
STP and RSTP is that RSTP no longer the STP case:
relies on conservative timers to re-con- ■ As soon as switch 222 receives
verge after a topology change. In order to The STP Case BPDUs from bridge 111 on port 01 it
accomplish this, the algorithm does the After the link failure, switches 222 and retires its port 03 and makes port 01
following: 444 continue to wait for the duration of the its new root port. This port, however,

Figure 6

Reprinted from CompactPCI Systems / March 2003


needs to transition through listening ■ When Root Bridge (switch 111) Spanning Tree timers. Depending on the
and learning before it can send detects a link on port 03, it starts a complexity of the network, the time it
user data. sync process with switch 222 to tran- takes to establish the new topology may
■ Switch 222 also makes port 03 its sition this port to a forwarding state. vary from tens of milliseconds to seconds.
designated port. This requires switch 111 to send a
■ Similar things happen on switch BPDU to switch 222 with a proposal Conclusion
444. As soon as it receives BPDUs flag set. This article has introduced Rapid Span-
from switch 222 on port 01, it retires ■ Switch 222 recognizes this BPDU as ning Tree Protocol (RSTP) as a solution
port 02 and makes port 01 its new superior (received on the shortest path for designing HA systems based on the
root port. This port also needs to to the root) and asserts sync. The sync PICMG 2.16 CompactPCI Packet Switch-
transition through listening and is a signal to all non-edge designated ing Backplane specification. RSTP has
learning. Port 02 will stay in blocking ports to go into blocking mode. many advantages over its predecessor,
mode since it provides a redundant ■ Port 01 then sends a BPUD back to Spanning Tree Protocol (STP). In the event
connection to the root bridge. the root bridge with the agreement of a link or a component failure, carefully
flag set indicating that switch 222 is designed systems may use RSTP to switch
The network outage for stations connected in agreement with the new topology. over to their redundant connections in less
to switches 222 and 444 will be 15 sec- This is the indication to 111 that port than a second. In order to design HA sys-
onds (listening) + 15 seconds (learning) – 01 can transition to a forwarding state tems with RSTP, users need to possess
for a total time of 30 seconds. without additional delay. some background in the operation of the
■ The break in the loop is now between RSTP protocol. The intention of this arti-
The RSTP Case switches 222 and 444. cle is to provide such a background.
When switch 222 loses its connection to ■ Next, switch 222 repeats the sync
the root bridge, it immediately decides process to transition its designated Waldemar Wojdak is
that it is the new root bridge and starts port 03 into a forwarding state. It sends a principal software
advertising that to switch 444. Switch 444 a BPDU with a proposal flag set to engineer at Perform-
recognizes BPDUs received from 222 as switch 444 which retires port 02 from ance Technologies
inferior, and concludes its connection to its role of a root port and makes port 01 with more than 20
the root bridge, through switch 222, is no its new root port. It also asserts sync to years experience in
longer operational. It immediately acti- place all non-edge designated ports in the electronics and
vates its secondary path through port 02, blocking mode and returns a BPDU to communications
makes the port its new root port, and switch 222 with the agreement flag set. industry. Waldemar has been involved in
immediately places it in a forwarding This informs switch 222 it may transi- designing and architecting software
state. It also makes port 01 its designated tion its port 03 to a forwarding state. aspects of various communication prod-
port and advertises its new path to the root ucts. Waldemar joined Performance
to bridge 222. Bridge 222 accepts this Notice the final break has been moved to a Technologies in 1992 and holds a
information and makes port 03 its new link connecting switches 444 and 333. Also Masters of Science in Electronic Engin-
root port. Finally, switch 444 performs a note that the whole process required no eering from the Warsaw Technical
handshake called “sync operation” with timers and could take less than a second University in Poland.
switch 222 to transition port 01 into a for- before all bridges agree on the new topology.
warding state. The sync requires a BPDU For more information:
exchange, but does not use timers, and Converge Time
therefore happens very fast. The time The initial RSTP converge time, after all Waldemar Wojdak
before all bridges agree on the new topol- switches are connected and powered up, is Performance Technologies
ogy may take less than a second. similar to that of STP. However, once the 205 Indigo Creek Drive
network becomes stable and all switches Rochester, New York 14626
What happens when the link between agree on the current topology, any sub- Tel: 585-256-0200
bridge 111 and 222 gets restored? sequent changes (e.g., link failure) are E-mail: wjw@pt.com
propagated rapidly without the need for Web site: www.pt.com

Reprinted from CompactPCI Systems / March 2003

Você também pode gostar