5.1 Basic STP Operations
5.1.6 Four-step STP decision sequence
When creating a loop-free logical topology, Spanning Tree always uses the same four-step decision sequence:
  • Lowest root BID
  • Lowest path cost to root bridge
  • Lowest sender BID
  • Lowest port ID

Bridges pass Spanning-Tree information between themselves using special frames known as bridge protocol data units (BPDUs). A bridge uses this four-step decision sequence to save a copy of the "best" BPDU seen on every port. When making this evaluation, it considers all the BPDUs received on the port as well as the BPDU that would be sent on that port. As every BPDU arrives, it is checked against this four-step sequence to see if it is more attractive (that is, lower in value) than the existing BPDU saved for that port. If the new BPDU (or the locally generated BPDU) is more attractive, the old value is replaced.

Additionally, this "saving-the-best-BPDU" process also controls the sending of BPDUs. When a bridge first becomes active, all of its ports are sending BPDUs every 2 seconds (when using the default timer values). However, if a port hears a BPDU from another bridge that is more attractive than the BPDU it has been sending, the local port stops sending BPDUs. If the more attractive BPDU stops arriving from a neighbor for a period of time (20 seconds by default), the local port can once again resume sending BPDUs.