Follow these steps to enable STP and STP features on an interface.
For detailed descriptions of the parameters and features, see the sections STP parameters and STP features.
device# configure terminal
device(config)# interface ethernet 0/20
device(conf-if-eth-0/20)# no shutdown
device(conf-if-eth-0/20)# spanning-tree cost 10000
device(conf-if-eth-0/20)# spanning-tree port-fast bpdu-guard
device(conf-if-eth-0/20)# spanning-tree guard root
device(conf-if-eth-0/20)# spanning-tree link-type point-to-point
device(conf-if-eth-0/20)# spanning-tree priority 64
device# show spanning-tree brief Spanning-tree Mode: Spanning Tree 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/2 DES FWD 2000 128 P2P No Eth 0/20 DES FWD 1000 64 P2P No Eth 0/25 DIS DIS 20000000 128 P2P No Eth 0/30 DIS DIS 20000000 128 P2P No Eth 0/31 DIS DIS 2000000 128 P2P No
Note
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# show running-config interface ethernet 0/20 interface ethernet 0/20 switchport switchport mode access switchport access val 1 spanning-tree cost 1000 spanning-tree guard root spanning-tree link-type point-to-point spanning-tree portfast bpdu-guard spanning-tree priority 64
device# copy running-config startup-config
device# configure terminal device(config)# interface ethernet 0/20 device(conf-if-eth-0/20)# no shutdown device(conf-if-eth-0/20)# spanning-tree cost 10000 device(conf-if-eth-0/20)# spanning-tree port-fast bpdu-guard device(conf-if-eth-0/20)# spanning-tree guard root device(conf-if-eth-0/20)# spanning-tree link-type point-to-point device(conf-if-eth-0/20)# spanning-tree priority 64 device(conf-if-eth-0/20)# end device# show spanning-tree brief device# copy running-config startup-config