Spanning Tree

From Best Practices

Jump to: navigation, search

Contents

Overview

The Spanning Tree protocol provides a loop free topology for any bridged LAN. The spanning tree protocol, which is also referred to as STP, is defined in the IEEE Standard 802.1D. Spanning tree is based on an algorithm invented by Radia Perlman while working for Digital Equipment Corporation. As the name suggests, it findes a spanning tree within the mesh formed by the network installer and desable links that are not part of that tree.

If more than one path were to be active at once, then there would be several problems. First, broadcast storm caused by broadcast packets looping between switches would reduce available CPU overhead and bandwidth. Second, the traditional source-based location system used by switches would fail to operate correctly. However, a good network design should include spare (redundant)links to provide an alternate path if one fails.

Reminder

Before speaking about best practice in using Spanning Tree, it is necessary to understand its mode of operation.

Spanning proceed in the following manner:

  • Elect a root bridge (the root of the tree).
  • Find least cost (measured as the sum of all traversed port cost) path to root bridge.
  • Disable links that are not part of those path.

Electing the root bridge

Each switch has a MAC address and a configurable priority number; both of these numbers make up the Bridge Identification or BID. The BID is used to elect the root bridge based uzpon the lowest priority number; if this is a tie, then the numerical lowest MAC address wins. Because it is next to imposssible that two MAC adddresses will be the same (they are uniquely assigned), one switch should always be successfully elected as the root bridge with the switch that has the next lowest priority/cost acting as a secondary (backup) root bridge. Other switches in the network that use spanning tree will use the same algorithmic process to calculate the shortest path to the root bridge and so produce a loop free topology where multiple paths to the root bridge exist.

Bridge Protocol Data Units (BPDUs)

BIDs and other Spanning Tree Protocol information are carried in special data frames called Briddge Protocol Data Unit (BPDUs). PBDUs are exchanged regularly (every 2 seconds by default) and enable switches to keep track of network changes and activate or disable ports as required. When a device is first attached to a switch port, it will not immediately start to forward data. It will instead go through a number of states while processing PBDUs and determine the topology of the network. When a host is attached, such as a computer, printer or server, the port will always go into forwarding mode, albeit after a delay od about 50 seconds while it goes through the listening and learning state. However, if instead another switch is connected, the port may remain in blocking mode it it is determined that is would cause a loop in the network. Topology Change Notification (TCN) BPBUs are used to inform other switches of port changes. TCNs are injected into the network by a non-root switch and propagated to the root. Upon receival of the TCN, the root switch will set a Topology Change flag in its normal BPDUs. This flag is propagated to all other switches to instruct them to rapidly age out their forwarding table entries.

STP switch port mode

  • Listening. The switch processes BPDUs and determines the network topology.
  • Learning. The switch builds a switching table that maps MAC addresses to port number.
  • Blocking. A port that would cause a switching loop is blocvked, no user data is sent or received but it may go into forwarding mode if the trunk link in used where to fail. BPDU data is still received in blocking mode.
  • Forwarding. A port receiving and sending data, normal operation.
  • DIsabled. Not strictly part of STP, a network administrator can manually disable a port.

To prevent the delay when connecting hosts to a switch, Rapid Spanning tree was developped and standardised by IEEE 802.1w, which allows a switch port to go inmmediately into forwarding mode when a end device is attached.

Best practice to design and configure spanning tree

Spanning tree is a non deterministic protocol: this means that the convergence time is not known. Another issue of STP concerns side effect with Per VLSN spanning tree. When a concergence process is ongoing for a dedicated VLAN, it has also impact to other VLANs not being converging: this is due to the the CPU load necesary during the convergence process as well as to the fact ports are shared, as loops can quickly hapened during convergenge process.

Therefore, some bests practice have to be applied when designing spanning tree:

  • First of all, if spanning tree can be avoided, avoid it.
  • Never let spanning deciding alone where to put the root bridge. Configure yourself, manually, the priority of the primary and backup root bridge.
  • Put the root bridge as close as the heart of the network (near to the WAN routers).
  • Make sure other switches have a much higher priority than the primary and secondary root bridge.
  • Avoid complex topologies: if you can, try simple or dual stars with only one level topologies.
  • Don't mix IP routing protocols with Spanning Tree: this may lead to network unstabilities and flapping which is very difficult to troubleshoot.

Recommendation on spanning tree usage with IP Telephony

Most of IP Telephony devices are very sensitive to loss of connectivity to their call manager or voice hub. When it hapened, they try to reconnect to backup systems: in most case, all current calls are brought down, and the end users have to re-establish their call. The same mechanism occurs when switching back from the backup system to the primary one.

The consequence of this sensitivity is that re-routing has to be quicker than IP Telephony time-out. As spanning tree is non deterministic, it is better to avoid it.

Personal tools
Google AdSense