Tuesday, 21 February 2017

STP Vs RSTP

Difference between STP and RSTP:
The following table outlines the main differences between Rapid STP (802.1w) and the legacy STP (802.1d):
Priority: The priority range is between 1 and 65536; therefore, 1 is the highest priority. Priority can be assigned/increased in the multiples of 4096


STP (802.1d)
Rapid STP (802.1w)
In stable topology only the root sends BPDU and relayed by others.
In stable topology all
bridges generate BPDU every Hello (2 sec) : used as “keepalives” mechanism.
Port states
Disabled
Blocking
Listening
Learning
Forwarding
Discarding (replaces disabled, blocking and listening)
Learning
Forwarding
To avoid flapping, it takes 3 seconds for a port to migrate from one protocol to another (STP / RSTP) in a mixed segment.
Port roles
Root (Forwarding)
Designated
(Forwarding)
Non-Designated
(Blocking)
Root (Forwarding)
Designated
(Forwarding)
Alternate
(Discarding)Backup (Discarding)
Additional configuration to make an end node port a port fast (in case a BPDU is received).
- An edge port (end node port) is an integrated Link type which depends on the duplex : Point-to-point for full duplex & shared for half duplex).
Topology changes and convergence
Use timers for convergence (advertised by the root):
Hello
(2 sec)
Max Age
(20 sec = 10 missed hellos)
Forward delay timer (15 sec)
- Introduce proposal and agreement process for synchronization (< 1 sec).- Hello, Max Age and Forward delay timer used only for backward compatibility with standard STP
Only RSTP port receiving STP (802.1d) messages will behaves as standard STP.
Slow transition (50sec):
Blocking (20s) =>Listening (15s) =>Learning (15s) =>Forwarding
Faster transition on point-to-point and edge ports only:Less states – No learning state, doesn’t wait to be informed by others, instead, actively looks for possible failure by RLQ (Request Link Query) a feedback mechanism.
Use only 2 bits from the flag octet: Bit 7: Topology Change Acknowledgment. Bit 0 : Topology Change
Use other 6 bits of the flag octet (BPDU type 2/version 2):
Bit 1 : Proposal Bit 2, 3 : Port role Bit 4 : Learning Bit 5 : Forwarding Bit 6 : Agreement Bit 0, 7 : TCA & TCN for backward compatibility
The bridge that discover a change in the network inform the root, that in turns informs all others by sending BPDU with TCA bit set and instruct them to clear their DB entries after “short timer” (~Forward delay) expire.
TC is flooded through the network, every bridge generate TC (Topology change) and inform its neighbors when it is aware of a topology change and immediately delete old DB entries.
If a non-root bridge doesn’t receive Hello for 10*Hello (advertised from the root), start claiming the root role by generating its own Hello.
Wait for 3*Hello on a root port (advertised from the root) before deciding to act.
Wait until TC reach the root + short timer (~Forward delay) expires, then flush all root DB entries
Delete immediately local DB except MAC of the port receiving the topology changes (proposal)
STP:
Configuration BPDU: Generated by Root Switch
TCN BPDU: Generated by any Switch detecting a change
TCA BPDU: Generated by any Switch acknowledging the change

In RSTP:
Once the Root Switch is elected (after the Proposal/Agreement phase). All switches generates BPDU (used as a keepalive)

STP and RSTP has similar BPDU Format except that of Flag Field:
In STP: Only least (for Topology Change Acknowledgment) and higher significant (Topology Change) bits are used

In RSTP: All the Flag fields are used for Proposal, Agreement and also for Port roles.

Normal BPDU format:






STP/RSTP
Rapid Spanning Tree Protocol (RSTP) is an evolution of the Spanning Tree Protocol (802.1D standard) and provides for faster spanning tree convergence after a topology change. The standard also includes features equivalent to Cisco PortFast, UplinkFast and BackboneFast for faster network re-convergence.

Spanning-Tree Protocol (STP) prevents loops from being formed when switches or bridges are interconnected via multiple paths. Spanning-Tree Protocol implements the 802.1D IEEE algorithm by exchanging BPDU messages with other switches to detect loops, and then removes the loop by shutting down selected bridge interfaces. This algorithm guarantees that there is one and only one active path between two network devices.

CONVERGENCE TIME IN RSTP:
The main difference in RSTP is that all bridges can send BPDU, not just the root. 

So in the instance of a switch goes down, any switch that has a link connected to it will notice (as its link has gone down) this switch will then bring up its alternative port and send out a BPDU to neighbor switch’s still alive to say it has done so. (So no timer need to time out, this happens almost instantly). This BPDU then travel through the network update all other switch’s resulting in sub second fail over and convergence of the network. 

The hello times do some times come in to play, but in theory for most switch and link failures in a RSTP network, failover and down time is limited to < 1sec.
AND ALSO:
The forward delay is not normal used. RSTP is much more of an active process between all switches in a network. 

They handshake on ports so check they can bring them to a forwarding state before they bring them up (but this takes milliseconds) they also only flush mac address of the ports that have failed, so when bringing up an alternative port, they still know all mac address on any other port they still have up. They don't need a long learning phase, as the impact of re-learning mac address is less? (Plus switches are much faster). 

But this really is a CCNP topic, if you look in to uplink fast and backbone fast in common STP. This is the kind of thing that runs network wide on RSTP. 

