Spanning Tree Protocol & Rapid Spanning Tree Protocol commands

SW1#debug spanning-tree events
      ~shows the STP events and they are triggered

SW1(config-if)#spanning-tree vlan 3 cost 2      
      ~changes the cost associated with the interface, if the modification changes the cost lower than the current root port then a new designated port is created.

SW1(config-if)#spanning-tree vlan 3 root primary
      ~promotes the switch to the vlan root bridge and updates the BPDU frame to update other switches

SW1(config-if)#spanning-tree vlan 3 root secondary
      ~tells a switch to use a BAE priority value so that the local switch will become root if the primary root switch fails.

SW1(config-if)#spanning-tree portfast
      ~Enables portfast on the interface, port fast bypasses the STP set up allowing the client to immediately sent frames and packets

SW1(config-if)#spanning-tree bpduguard enable
     ~protects the port from switching loops and lower end switches from causing loops

SW1(config-if)#spanning-tree bpdufilter enable
     ~enables a filter that blocks all BPDU frames from being received and sent on that interface