The Wayback Machine - https://web.archive.org/web/20241008131753/https://www.geeksforgeeks.org/root-bridge-election-in-spanning-tree-protocol/
Open In App

Root Bridge Election in Spanning Tree Protocol

Last Updated : 16 Jun, 2022
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Redundant links are used to provide a backup path when one link goes down but a Redundant link can sometimes cause switching loops. The main purpose of Spanning Tree Protocol (STP) is to ensure that you do not create loops when you have redundant paths in your network. 

Spanning Tree Protocol (STP) – 
As IEEE STP is used to make a loop-free network by monitoring the network to track all the links and shut down the redundant ones. These are some important terms related to Spanning Tree Protocol: 

 

  • Bridge Priority Data Unit (BPDU) – It contains the Bridge ID, Sender’s Bridge ID, Cost to the Root Bridge, Timer values on Root Bridge. All switches exchange BPDU in order to elect root bridge. The switch with the lowest Bridge ID become the root bridge.
  • Bridge ID – It is an 8-byte field that is a combination of bridge priority (2 bytes) and Base Mac address (6 bytes) of a device. If there is a tie on bridge priority then the Base Mac address is considered.
  • Bridge Priority – It is a priority, which is assigned to every switch, 32768 by default.
  • Root Bridge – The root bridge is the bridge with the lowest Bridge ID. All the decisions like which ports are the root ports (the port with the best path to the root bridge) are made from the perspective of the root bridge.
  • Path cost – A switch may encounter one or more switches in the path to the root bridge. All the paths are analyzed and the path with the lowest cost will be selected. 
     
Speed Link Cost
10 Mbps 100
100 Mbps 19
1 Gbps 4
10 Gbps 2

Designated port – The port which sends the best BPDU i.e ports on the root bridge will be in a forwarding state. 
Root port – The port which receives the best BPDU on a non-root bridge. Criteria for selecting root port: 
 

  1. Lowest path cost to reach the root bridge
  2. Lowest sender bridge ID
  3. Lowest sender port ID

(Port priority + Port number) – Port priority is by default 128 and port number is the switch interface number. 

Election procedure – 
All the switches in the network declare themselves root bridges and start exchanging their own BPDU. The BPDU with the lowest bridge ID is considered as superior. Now the switch receiving the superior BPDU makes changes in its own BPDU and carries forward to its neighbours. It changes the value of root Bridge ID with its superior BPDU bridge ID. This process goes on until all the switches are satisfied with which bridge has the lowest bridge ID and hence that switch will be declared as the root bridge. 

Now according to the criteria, the root ports will be selected and then the port left will be in blocking mode. 

Example – 

 

Here is a small topology with three switches switch A (mac address-0000.0ACA7.A603), switch B(0030.F222.2794), and switch C(000A.41D5.7937) with all having default priority (32768). 

Root Bridge election – 
As all the switches have default priority therefore there is a tie on the basis of priority. Now, the switch with the lowest Mac address will become a root bridge. Here, switch A will become the root bridge as it has the lowest Mac address. Therefore, the ports of switch A will be in forwarding state i.e designated port. 

 

Root Ports Election – 
The root ports are selected on non-root bridges, i.e. switch B and switch C. Now, for instance, if switch C choose the path through switch B then the cost will be (4+4=8) but if it chooses the directly connected path to switch A then the cost will be 4, therefore, both switch B and switch C will choose the ports connected to switch A as their root ports. 

Now, the only thing left is to find which port will be in forwarding mode and blocking mode respectively. Now as the link between switch B and switch C has the same cost as the root bridge, therefore, the switch with the lowest bridge I’d be in forwarding mode therefore switch C port will be in forwarding mode and switch B port will be in block mode.
 


Previous Article
Next Article

Similar Reads

