Follow this example to configure basic STP behavior.
device# configure terminal
device(config)# protocol spanning-tree stp
device(config-stp)# description stp1
device(conf-stp)# bridge-priority 28672
device(config-stp)# forward-delay 20
device(config-stp)# max-age 25
device(config-stp)# hello-time 8
device(config-stp)# error-disable-timeout enable
device(config-stp)# error-disable-timeout interval 60
device(config)# interface ethernet 0/1 device(conf-if-eth-0/1)# spanning-tree portfast device(conf-if-eth-0/1)# exit
device(config)# interface ethernet 0/2 device(conf-if-eth-0/2)# spanning-tree portfast device(conf-if-eth-0/2)# exit
device(config)# interface ethernet ...
device(config)# interface ethernet 0/1 device(conf-if-eth-0/1)# spanning-tree priority 1 device(conf-if-eth-0/1)# exit
device(config)# interface ethernet 0/12 device(conf-if-eth-0/12)# no shutdown device(conf-if-eth-0/12)# spanning-tree guard root
device(conf-if-eth-0/12)# end
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/1 DES FWD 2000 128 P2P No Eth 0/2 DES FWD 2000 128 P2P No Eth 0/12 DES FWD 2000 128 P2P No
(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 stp device(config-stp)# description stp1 device(conf-stp)# bridge-priority 28672 device(config-stp)# forward-delay 20 device(config-stp)# max-age 25 device(config-stp)# hello-time 8 device(config-stp)# error-disable-timeout enable device(config-stp)# error-disable-timeout interval 60 device(config)# interface ethernet 0/1 device(conf-if-eth-0/1)# spanning-tree portfast device(conf-if-eth-0/1)# exit device(config)# interface ethernet 0/2 device(conf-if-eth-0/2)# spanning-tree portfast device(conf-if-eth-0/2)# exit device(config)# interface ethernet 0/1 device(conf-if-eth-0/1)# spanning-tree priority 1 device(conf-if-eth-0/1)# exit device(config)# interface ethernet 0/12 device(conf-if-eth-0/12)# no shutdown device(conf-if-eth-0/12)# spanning-tree guard root device(conf-if-eth-0/12)# end device# show spanning-tree brief device# copy running-config startup-config