What Is Spanning Tree Protocol – STP RSTP Modes

What Is Spanning Tree Protocol - STP RSTP Modes

Spanning-Tree Protocol (STP) is a loop-prevention protocol used in a switching environment. The basic function of STP is to prevent bridge loops and the broadcast radiation that results from them.

When a switch receives a frame and does not find any entry for the destination address in the MAC table it broadcast the packet to all ports. So when other switches receive the same packet and the too do not find any entry in the MAC table they also broadcast the packet to all available ports. Thus every witch in the topology uses broadcast unless and until the destination is found and thus can create a loop.

In order to prevent a broadcast storm or looping problem, a protocol called STP was created by DIX(Digital, Intel, and Xerox) as a switching loop prevention protocol. Then IEEE created their own version of STP called 802.1d. The goal behind developing STP is to create a loop-free network by block redundant links.

Download Free CCNA Android Apps from Playstore

How Spanning Tree Protocol works

Selecting the Root Bridge

Selecting the Root Port

Selecting Designated Port and Non-Designated Port

The STP algorithm is responsible for identifying active redundant links in the network and blocking one of these links, thus preventing possible network loops.

STP enabled switches to exchange BPDU messages between them to agree upon the “root bridge”, the process is called Root Bridge Election.

Once the root bridge is elected, every switch has to determine which of its ports will communicate with the root bridge. Therefore Root Port Election takes place on every network switch.

Designated Port Election takes place in order to have only one active path towards every network segment.

Select a root bridge

The root bridge of the spanning tree is the switch with the smallest or lowest bridge ID. Each cisco switch has a configuration priority number and a MAC address. The bridge default priority is 32768 and can only be configured in multiples of 4096. When comparing two bridge IDs, the priority portions are compared first and the MAC address is compared only if the priorities are equal.

The switch with the lowest priority of all the switches will be the root; if there is a tie, then the switch with the lowest priority and lowest MAC address will be the root bridge.

For example, if switch A(MAC=1111) and B(MAC=2222) both have a priority of 32768 then switch A will be selected as the root bridge. If the network administrator would like to switch B to become the root bridge, they must set its priority to be less than 32768.

One switch wins and is elected as root bridge based on Bridge ID. Every port on Root Bridge is called are designated port. After the election of the root bridge, the next step is to elect the root port. The root port of a bridge is the port that is closest to the root bridge.

Every non-root bridge should have a root port. The election o root port on each non-root bridge is done via port cost and path cost.

Suppose we have 3 switches, switch 1 elected as the root bridge. Switch 2 has 2 paths to Root Bridge one is via port 1/1 and the other is via ½. But path via 1/1 is lowest than 1/2, so port 1/1 is elected as the root port.

Assume all switches ports are of 100 Mbps

Port cost of1/1 port = 1000/100 = 10

Path cost of 1/1 to root bridge = cost of port 1/1 n switch 1 + cost of port 1/1 on switch 2 = 10+10 = 20

Port cost of1/2 port = 1000/100 = 10

Path cost of 1/2 to root bridge = cost of port 1/2 n switch 1 + cost of port 1/1 on switch 3 + cost of 1/1 on switch 3 + cost of port ½ on switch 1 = 10+10+10+10=40

So the total path cost of 1/1 on switch 2 is lower than the cost of 1/2. So port 1/1 is elected as the root port. The other remaining port is called designated port i.e. port 1/2. The same thing applies to port 1/1 on switch 3. The port 1/1 is elected as the root port for switch 3.

After the election of root ports on each switch, the next step is the selection of designated ports. Since both ports on switch 2 and switch 3 are nearest Root Bridge and have equal cost there is a tie. To solve this tie we have to select one switch as a designated switch. The designated switch is selected based on Bridge ID. The switch with the lowest Bridge ID is elected as the designated switch. So in our case switch, 2 is the designated Bridge and port ½ on it is called a designated port. So the port on switch 3 is called Non-Root Port, which is always in a blocking state and which does not sends and receives data on that port thus preventing looping. This is how STP works in order to avoid looping.

