Spanning-Tree

802.1D or STP is used to help provide a loop-free network. Possible states:

•Disabled: port is admin down
•Blocking: port is enabled but not forwarding traffic
•Listening: the switch has moved from a blocking state and can send and receive BPDU’s
•Learning: the port can now modify the MAC address table with traffic it receives
•Forwarding: the port can forward all network traffic
•Broken: a configuration or operational problem with the port

spanning-tree path cost comes into modes short and long short-mode allows up to unique path costs up to 20Gbps and long-mode unique path costs up to 10Tbps

Spanning tree pathcost  method long

This command must be configured on every device in the layer 2 topology

Root election by default will use the lowest MAC in the environment.

•This can be overridden by setting the priority of the root bridge.
•If a switch receives an inferior BPDU it will disregard it
•If a switch receives a BPDU that is preferred it will update its BPDU to include the new root bridge

The following command allow you to see information to verify the root bridge

Switch#sh spanning-tree root

                                        Root    Hello Max Fwd
Vlan                   Root ID          Cost    Time  Age Dly  Root Port
---------------- -------------------- --------- ----- --- ---  ------------
VLAN0001             1 001d.7034.8100         4    2   20  15  Gi0/1
VLAN0002             2 001d.7034.8100         4    2   20  15  Gi0/1
VLAN0003         32771 aca0.1649.5d80         0    2   20  15

The following process is used to determine which ports should be blocked between 2 non-root bridges 1. The interface is a designated port 2. The switch with the lowest path cost to the root will win 3. The system priority of the local switch compared to the priority of the remote switch traffic is blocked if the remote switch is lower 4. The system MAC of the local switch is compared to the remote switch. Traffic is blocked if the remote switch is lower

command to help track topology changes

Switch#show spanning-tree detail | i ieee|from|occur|exec
VLAN0001 is executing the rstp compatible Spanning Tree protocol
  Number of topology changes 6 last change occurred 2w4d ago
          from GigabitEthernet1/0/4
VLAN0002 is executing the rstp compatible Spanning Tree protocol
  Number of topology changes 3 last change occurred 3w5d ago
          from GigabitEthernet1/0/24

802.1W RSTP Rapid Spanning Tree Possible states:

•Discarding: port is enabled but not forwarding any traffic.
•Learning: the port can now modify the MAC address table with traffic it receives
•Forwarding: the port can forward all network traffic

Port types: Edge port: a port where a host connects and cannot form a loop. Directly correlates to spanning-tree port fast being enabled. Root port: port with the best path cost to the root bridge Point to point: any port that connects to another RSTP switch with full duplex