Home » STP | Spanning Tree Protocol

STP | Spanning Tree Protocol

by Online Tutorials Library

Spanning Tree Protocol

The spanning tree protocol is also known as STP. It is a protocol that monitors the overall performance of the network. The main task of the spanning tree protocol is to remove the redundant link. This protocol uses the Spanning tree algorithm (STA), which is used to detect the redundant link. The STA maintains the topology database that is used to find the redundant links. If the redundant link is found, then the link gets disabled. Once the redundant links are removed, then only those links will remain active which are chosen by the STA. If a new link is added or some existing link is removed, then the STA will be re-executed to adjust the changes.

Before understanding the spanning tree protocol, we first looked at the complete graph and spanning tree.

A complete graph is a graph in which a line connects each pair of vertices. In other words, we can say that all the points are connected by a maximum number of lines. In computer networking, the complete graph can also be said as a fully meshed network.

Let’s understand the complete graph through an example.

Suppose there are three points, i.e., A, B, and C. Three lines connect these three points. A line connects every two-point, and we get a complete graph.

Spanning Tree Protocol

The complete graph is formed when a maximum number of lines connects all the points, whereas the spanning tree is formed when a minimum number of lines connects all the points.

From the above complete graph, we can get three spanning trees.

Spanning Tree Protocol

  1. A is directly connected to B and C, while B and C are indirectly connected through A. In this spanning tree, A is a central point and all the points are connected without any formation of loops.
  2. B is directly connected to A and C, while A and C are connected through B. B is a bridge between A and C, or we can say that B is a central point. In this case, also, all the points are connected without any formation of loops.
  3. C is directly connected to both A and B, while A and B are connected through C. Therefore, C is a bridge between A and B, and C is a central point. In this case, all the points are connected without any formation of loops.

Till now, we have observed two basic features of spanning-tree:

  • It does not contain any loop.
  • It is minimally connected.

What is a spanning tree protocol?

The spanning tree protocol is a layer 2 protocol that tends to solve the problems when the computers use the shared telecommunications paths on a local area network. When they share the common path, if all the computers send the data simultaneously, it affects the overall network performance and brings all the network traffic near a halt.

The spanning tree protocol (STP) overcomes this situation by using the concept of bridge looping. Bridge looping is used when there are multiple connections between the two endpoints, and messages are sent continuously, which leads to the flooding of the network. To remove the looping, STP divides the LAN network into two or more segments with the help of a device known as bridges. The bridge is used to connect the two segments so when the message is sent, the message is passed through the bridge to reach the intended destination. The bridge determines whether the message is for the same segment or a different segment, and it works accordingly. This network segmentation greatly reduces the chances of a network coming to a halt.

How spanning tree protocol works?

The following are the steps that spanning tree protocol uses:

  • This protocol selects one switch as a root bridge where the root bridge is a central point as when the message is sent; then it always passes through the bridge.
  • It selects the shortest path from a switch to the root bridge.
  • It blocks the links that cause the looping on a network, and all the blocked links are maintained as backups. It can also activate the blocked links whenever the active link fails. Therefore, we can say that it also provides fault tolerance on a network.

Ports in STP

There are five ports used in STP:

  • Root port: The root port is a port that has the lowest cost path to the root bridge.
  • Designated port: The designated port is a port that forwards the traffic away from the root bridge.
  • Blocking port: The blocking port is a port that receives the frames, but it neither forwards nor sends the frames. It simply drops the received frames.
  • Backup port: The backup port is a port that provides the backup path in a spanning
  • tree if a designated port fails. This port gets active immediately when the designated port fails.

  • Alternate port: The alternate port is a port that provides the alternate path to the root bridge if the root bridge fails.

Let’s understand through an example.

Spanning Tree Protocol

Suppose there are four switches A, B, C, and D on a local area network. There are redundant links that exist among these interconnected devices. In the above figure, there are two paths that exist, i.e., DBA and DCA. Link redundancy is good for network availability, but it creates layer 2 loops. The question arises “how network blocks the unwanted links to avoid the loops without destroying the link redundancy?”. The answer to this question is STP. First, STP chooses one switch as a root bridge. In the above case, A switch is chosen as a root bridge. Next, other switches select the path to the root bridge, having the least path cost. Now we look at the switch B. For switch B, there are two paths that exist to reach switch A (root bridge), i.e., BDCA and BA. The path BDCA costs 7 while the path BA costs 2. Therefore, path BA is chosen to reach the root bridge. The port at switch B is selected as a root port, and the other end is a designated port. Now we look at the switch C. From switch C, there are two paths that exist, i.e., CDBA and CA. The least-cost path is CA, as it costs 1. Thus, it is selected as a root port, and the other end is selected as a designated port. Now we look at the switch D. For switch D, there are two paths that exist to reach switch A, i.e., DBA and DCA. The path DBA costs 4 while the DCA costs 5. Therefore, path DBA is chosen as it has the least cost path. The port on D is selected as a root port, and on the other end, switch B is selected as a designated port. In this example, we have observed that the root bridge can contain many designated ports, but it does not contain a root port.


Next TopicOSPF Protocol

You may also like