Spanning-tree

My first day of study: it’s a spanning-tree day! Most of the information is a fresh-up from the CCNP course, but still very usefull to know. Below a summary of some key-parts of spanning-tree, rapid-spanning-tree and mst.   
Spanning-tree bridge ID format   
The “old” version of spanning-tree, also known as 802.1d, uses the following bridge ID format:   
   
The priority is a 2 bytes (16 bits) field with all possible values between 0 and 65535. The MAC address is used as a tiebraker.   
   
In the “new” format, the 16 bits field has been split up into 2 fields: a priority (a multiple of 4096) and a System-ID-Extension field. This field is being used for holding the VLAN ID. The MAC address is still used as a tie braker. Important to know is about the priority field: because of using a multiple of 4096, the first 4 bits of the possible 16 bits (as used in the original format) changes at every multiply, so this added the possibility for use the other 12 bits for the System-ID-Extension field. This all creates the possibility to use pvst (because of these “new” 12 bits)   
The format looks like this:   
   
Spanning-tree ports   
After electing the root bridge, every switch needs to detect his root port. The root switch sends a hello packet every 2 seconds (hello timer). Each switch that receives a hello, forwards this hello out of all his ports after he updates the cost, forwarding switch ID, forwarders port priority and forwarders port number. (blocked ports do not forward Hello’s). Of all ports receiving hello’s, the port with the least calculated costs will be used as the root port. To determing the total cost of the path to the core, the switch adds the costs listed in the Hello’s to the local switch port costs on which the Hello was received. Important: lower cost = better!   
A root port is usally connected to a designated port (DP) on a other switch. To be a DP, that specific port needs to send out Hello’s with the lowest advertised cost to the root bridge.   
Updating CAM   
When a new STP calculation occurs, some parts of the CAM table (mac address table) could be false. To update the CAM:   

  • all switches need to be notified to time out the CAM entry
  • Each switch needs to use the short timer (forward delay timer(15 secs)) to time out these CAM entries.

On a topology change, not all switches will notice this change. To get informed, the switch who notifies a down link is sending a TCN (topology change notification) out of his root port for every 2 seconds (Hello timer) untill a ack is received. The next switch sends a ack back by setting the TCA bit (Topology Change acknowledge) in the Hello packet. This procedure goes on untill the TCN is received by the root bridge. The root bridge sets the TC (Topology Change)  on the next Hello’s. A switch who receives a Hello with the TC bit relays this BPDU so that every switch is aware of the topology change.  This switch uses the forward delay timer to time out entries in the CAM. This allows the switch to age out MAC address faster then the default 300 sec’s. This process continues untill the switch nog longer receives TC’s (the root bridge sends TC’s for a time of: forward delay + max age timer) 
For a port to transistion from blocking to forwarding, it has to pass these stats:   

  1. Blocking
  2. Listening
  3. Learning
  4. Forwarding

So, in summary: when a topology change occurs: any switch who changes the root port or designated port sends a TCN packet (BPDU) to the root bridge.   
Root bridge selection
The following five criteria will be used as a decision-making process for choosing the Root Bridge

  1. Lowest root bridge ID
  2. Lowest path cost to the root bridge
  3. Lowest sender bridge ID
  4. Lowest port priority
  5. Lowest port ID

Also important to know: STP selects only onle designated port per segment to forward traffic. Al other ports do not forward to prevent loops.
Portfast   
Portfast can be used at access ports (with ONLY pc’s connected) to skip the spanning-tree states. The port transistions directly to forwarding.   
Uplinkfast   
When using uplinkfast, all uplink ports connected to the same destination are grouped together in a “uplink group”. When the RP goes down, a other member of the uplink group takes the RP over (in approx 5 secs).   
Backbone fast   
Backbone fast is being used for faster recovery from indirect link failures. When a RP goes down, that switch switch can sends out “I wanna be root” packets. The next switch detects these packets and sends a inferior packet back, so that switch stops sending these BPDU’s and recovers faster from the topology change: the switch does not have to wait the maxage timer.   
Rapid spanning-tree   
Rapid-spanning-tree is a enhanced 802.1d standard. The differences:   

  • Only waits for 3 missed Hello’s instead of 10 Hello’s (maxage timer)
  • Transitioning from disabled state to learning state (skipping the Listening state)
  • uses some other port types

    
 The root port is still the “best” port to the Root bridge. The Alternated port is used as a “backup root port”. The Backup port is being used as a “backup backup root port”.   
Multiple Spanning-trees   
Last, but definatly not least: MST.   
A main reason for using MST is a benefit in STP instances: VLAN spanning-tree instances can be grouped together into one MST instance which consumes less processing power on the switches.   
A group of switches that uses MST (typically a part of your network) uses a MST region. This region appears as a single switch to the not-MST switches in the rest of your network. To appear as a single switch to the not-MST world, the MST switch switches use an other STP instance: Internal Spanning Tree (IST). This proces handles the STP proces between the MST region and the other “outside world” of STP.   
Configuring   
Configuring STP is pretty easy:
To enable per-vlan-spanning-tree for a particular VLAN, use the command:

spanning-tree vlan 50

To change the bridge priority for a VLAN:

Spanning-tree vlan 50 priority XXX

or

Spanning-tree vlan 50 root

for setting a priority of 24576.
Enabling backbone fast or uplinkfast is being done in the global configuration mode:

Spanning-tree backbonefast
Spanning-tree uplinkfast

MST can be configured as follows:

Spanning-tree mode mst
Spanning-tree mode mst configuration
        name <max 32 bit name>
        revision <number>
        instance <id> vlan <range>

3 comments

  • I’ve not long completed my CCNA exam and now studying properly to understand the finer workings of spanning-tree.Your article on spanning tree for me was very informative and straight to the point, thanks 🙂

  • When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same comment related with “female viagra tablets“. Is there any way you can remove me from that service? Bless you!

  • I like what you guys are up too. Such clever work and reporting! Carry on the excellent works guys Iˇve incorporated you guys to my blogroll. I think it’ll improve the value of my website 🙂

Leave a Reply

Your email address will not be published.