Best Book To Learn CCNA – Crack Cisco Certification & Crack Interviews

Best Book To Learn Python – Path to Success in Programming

Important Terms of Spanning Tree Protocol

BPDU

BPDU (Bridge Protocol Data Unit) is a multicast frame that is used to share information about the switch and its interface connections. Switches use BPDU to learn the network topology, other switch connections, and any existing loops. BPDU frames are sent to us as multicast every two seconds.

Root Bridge

All decisions in STP are made from the perspective of the root bridge. Switch with the lowest switch ID is selected as the root bridge.

The selection process of the root bridge runs each time a network change occurs like adding a new switch in topology, removing the existing switch, or root bridge failure. If other switches in the network do not receive BPDUs from the root bridge within 20 seconds, they assume that the root bridge has failed and will begin a new election process to choose a new root bridge.

Non-Root Bridge

All other switches in the network except the root bridges are non-root bridges. The non-root bridge receives an update from the root bridge and updates its STP database.

Port Costs

STP assigns each port a cost, called port cost. Port cost is used to choose the best path when multiple links are available between two switches. The cost of the port is determined by the bandwidth of the connected media link. The switch always uses a lower port cost to forward the frame.

Path Costs

Path cost is an accumulated value of port costs from a root bridge to other switches in the network. It is always calculated from the root bridge. The default path cost at the root bridge is 0. When a connected switch receives BPDU, it increments path cost by adding the port cost value of its incoming port.

Root Port

The root port is a port that is directly connected with the root bridge or has the shortest path to the root bridge. The shortest path is a path that has the lowest path cost value. Remember that switch can go through many other switches to get the root. So it’s not always the shortest path but it is the fastest path that will be used.

Designated Port

Designated Port is the port that is selected as having the lowest port cost. A designated port would be marked as a forwarding port.

Non-Designated Port

Non-Designated Port is the port that is selected as having the highest port cost than the designated port. The non-Designated port would be marked as blocking the port.

Forwarding port

A forwarding port is used to forward the Frame.

Blocking Port

The blocking port remains disabled to remove loops.

The Spanning Tree Protocol (STP) prevents loops from forming in a switched network, but it does this task inefficiently by comparison with the processing capabilities of modern equipment. One big disadvantage of STP is the low convergence which is very important in switched networks. To overcome the  problem, in 2001, the IEEE with document 802.1w introduced an evolution of the Spanning Tree Protocol i.e. Rapid Spanning Tree Protocol (RSTP)

Rapid Spanning Tree Protocol (RSTP)

RSTP is the protocol that runs on the switch that is layer=2 or data link layer. RSTP provides significantly faster spanning-tree convergence after a topology change, introducing new convergence behaviors and bridge port role to do this. RSTP was designed to be backward-compatible with standard STP.

While STP can take 30 to 50 seconds to respond to a topology change, RSTP is typically able to respond to changes within 3 x Hello times i.e. default 3 times 2 seconds or within a few milliseconds of a physical link failure. The Hello Time is an important and configurable time interval that is used by RSTP for several purposes; its default value is 2 seconds.

RSTP bridge port roles

Root: A forwarding port that is the best port from a non-root bridge to the 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.

STP switch port state: There are only three port states left in RSTP that correspond to the three possible operational states.

Discarding: The port does not forward frames, process received frames or learns MAC addresses, but it does listen for BPDUs like the STP blocking state.

Learning: Received and transmits BPDUs and learns MAC addresses but does not yet forward frames the same as STP.

Forwarding: Receives and sends data, normal operation, learns MAC address, receives and transmits BPDUs the same as STP.

STP and RSTP States

rstp
rapid pvst

Solve Quiz and become expert in Networking

<==Access CCNA LAB’s for Free==>

I hope you find this article helpful, you can support us by donating just $1. It will really encourage us. EIHeducation


Leave a Reply

Your email address will not be published.