Spanning-Tree Protocol When booted up, all switches declare themselves as the root bridge. They send Hello packets every 2 seconds to adjacent switches. Each switch compares the BID in the Hello packets to their own BID value. The BID is determined by the priority (default 32768). The switch with the lowest priority becomes the root bridge. If all priorities are the same value, the switch with the lowest MAC address becomes the root bridge. Every non-root bridge has one and only one root port which is going toward the root bridge. A designated port is an active port connected to a root port on a switch. (The opposite end of every root port is a designated port.) All ports on a root bridge are designated ports. Why do we need STP? To stop loops due to redundancy at layer 2 Layer 3 uses Time-To-Live counter, but layer 2 doesn’t have anything like that Bridge ID Consists of MAC address and priority Default priority is 32768 Priority is always multiples of 4096 Every switch will have one root port EXCEPT the root bridge. The root bridge will have all designated ports. Switch Diameter – number of switches a frame will have to travel through to go between the two farthest points within a broadcast domain. Port priority 0 - 240 (default 128) Spanning-tree port-priority priority-number 5 Port States of STP: Blocking – nondesignated and does not participate in forwarding Listening – nondesignated but sends and receives BPDU’s to determine if it is a better route than something else Learning – preparing to participate in frame forwarding, building MAC address table Forwarding – part of the active topology and forwards frames, sends and receives BPDUs Disabled – administratively shut down Timers: Hello Time – time between each BPDU frame sent on a port - default 2 seconds Forward Delay – time spent in listening and learning states - default is 15 seconds for BOTH states Maximum Age – maximum length of time a switch port saves configuration BPDU information – default 20 seconds First compare Bridge IDs to find your root bridge. All the ports of the root bridge will be designated ports Next, find the root ports on the other switches Root ports are the closest to the root bridge (closest meaning least-cost path) Any port in the path of a root port is designated When there are two paths from a switch that have equal cost, the path going through the switch with the lowest BID will win Determine which ports are blocked.