For detailed descriptions of the parameters and features, see the sections STP parameters and STP features.
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
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.
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.
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 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.
device# copy running-config startup-config
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