PracticeVideosBlogFlashcards

3.1 Layer 2 Loops and Root Bridge Election

Key Takeaways

  • Ethernet frames have no TTL, so a Layer 2 loop can circulate traffic and destabilize MAC learning.

  • The root is selected by lowest bridge identifier, with bridge priority compared before the MAC address.

  • RSTP supports rapid transitions when its link-type and synchronization requirements are met.

Last updated: October 2026

In enterprise campus networks, redundant physical links between switches are vital for high availability. However, redundant Layer 2 topologies inherently introduce the risk of switching loops if multiple active paths exist between segments.

The Anatomy of Layer 2 Loops

Unlike Layer 3 IPv4 or IPv6 packets, which contain a Time-to-Live (TTL) or Hop Limit header field decremented by each router, standard Ethernet frames lack any time-to-live mechanism. If an Ethernet frame enters a loop in a switched fabric, switches continue to flood it indefinitely until physical links saturate or hardware buffers exhaust. Layer 2 loops produce three catastrophic failure conditions:

  1. Broadcast Storms: When a host transmits a broadcast frame (such as an ARP request or DHCP Discover), every switch floods that frame out of all interfaces in the broadcast domain except the receiving port. In a loop, redundant switches receive the flooded frame and re-flood it back to the originating switch. This creates an exponential multiplication of circulating frames, driving link utilization to 100% and exhausting switch CPU resources.
  2. Multiple Frame Copies: An end host located on a looped segment receives duplicate copies of unicast or multicast frames arriving over alternating paths. Upper-layer protocols (such as TCP) must waste processing cycles handling duplicate sequence numbers, and unacknowledged UDP traffic can suffer severe application-level corruption.
  3. MAC Table Instability (MAC Thrashing): Switches dynamically learn source MAC addresses by binding the source MAC of incoming frames to the ingress physical interface. When duplicate frames circulate around a loop, the same source MAC arrives sequentially on different switch ports. The switch constantly rewrites its forwarding database (MAC address table), thrashing the table entries thousands of times per second. This prevents proper frame delivery and triggers pervasive unicast flooding throughout the VLAN.

Evolution: IEEE 802.1D (STP) vs. IEEE 802.1w (RSTP)

The Spanning Tree Protocol was invented by Radia Perlman and formalized in IEEE 802.1D. 802.1D creates a loop-free logical topology by calculating a spanning tree across all bridges, placing redundant switch ports into a blocking state while maintaining an active forwarding path. However, legacy 802.1D relies on conservative fixed timers, requiring 30 to 50 seconds to transition a blocked link into forwarding after a failure.

To overcome these convergence delays, the IEEE introduced IEEE 802.1w Rapid Spanning Tree Protocol (RSTP), later incorporated into the IEEE 802.1D-2004 standard. RSTP introduces active handshaking between adjacent switches on point-to-point links, achieving sub-second failover without waiting on passive timers. On Juniper Networks EX series switches running Junos OS, RSTP is the default spanning tree protocol enabled out-of-the-box on all Ethernet switching interfaces.


Bridge ID (BID) Architecture

Every switch running spanning tree is identified by an 8-byte (64-bit) Bridge Identifier (BID). The BID determines the relative priority of each switch in spanning tree elections:

ComponentSizeDescription
Bridge Priority4 bitsConfigurable in increments of 4,096. Ranges from 0 to 61,440. Default in Junos is 32,768.
System ID Extension12 bitsIdentifies the VLAN in per-VLAN trees or the MST instance in MSTP, allowing a single base MAC to represent multiple instances.
Bridge MAC Address48 bits (6 bytes)The hardware base MAC address assigned to the switch chassis/supervisor.

Because the first 2 bytes (16 bits) are split into a 4-bit priority multiplier and a 12-bit system ID extension (212=4,0962^{12} = 4,096), any configured bridge priority must be an exact multiple of 4,096 (0, 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 45056, 49152, 53248, 57344, 61440). If an engineer attempts to commit a non-multiple value, Junos rejects the configuration syntax.

[edit protocols rstp]
user@EX4300# set bridge-priority 4096

The Root Bridge Election Process

The spanning tree topology is organized hierarchically around a single central reference point: the Root Bridge. When switches boot, each switch initially presumes itself to be the Root Bridge and transmits Bridge Protocol Data Units (BPDUs) advertising its own BID as the Root ID.

The election evaluates BPDUs across the broadcast domain using a strict priority hierarchy:

  1. Lowest Bridge Priority: The switch with the lowest numeric priority value wins. A switch configured with priority 4096 beats switches configured with the default 32768.
  2. Lowest MAC Address Tiebreaker: If two or more switches share the exact same bridge priority, the election breaks the tie by selecting the switch with the numerically lowest base MAC address.

Once the Root Bridge is elected, all other switches in the broadcast domain become Non-Root Bridges and calculate the shortest loop-free path to that Root Bridge. When determining optimal paths and breaking ties across redundant interfaces, spanning tree uses four sequential criteria:

Lowest Root BID⟶Lowest Root Path Cost⟶Lowest Sender BID⟶Lowest Sender Port ID\text{Lowest Root BID} \longrightarrow \text{Lowest Root Path Cost} \longrightarrow \text{Lowest Sender BID} \longrightarrow \text{Lowest Sender Port ID}


Test Your Knowledge

In a network of Juniper EX switches running RSTP, two upstream switches have identical bridge priorities of 32768. Switch A has MAC address 00:05:85:11:22:33, while Switch B has MAC address 00:05:85:AA:BB:CC. Switch C has bridge priority 61440. Both switches connect to downstream Switch C with identical link speeds of 10 Gbps. Which switch becomes the Root Bridge, and why?

A

Switch A becomes the Root Bridge because it possesses the numerically lower MAC address when bridge priorities are tied.

B

Switch B becomes the Root Bridge because higher MAC addresses take precedence during election tiebreakers.

C

Switch C initiates a secondary election using interface port IDs to break the tie between Switch A and Switch B.

D

Both switches enter a split-brain condition until an administrator manually configures a lower priority on one switch.

Sections you finish are checked off in the contents.