RSTP is the more improved and advanced version of STP which is a layer 2 protocol that prevents bridge loops and broadcast storms in local networks with redundant connections. Rapid spanning tree protocol has faster convergence and it is also backward-compatible with STP. To make sure a loop-free topology, the Rapid Spanning Tree Protocol (RSTP) precludes some of the connections which permit only a single active path between any two devices. All these disabled connections can be used as backup paths in case an active connection fails. The IEEE standard for Rapid spanning tree protocol is 802.1w.
Similarities between STP and RSTP:
- In both STP and RSTP bridge with the lowest Bridge ID is elected as Root Bridge.
- BPDUs in both STP and RSTP are forwarded between switches.
- Roots and designated ports are elected in the same manner as they are elected in STP and their functionality is also identical to that of STP.
Working of RSTP
RSTP follows a strict set of rules by which the switches decide the best way to forward the traffic on the network free from any redundancy. When RSPT is enabled on a network, the spanning tree algorithm decides the configuration of the spanning tree automatically.
The topmost bridge of the spanning tree is the Root bridge in RSTP and it is in charge of sending all the network topology information to other switches present in the network. This plays an important role when hardware failures occur, or some other topology changes occur. So, the most efficient alternate paths are established without any delay.
Port Roles in RSTP
There are four-port roles in RSTP
- Root Port: The port with the best path cost is elected as the root port. A non-root bridge can only have one root port. Root ports forward data to the bridge.
- Designated Port: It is a non-root port that is used as a forwarding port for every LAN segment.
- Backup Port: It is a backup path to a segment where another bridge port is already connected. These ports receive BPDUs from their switches but they remain in a blocked state.
- Alternate Port: It is a Backup port with a less desirable path cost. All such ports remain in a blocked state.
Port States in RSTP
Rapid spanning tree protocol supports three port states.
- Discarding: In the discarding state, no user data is sent over the port.
- Learning: In the learning state the ports learn about the MAC address but it doesn’t forward any frames.
- Forwarding: In the forwarding state the ports can send data and are fully operational.
Working of Port States:
At first, a switch port starts in a discarding state, a discarding port does not forward any frames nor does it learn MAC addresses, and it also listens for BPDUs. Backup and alternate ports remain discarding.
In RSTP if a port is elected as a Root port or Designated port, the transition will directly take place from a discarding state to a learning state. Hence, RSTP doesn’t need a listening state. A learning port adds MAC addresses into the Content addressable memory table; However, it can not forward frames.
In the next phase, a learning port transitions into a forwarding state. A forwarding port is completely functional i.e., it learns MAC addresses, sends and listens for BPDUs, and forwards frames.
Benefits of RSTP:
- Prevents network loops.
- Prevents redundancy.
- Faster Convergence.
- Backward compatible with STP.
- Every switch generates BPDU and sends them out at the hello interval.
- Switches don’t need artificial forward delay timers.
In STP BPDUs are generated only by the root bridge. If a non-root bridge receives a BPDU from the root bridge on its root port, it will pass on the BPDU downstream to its neighbors. This Convergence process is slower and STP relies on forwarding delay timers to make sure a loop-free environment, this takes a lot of time.
In RSTP, switches just handshake directly with their neighboring switches, this allows quick synchronization in the topology. This lets ports promptly change from a discarding state to a forwarding state without a delay timer.
Types of ports in RSTP
There are three types of ports in RSTP
- Edge: It is a port that connects to a host.
- Root: It is a port that connects to another switch, and it has the best path cost to the root bridge.
- Point-to-point: It is a port that connects to another switch and it has the potential of becoming the designated port for a segment.
RSTP algorithm follows some general steps:
- Determining root bridge: The switch with the lowest bridge priority is elected as the root bridge. In the case of a tie, a tiebreaker based on the MAC address is used to decide the root bridge i.e., the switch with the lowest MAC address is elected as the root bridge.
- All root bridge interfaces are put in forwarding state: In the forwarding state, all the ports learn MAC addresses, and also send and receive data.
- All non-root switches select a root port: Based on root cost the root port is the best path to the root bridge. There is only one root port in a non-root switch.
- Selecting designated port: these ports are allowed to forward traffic and they are selected based on port cost. All leftover root bridge ports are designated ports.
- Rest of the ports in blocking state: these ports do not pass any data to other switches and they also don’t learn MAC addresses.
Unlock the Power of Placement Preparation!
Feeling lost in OS, DBMS, CN, SQL, and DSA chaos? Our Complete Interview Preparation
Course is the ultimate guide to conquer placements. Trusted by over 100,000+ geeks, this course is your roadmap to interview triumph.
Ready to dive in? Explore our Free Demo Content and join our Complete Interview Preparation