LAB on RSTP
These are my notes made during my lab practical as part of my LPIC3 Diploma course in Linux Clustering. They are in “rough format”, presented as they were written.
LPIC3 Syllabus for RSTP
364.4 Network High Availability
Description: Candidates should be able to configure redundant networking connections and manage VLANs.
Furthermore, candidates should have a basic understanding of BGP.
Key Knowledge Areas:
• Understand and configure bonding network interface
• Network bond modes and algorithms (active-backup, blance-tlb, balance-alb,
802.3ad, balance-rr, balance-xor, broadcast)
• Configure switch configuration for high availability, including RSTP
• Configure VLANs on regular and bonded network interfaces
• Persist bonding and VLAN configuration
• Understand the principle of autonomous systems and BGP to manage external
• Awareness of traffic shaping and control capabilities of Linux
Partial list of the used files, terms and utilities:
• bonding.ko (including relevant module options)
The cluster comprises four nodes installed with CentOS 7 and housed on a KVM virtual machine system on a Linux Ubuntu host.
For this lab I am creating a vlan called vlan-1, for just two machines, ie:
An Overview of Rapid Spanning Tree Protocol (RSTP) / Spanning Tree Protocol (STP)
RSTP is a further development of STP or Spanning Tree Protocol, which was the original switching protocol for managing switching in Ethernet networks. RSTP has a number of modifications to STP, but the principles remain largely the same. So to understand RSTP we need first understand the basics of STP.
STP is used to prevent network traffic loops which can occur as networks grow and use multiple switches
Broadcast messages are being sent all the time on an Ethernet network and this means “Broadcast Storms” can easily occur which generate substantial network traffic overhead and result in slow network connectivity
Loops can also result in unstable MAC address tables since they are being constantly updated and this can result in duplicate Ethernet frames being sent to the same host/s.
The original STP is also known as IEEE 802.1d
To avoid this happening, STP-based switches run an “Election Process” to elect a master switch or “Root Bridge” (RB) which plays the key role in the switching network.
How this happens in overview:
The switch with the lowest BID is elected RB
All Root Bridge interfaces are placed into a Forwarding state
The Non-Root switches each elect their own Root Port, based on:
– Lowest cost
– Lowest neighbour BID
– Lowest neighbour port priority
– Lowest neighbour port number
and then elect a Designated Port, based on:
– Lowest root cost
– Lowest BID
– Lowest neighbour port priority
– Lowest neighbour port number
And finally, all the other ports are placed into a Blocking State
Here are some key definitions used in STP/RSTP:
STP/RSTP Roles and States
– Root Ports: this is the best port on each switch to reach the Root Bridge
– Designated Port: this is the port that offers the best route to the Root Bridge
– Non-Designated Ports: all the other ports which are in a blocking state
– Disabled: The port that is currently shutdown
– Blocking: A port that is currently blocking traffic. This port must first move to Listening state before it can move to Forwarding state
– Listening: A port that is not forwarding traffic and is not learning MAC addresses. This is a transitional State used while switching from one role to another. It is held in this state for the Forward Delay timer (which by default is 15 secs)
– Learning: A port which is not forwarding traffic but IS learning MAC addresses. This is a transitional State for when changing from one role to another. Again, it is held in this state for the Forward Delay timer of 15 sec default. From here, the port can then move on to the Forwarding state.
– Forwarding : A port that is sending and receiving traffic as per normal. From here the port can move directly to Blocking state.
RSTP/STP Root Bridge Election
Each switch generates “BPDUs” or Bridge Protocol Data Units, which are messages sent to all switches in the network. They are used to select a single switch to act as Root Bridge as the master or root of the spanning tree. BPDUs help calculate the shortest path from itself to the Root Bridge, designated one of the switches as the closest to the Root for each LAN segment.
To do this, BPDUs help switches use the following:
– Root Cost: the cost of the root bridge
– BID (Bridge ID): this is the switch with the lowest overall BID that will become the root bridge. BIDs are in the format: 32769aaaa:aaaa:aaaa and are comprised of:
– STP priority: This has a default value of 32768 + the VLAN ID number. Eg for VLAN 1, the STP priority would be 32769. – MAC Address
Each switch shares its BPDUs with the others. They use these to elect the Root Bridge.
Then: all ports on the root bridge enter a Forwarding State, and each non-root switch then chooses the best path to the root bridge.
This is known as the Root Port and is based on Port Cost. The Port Cost in turn is based on port speed: the higher the speed, the lower the cost. – Each outgoing port to the root is summed together, although it can also be set manually. If there is a tie, then they will examine the lowest neighbor BID.
If that also results in a tie, then they look at lowest neighbor port priority to decide.
To select a Designated Port, the lowest root cost to the bridge will decide. If that is a tie, then lowest BID is used. If that is also a tie ,then lowest neighbor port priority. And if that also ties, then it will be decided according to lowest neighbor port number.
Each port that is not a root port or designated port is put into a Blocking State
Timers are used for STP:
– Hello: occurs 2 seconds and informs all the switches that everything is still active and running
– MaxAge: This is 10 x Hello timer by default (ie 20 seconds) and is the time the switch will wait before it decides there is a problem
– Forward Delay: This is 15 seconds and is the time between the Listening and Learning state
One problem with STP is that of Convergence. This refers to the time it takes for the STP switching network to update itself to changes in the network eg new switches, switches going offline for whatever reason, changed routes, etc, and to become stable again.
To resolve this problem, RSTP was developed to provide for much faster convergence.
RSTP was introduced by IEEE in 2001 as IEEE standard 802.1w. RSTP is backwards-compatible with standard STP.
While STP can take 30 to 50 seconds to respond to network topology changes, RSTP can respond to changes within 3 × Hello times (default, meaning 3 times 2 seconds) or even within a few milliseconds in the case of a physical link failure.
RSTP adds new bridge port roles in order to speed convergence following a link failure. The number of states a port can be in has been reduced to three instead of STP’s original five.
RSTP bridge port roles are as follows:
Root – A forwarding port that is the best port from non-root bridge to root bridge
Designated – A forwarding port for every LAN segment
Alternate – An alternate path to the root bridge. This path is different from using the root port
Backup – A backup/redundant path to a segment where another bridge port already connects
Disabled – Not strictly part of STP, a network administrator can manually disable a port
RSTP switch port states are as follows:
Discarding – No user data is sent over the port
Learning – The port is not forwarding frames yet, but is populating its MAC-address-table
Forwarding – The port is fully operational
Note that Cisco developed, implemented and published the Per-VLAN Spanning Tree (PVST) as its own Cisco-proprietary protocol which uses its own proprietary Inter-Switch Link (ISL) system for VLAN encapsulation, as well as PVST+ which uses 802.1Q VLAN encapsulation.
Both of these standards implement a separate spanning tree for each VLAN. Cisco switches commonly implement PVST+ and can only implement Spanning Trees for VLANs if the other switches in the LAN also use the same VLAN STP protocol.
Cisco also published its own proprietary version of Rapid Spanning Tree Protocol. This creates a spanning tree for each VLAN, like PVST. The Cisco term for this is Rapid Per-VLAN Spanning Tree (RPVST).
Commands and Practical Examples of RSTP/STP Configuration