The forward (listing / learning) delay is generally brought in to use when RSTP meets STP. and it has to fall back to using the STP timers.
Backup port and alternative port: These two port roles correspond to the blocking state of 802.1d (STP). A blocked port is defined as not being the designated or root port. A blocked port receives a more useful BPDU than the one it would send out on its segment. Remember that a port absolutely needs to receive BPDUs in order to stay blocked. RSTP introduces these two roles for this purpose.













An alternate port is a port blocked by receiving more useful BPDUs from another bridge, as show in above fig.
As the name indicates alternate to one port.














Backup port is a port blocked by receiving more useful BPDUs from the same bridge it is on, as shown in above fig.

****An alternate port provides an alternate path to the root bridge and could therefore replace the root port present if it fails.
****Where as backup port provides redundant connectivity to the same segment and can’t guarantee an alternate connectivity to the root bridge. 

New BPDU Format:
Few changes introduced by RSTP to the BPDU format. Only two flags, Topology Change (TC) and TC Acknowledgement (TCA), were defined in 802.1d. RSTP uses all 6 remaining bits of the flag byte in order to do the following:
    1. Encode the role and state of the port originating the BPDU.
    2. Handle the proposal/agreement mechanism.

In order to achieve fast convergence on a port, the protocol relies upon two new variables: edge ports and link type.
Another imp change is that the RSTP BPDU is of type 2, version 2. Result of this is that legacy bridges must drop this new BPDU.
On a given port, if hellos are not received 3 consecutive times (3 * 2 secs), protocol information can be immediately aged out. This fast aging of the information in RSTP allows quick failure detection. If a bridge fails to receive BPDUs from a neighbor, it is certain that the connection to that neighbor has been lost, as opposed to 802.1d where the problem could have been anywhere on the path to the root.
****Please note the WORD “anywhere on the path to the root”, since in legacy STP 802.1d only root bridge used to send BPDUs and same will be relayed to others in segment. So whenever a change somewhere in topology occurs, this topo change info needs to be relied to everybody in topology by root bridge but whereas in RSTP 802.1w all the bridges in topo will be sending BPDUs of their own to neighbors and when any link status changes they immediately updates to neighbors.
Note: Failures are detected even much faster in case of physical link failures
In order to achieve fast convergence on a port, the protocol relies upon two new variables: edge ports and link type.
Edge ports: Are nothing but portfast, only end systems or non-switches connected links are configured as portfast as it is guaranteed that they don’t cause loops as a result they don’t get involved in STP operation. But in case if any ports connected to switches and are configured as portfast and as a result of STP if they receive the BPDUs on this link these interfaces will put into error disabled.
Since port fast configured interfaces gets directly transitioned from blocked to forwarding state.
Link Type:
Link Types - Point-to-Point and Shared
- With RSTP, non-edge ports can be configured as either a point-to-point link type or a shared link type. The shared link type is for a port that is connected to other switches by way of a shared device like a hub.
- Point-to-point link types can switch to forwarding state quickly depending on its port role
Differences in convergence between 802.1d and 802.1w
802.1d:


In the above diagram the link between root bridge and bridge A is added newly. Earlier Bridge A could reach root bridge via CàDà Root Bridge. Now since this new port is coming up  and since it can cause the loop as it is redundant path to RB. First both links i.e. new link between Bridge A and RB and Bridge D and RB are put into listening state i.e. data flow is stopped. And since Bridge A now can hear from RB directly it will send out superior BPDUs to its leaves and during this superior BPDU reaches Bridge D and it immediately blocks the port P1.

As a result of above explanation below figure:


Port P1 is disabled now.
The only problem now is that twice the forward delay has to elapse before the link between the root and A eventually ends up in the forwarding state. This means 30 seconds of disruption of traffic (the entire A, B, and C part of the network is isolated) because the 8021.D algorithm lacks a feedback mechanism clearly advertising that the network has converged in a matter of seconds.

How STP Recovers From an Indirect Link Failure

This illustrates how STP behaves when it has to recalculate after an indirect link failure, that is, when a bridge has to change the status of some of its ports because of a failure on a link that is not directly attached to it.


Consider this diagram, which involves three switches R, B, and S in a fully meshed topology. Assume that R is the root bridge and B is the backup root bridge. S blocks its port P and B is the designated bridge for link L3.
1.     If link L1 goes down, switch B immediately detects the failure and assumes it is the root. It starts to send BPDUs to S and claims to be the new root.
2.     When S receives this new BPDU from B, it realizes it is inferior to the one it had stored for port P and ignores it.
3.     After max_age timer expires (20 seconds by default), the BPDU stored on S for port P ages out. The port goes immediately to listening and S starts to send its better BPDU to B.
4.     As soon as B receives the BPDU from S, it stops sending its BPDU.
5.     Port P moves to the forwarding state through listening and learning states. This takes twice the fw_delay value, an additional 30 seconds. Full connectivity is then restored.
It took the max_age value (20 seconds) plus twice the fw_delay value (2x15 seconds) to recover from this indirect link failure. This is 50 seconds with the default parameters. The backbone fast feature proposes to save max_age (20 seconds). In order to do this, it ages out immediately after the port receive inferior BPDUs.



1 comment:

Note: only a member of this blog may post a comment.