Enabling and configuring R-PVST+ on an interface

The ports and parameters can be configured individually on a system by:
  1. Entering the commands in steps 1-3
  2. Running the relevant addition steps and parameter commands
  3. Verifying the result
  4. Saving the configuration

For detailed descriptions of the parameters and features, see the sections STP parameters and STP features.

  1. Enter global configuration mode.
    device# configure terminal
    
  2. Enable R-PVST+.
    device(config)# protocol spanning-tree rpvst
    
  3. Enter interface configuration mode.
    device(config-rpvst)# interface ethernet 0/3
    
  4. Enable the spanning tree on the interface.
    device(conf-if-eth-0/3)# no spanning-tree shutdown
    
  5. Configure the interface link type.
    device(conf-if-eth-0/3)# spanning-tree link-type point-to-point
    
  6. Specify the port priority to influence the selection of root or designated ports.
    device(conf-if-eth-0/3)# spanning-tree priority 64
    
    The range of priority values is from 0 through 240 in multiples of 16. The default value is 128.
  7. Configure the path cost for spanning tree calculations on the interface.
    device(conf-if-eth-0/3)# spanning-tree cost 200000
    
    The lower the path cost means a greater chance that the interface becomes the root port. The range is 1 through 200000000. The default path cost is assigned as per the port speed.
  8. Configure the path cost for spanning tree calculations a specific VLAN.
    device(conf-if-eth-0/3)# spanning-tree vlan 10 cost 10000 
    
    The lower the path cost means a greater chance that the interface becomes the root port. The range is 1 through 200000000. The default path cost is assigned as per the port speed.
  9. Enable automatic edge detection on the interface.
    device(conf-if-eth-0/3)# spanning-tree autoedge
    

    You use this command to automatically identify the edge port. A port becomes an edge port if it receives no BPDUs. By default, automatic edge detection is disabled.

  10. Enable root guard on the interface.
    device(conf-if-eth-0/3)# spanning-tree guard root
    

    Root guard protects the root bridge from malicious attacks and unintentional misconfigurations where a bridge device that is not intended to be the root bridge becomes the root bridge.

  11. Enable the spanning tree on the edge port.
    device(conf-if-eth-0/3)# spanning-tree edgeport
    
    If BPDUs are received on a port fast enabled interface, the interface loses the edge port status unless it receives a shutdown or no shutdown command.
  12. Enable BPDU guard on the interface.
    device(conf-if-eth-0/3)# spanning-tree edgeport bpdu-guard
    
    BPDU guard removes a node that reflects BPDUs back in the network. It enforces the STP domain borders and keeps the active topology predictable by not allowing any network devices behind a BPDU guard-enabled port to participate in STP.
  13. Return to privileged EXEC mode.
    device(conf-if-eth-0/3)# exit
    
  14. Verify the configuration.
    device# show spanning-tree brief
    
     Spanning-tree Mode: Rapid PVST Protocol
    
          Root ID      Priority 4096
                       Address 768e.f805.5800
                       Hello Time 8, Max Age 25, Forward Delay 20
    
          Bridge ID    Priority 4096
                       Address 768e.f805.5800
                       Hello Time 8, Max Age 25, Forward Delay 20
    
     Interface    Role  Sts  Cost       Prio  Link-type     Edge
     ------------------------------------------------------------
     Eth 0/3      DES   FWD  200000     128   P2P            No
     

    Observe that the settings comply with the formula set out in the STP parameters section, as:

    (2 × (forward delay - 1)) ≥ maximum age ≥ (2 × (hello time + 1))

    or in this case: 38 ≥ 25 ≥ 18.

  15. Save the configuration.
    device# copy running-config startup-config
    

R-PVST+ on an interface configuration example

device# configure terminal
device(config)# protocol spanning-tree rpvst
device(config-rpvst)# interface ethernet 0/3
device(conf-if-eth-0/3)# no spanning-tree shutdown
device(conf-if-eth-0/3)# spanning-tree link-type point-to-point
device(conf-if-eth-0/3)# spanning-tree priority 64
device(conf-if-eth-0/3)# spanning-tree cost 200000
device(conf-if-eth-0/3)# spanning-tree vlan 10 cost 10000 
device(conf-if-eth-0/3)# spanning-tree autoedge
device(conf-if-eth-0/3)# spanning-tree guard root
device(conf-if-eth-0/3)# spanning-tree edgeport
device(conf-if-eth-0/3)# spanning-tree edgeport bpdu-guard
device(conf-if-eth-0/3)# exit
device# show spanning-tree 
device# copy running-config startup-config