Difference between Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP)
Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP), are designed to avoid network loops in Ethernet. It provide loop-free logical topology. They were both designed to provide network reliability and particularly avoid broadcast radiation, but the major differences are on the rate, functionality and versatility. In this article we
5 min read
Difference between Transparent Bridge and Source Routing Bridge
A bridge is a networking device that connects two or more Local Area Networks (LANs) to form a single extended network. It operates at the data link layer of the OSI model facilitating communication between different network segments.In this article we will see difference between Transparent Bridge and Source Routing Bridge in detail. What is Trans
5 min read
Types of Spanning Tree Protocol (STP)
Prerequisite - Spanning Tree Protocol Spanning Tree Protocol (STP) is used to make a loop free network by monitoring the network to track all the links and shut down the least redundant ones. Root bridge is a switch in a single VLAN or whole topology (according to the type of STP standard used) which is responsible for distributing BPDUs and block
3 min read
What is MSTP(Multiple Spanning Tree Protocol)?
The Multiple Spanning Tree Protocol (MSTP) and algorithm, gives both straightforward and full network doled out to any given Virtual LAN (VLAN) all through a Bridged Local Area Network. MSTP employments BPDUs to trade data between spanning-tree consistent gadgets, to avoid circles in each MSTI (Multiple Spanning Tree Instances) and within the CIST
2 min read
Working of Spanning Tree Protocol (STP)
Spanning Tree Protocol (STP) prevents the looping of the frame by putting the interfaces of the switch in either forwarding or blocking state. How Switch is able to decide which interface should be in forwarding or blocking state. We’ll learn the answer to this question in this article. Before we further proceed, we must know some terms. BID – It s
3 min read
Introduction of Spanning Tree Protocol (STP)
In a LAN, redundant links are added to improve the network availability of LAN. But these redundant links may cause the frame to loop in the network for an infinite time until some action is taken, e.g, some links are taken down. To cope with the problem of frame looping, Spanning Tree Protocol (STP) comes into play. Need for Spanning Tree: Conside
3 min read
How Spanning Tree Protocol (STP) Select Designated Port?
Spanning tree protocol is a type of communication protocol that functions to build a loop-free topology, which means the arrangement of elements in a computer network. STP commonly works for layer-2 bridges and switches. It also provides a backup link for the network system if the active link fails. Layer-2 devices send the data in the form of fram
3 min read
Rapid Spanning Tree Protocol
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) pr
5 min read
Topology Changes in Spanning Tree Protocol (STP)
Spanning Tree Protocol (STP) is used to prevent loops in the network due to redundant connections between switches in the network. It determines an efficient path from non-root switches to root switches with the help of Bridge Protocol Data Unit (BPDUs). BPDU carries information regarding topology changes within the network to notify all the switch
4 min read
Configuring Spanning Tree Protocol Portfast
Spanning Tree Protocol is a data link layer or layer-2 protocol whose prime objective is to prevent loops in the different network configurations or network topologies. It tracks all the links and closes the redundant ones. It uses the spanning tree algorithm(STA) to create a topology database and then search out the redundant links to disable them
5 min read
What is Bridge Protocol Data Unit (BPDU) Frame?
Bridge Protocol Data Unit is fundamentally a tree traversed convention which portrays each message of the organization with the various sorts of characteristics on the organization like the MAC address or the IP address utilizing distinctive switch ports present on the organization. The Spanning Tree Protocol (STP) can empower and impair every one
4 min read
Types of Bridge Protocol Data Unit(BPDUs)
Bridge Protocol Data Units (BPDUs) are the messages that are transmitted across LAN networks to enable switches to participate in Spanning Tree Protocol (STP) by gathering information about each other. It contains information regarding switch ports such as port ID, port priority, port cost, and MAC addresses. A switch sends BPDUs from their origin
4 min read
Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
Hot Standby Router Protocol (HSRP) is a CISCO proprietary protocol used to provide redundancy in a network. Only one router is the active router while others will be in standby state i.e the standby router will be responsible for forwarding the traffic when the active router fails. Virtual Router Redundancy Protocol (VRRP) is an open standard proto
3 min read
Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) in Data Link Layer
Layer 2 or the Datalink layer provides physical addressing and access to media. It defines how data is to be formatted for transmission and how access to the network is to be controlled. It also provides error detection, ensuring data on higher layers is formatted correctly for transmission. Cisco Discovery Protocol (CDP) and Link Layer Discovery P
2 min read
Difference between Stop and Wait protocol and Sliding Window protocol
Both the Stop and Wait protocol and the Sliding Window protocol are the techniques to the solution of flow control handling. The main difference between the Stop-and-wait protocol and the Sliding window protocol is that in the Stop-and-Wait Protocol, the sender sends one frame and waits for acknowledgment from the receiver whereas in the sliding wi
5 min read
Difference between Border Gateway Protocol (BGP) and Routing Information Protocol (RIP)
When dealing with network routing, it's crucial to understand the various protocols that help direct traffic across complex networks. Two significant protocols in this space are the Border Gateway Protocol (BGP) and the Routing Information Protocol (RIP). Each serves different purposes and operates under different principles. This article explores
5 min read
Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
Data transfer is the most common task in network and system communications, and they involve transfer of files using two means i.e the File Transfer Protocol (FTP) and the Secure File Transfer Protocol (SFTP). FTP is a commonly applied protocol that enables files to be transferred through a network from one computer to another, but FTP is unsecure
5 min read
Difference between Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP)
SLIP and PPP, which are the widely used serial connection techniques, help to connect the distant devices of the network. The fullform of SLIP is Session Layer Internetworking Protocol. SLIP being a primitive protocol put into use during the early connections to the Internet, when there was not much overhead. PPP is slightly more complex as the pro
6 min read
Spanning Tree Topology (STP) Convergence
Once the Spanning Tree Topology (STP) is established, STP continues to work until some changes occurs. Manual changes that Network Engineer can apply are configuration of Bridge ID and port costs. Also there are other changes like the addition of switch or failure of port of an existing switch. The reaction of STP when some changes occurs by reconf
2 min read
Spanning Tree Port States
Spanning tree protocol prevent looping of frames around LAN by placing ports of switch in different states based on the criteria such as selection of root switch, switch's root cost, etc. There are five Spanning Tree Port States : 1. Blocking State : Switch port enters the blocking state at time of election process, when a switch receives a BPDU on
3 min read
Spanning Tree Path Cost Value
Prerequisite: Introduction of Spanning Tree ProtocolWorking of Spanning Tree ProtocolTypes of Spanning Tree ProtocolSpanning Tree Protocol (STP) is used to prevent loops in the network due to redundant connections between switches in the network. It determines a unique and shortest path from non-root switches to root switches with the help of Bridg
3 min read
Difference between Hub and Bridge
Prerequisite - Network Devices Hub: Hub is a networking device that is used to transmit the signal to each port (except one port) to respond from which the signal was received. Hub is operated on the Physical layer. In this packet filtering is not available. It is of two types: Active Hub, Passive Hub. Bridge: Bridge is also a network device that i
2 min read
Difference between Bridge and Router
Prerequisite - Network Devices Bridge is a network device, which works in data link layer. Through bridge, data or information is not stored and sent in the form of packets. Whereas Router is also a network device which works in network layer. Through router, data or information is stored and sent in the form of packets. The main difference between
2 min read
Does a Bridge Divide a Network into Smaller Sections?
Answer : No, a bridge connects two or more network segments, extending the network rather than dividing it into smaller sections.Bridge connects different network segments to facilitate communication between them. Bridge FunctionalityA bridge operates at the data link layer (Layer 2) of the OSI model and examines the MAC addresses of incoming data
1 min read
What is Bridge in Computer Network - Types, Uses, Functions & Differences
The bridge is a networking device in a computer network that is used to connect multiple LANs to a larger LAN. In computer networks, we have multiple networking devices such as bridges, hubs, routers, switches, etc, each device has its own specification and is used for a particular purpose. The bridge is a networking device that connects the larger
6 min read
Network Devices (Hub, Repeater, Bridge, Switch, Router, Gateways and Brouter)
Network Devices: Network devices, also known as networking hardware, are physical devices that allow hardware on a computer network to communicate and interact with one another. For example Repeater, Hub, Bridge, Switch, Routers, Gateway, Brouter, and NIC, etc. 1. Repeater - A repeater operates at the physical layer. Its job is to amplifies (i.e.,
6 min read
Difference between Switch and Bridge
Switches and bridges are devices used to connect multiple devices within a network. Both devices are the network connectivity devices used to connect different segments of a network. Switches and bridges works at different layers of the OSI (Open Systems Interconnection) model and operates to manage data traffic efficiently, reduce network congesti
4 min read
Difference between Bridge and Repeater
Bridge and Repeater are two improtant connectivity devices in computer network. Both devices ensure seamless communication between the segments of a network. These devices are a type of network extender, but they operate at different layers in the OSI and serve different purposes. In this article we will see difference between bridge and repeater.
3 min read
Difference between Bridge and Gateway
When setting up a network, understanding the difference between a bridge and a gateway is crucial. Both are devices that facilitate data communication but function differently depending on network requirements. A bridge connects two or more networks at the data link layer, whereas a gateway operates at a higher layer to connect different network pr
3 min read
MAC Protocol Used in Wireless Sensor Networks
Pre-requisites: Classification of MAC Protocols In Wireless Sensor Networks (WSNs), the Medium Access Control (MAC) protocol is a set of guidelines that dictate how each node should transmit data over the shared wireless medium. The primary objective of the MAC protocol is to minimize the occurrence of idle listening, over-hearing, and collisions o
6 min read
Article Tags :