Spanning Tree Protocol Configuration
This chapter contains a complete sample STP configuration. STP prevents duplication of packets by eliminating loops in the network. 
Topology
The following example is a simple multi-bridge topology.
STP Topology
Note:	Run the switchport command on each port to change to Layer-2 mode.
Configurations
Bridge 1
 
| Bridge1#configure terminal | Enter configure mode. | 
| Bridge1(config)#bridge 1 protocol ieee | Add a bridge (1) to the spanning tree table | 
| Bridge1(config)#interface eth2 | Enter interface mode. | 
| Bridge1(config-if)#bridge-group 1  | Associate the interface with bridge group 1. | 
| Bridge1(config-if)#exit | Exit interface mode. | 
| Bridge1(config)#interface eth3 | Enter interface mode. | 
| Bridge1(config-if)#bridge-group 1 | Associate the interface with bridge group 1. | 
| Bridge1(config-if)#exit | Exit interface mode. | 
| Bridge1(config)#interface eth4 | Enter interface mode. | 
| Bridge1(config-if)#bridge-group 1 | Associate the interface with bridge group 1. | 
| Bridge1(config-if)#exit | Exit interface mode. | 
| Bridge1(config)#interface eth5 | Enter interface mode | 
| Bridge1(config-if)#bridge-group 1 | Associate the interface with bridge group 1. | 
Bridge 2
 
| Bridge2#configure terminal | Enter configure mode. | 
| Bridge2(config)#bridge 2 protocol ieee | Add a bridge (2) to the spanning tree table | 
| Bridge2(config)#interface eth2 | Enter interface mode. | 
| Bridge2(config-if)#bridge-group 2  | Associate the interface with bridge group 2. | 
| Bridge2(config-if)#exit | Exit interface mode. | 
| Bridge2(config)#interface eth3 | Enter interface mode. | 
| Bridge2(config-if)#bridge-group 2 | Associate the interface with bridge group 2. | 
| Bridge2(config-if)#exit | Exit interface mode. | 
| Bridge2(config)#interface eth4 | Enter interface mode. | 
| Bridge2(config-if)#bridge-group 2 | Associate the interface with bridge group 2. | 
| Bridge2(config-if)#exit | Exit interface mode. | 
| Bridge2(config)#interface eth5 | Enter interface mode | 
| Bridge2(config-if)#bridge-group 2 | Associate the interface with bridge group 2. | 
Bridge 4
 
| Bridge4#configure terminal | Enter configure mode. | 
| Bridge4(config)#bridge 4 protocol ieee | Add a bridge (4) to the spanning tree table | 
| Bridge4(config)#interface eth2 | Enter interface mode. | 
| Bridge4(config-if)#bridge-group 4  | Associate the interface with bridge group 4. | 
| Bridge4(config-if)#exit | Exit interface mode. | 
| Bridge4(config)#interface eth3 | Enter interface mode. | 
| Bridge4(config-if)#bridge-group 4 | Associate the interface with bridge group 4. | 
| Bridge4(config-if)#exit | Exit interface mode. | 
| Bridge4(config)#interface eth4 | Enter interface mode. | 
| Bridge4(config-if)#bridge-group 4 | Associate the interface with bridge group 4. | 
| Bridge4(config-if)#exit | Exit interface mode. | 
| Bridge4(config)#interface eth5 | Enter interface mode | 
| Bridge4(config-if)#bridge-group 4 | Associate the interface with bridge group 4. | 
Bridge 3
 
| Bridge3#configure terminal | Enter configure mode. | 
| Bridge3(config)#bridge 3 protocol ieee | Add a bridge (3) to the spanning tree table | 
| Bridge3(config)#interface eth2 | Enter interface mode. | 
| Bridge3(config-if)#bridge-group 3  | Associate the interface with bridge group 3. | 
| Bridge3(config-if)#exit | Exit interface mode. | 
| Bridge3(config)#interface eth3 | Enter interface mode. | 
| Bridge3(config-if)#bridge-group 3 | Associate the interface with bridge group 3. | 
Validation
show spanning-tree, show spanning-tree interface <if-name>
Bridge 1
#show spanning-tree
% 1: Bridge up - Spanning Tree Enabled  - topology change detected
% 1: Root Path Cost 0 - Root Port 0 -  Bridge Priority 32768
% 1: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
% 1: Root Id 8000525400244323
% 1: Bridge Id 8000525400244323
% 1: last topology change Mon Mar  4 11:40:41 2019
% 1: 20 topology change(s)  - last topology change Mon Mar  4 11:40:41 2019
 
% 1: portfast bpdu-filter disabled
% 1: portfast bpdu-guard disabled
% 1: portfast errdisable timeout disabled
% 1: portfast errdisable timeout interval 300 sec
%   eth1: Port Number 3 - Ifindex 3 - Port Id 0x8003 - Role Designated - State Forwarding
%   eth1: Designated Path Cost 0
%   eth1: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth1: Designated Port Id 0x8003 - Priority 128  -
%   eth1: Root 8000525400244323
%   eth1: Designated Bridge 8000525400244323
%   eth1: Message Age 0 - Max Age 20
%   eth1: Hello Time 2 - Forward Delay 15
%   eth1: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
%   eth1: forward-transitions 1
%   eth1: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
%   eth1: No portfast configured - Current  portfast off
%   eth1: bpdu-guard  default  - Current bpdu-guard off
%   eth1: bpdu-filter default  - Current bpdu-filter off
%   eth1: no root guard configured     - Current root guard off
%   eth1: Configured Link Type point-to-point - Current point-to-point
%   eth1: No auto-edge configured - Current port Auto Edge off
%
%   eth2: Port Number 4 - Ifindex 4 - Port Id 0x8004 - Role Designated - State Forwarding
%   eth2: Designated Path Cost 0
%   eth2: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth2: Designated Port Id 0x8004 - Priority 128  -
%   eth2: Root 8000525400244323
%   eth2: Designated Bridge 8000525400244323
%   eth2: Message Age 0 - Max Age 20
%   eth2: Hello Time 2 - Forward Delay 15
%   eth2: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 1 - topo change timer 0
%   eth2: forward-transitions 1
%   eth2: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
%   eth2: No portfast configured - Current  portfast off
%   eth2: bpdu-guard  default  - Current bpdu-guard off
%   eth2: bpdu-filter default  - Current bpdu-filter off
%   eth2: no root guard configured     - Current root guard off
%   eth2: Configured Link Type point-to-point - Current point-to-point
%   eth2: No auto-edge configured - Current port Auto Edge off
%
%   eth3: Port Number 5 - Ifindex 5 - Port Id 0x8005 - Role Designated - State Forwarding
%   eth3: Designated Path Cost 0
%   eth3: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth3: Designated Port Id 0x8005 - Priority 128  -
%   eth3: Root 8000525400244323
%   eth3: Designated Bridge 8000525400244323
%   eth3: Message Age 0 - Max Age 20
%   eth3: Hello Time 2 - Forward Delay 15
%   eth3: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 1 - topo change timer 0
%   eth3: forward-transitions 1
%   eth3: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
%   eth3: No portfast configured - Current  portfast off
%   eth3: bpdu-guard  default  - Current bpdu-guard off
%   eth3: bpdu-filter default  - Current bpdu-filter off
%   eth3: no root guard configured     - Current root guard off
%   eth3: Configured Link Type point-to-point - Current point-to-point
%   eth3: No auto-edge configured - Current port Auto Edge off
%
%   eth4: Port Number 6 - Ifindex 6 - Port Id 0x8006 - Role Designated - State Forwarding
%   eth4: Designated Path Cost 0
%   eth4: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth4: Designated Port Id 0x8006 - Priority 128  -
%   eth4: Root 8000525400244323
%   eth4: Designated Bridge 8000525400244323
%   eth4: Message Age 0 - Max Age 20
%   eth4: Hello Time 2 - Forward Delay 15
%   eth4: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
%   eth4: forward-transitions 1
%   eth4: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
%   eth4: No portfast configured - Current  portfast off
%   eth4: bpdu-guard  default  - Current bpdu-guard off
%   eth4: bpdu-filter default  - Current bpdu-filter off
%   eth4: no root guard configured     - Current root guard off
%   eth4: Configured Link Type point-to-point - Current point-to-point
%   eth4: No auto-edge configured - Current port Auto Edge off
%
#
 
#show spanning-tree interface eth1
% 1: Bridge up - Spanning Tree Enabled  - topology change detected
% 1: Root Path Cost 0 - Root Port 0 -  Bridge Priority 32768
% 1: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
% 1: Root Id 8000525400244323
% 1: Bridge Id 8000525400244323
% 1: last topology change Mon Mar  4 11:40:41 2019
% 1: 20 topology change(s)  - last topology change Mon Mar  4 11:40:41 2019
 
% 1: portfast bpdu-filter disabled
% 1: portfast bpdu-guard disabled
% 1: portfast errdisable timeout disabled
% 1: portfast errdisable timeout interval 300 sec
%   eth1: Port Number 3 - Ifindex 3 - Port Id 0x8003 - Role Designated - State Forwarding
%   eth1: Designated Path Cost 0
%   eth1: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth1: Designated Port Id 0x8003 - Priority 128  -
%   eth1: Root 8000525400244323
%   eth1: Designated Bridge 8000525400244323
%   eth1: Message Age 0 - Max Age 20
%   eth1: Hello Time 2 - Forward Delay 15
%   eth1: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 1 - topo change timer 0
%   eth1: forward-transitions 1
%   eth1: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
%   eth1: No portfast configured - Current  portfast off
%   eth1: bpdu-guard  default  - Current bpdu-guard off
%   eth1: bpdu-filter default  - Current bpdu-filter off
%   eth1: no root guard configured     - Current root guard off
%   eth1: Configured Link Type point-to-point - Current point-to-point
%   eth1: No auto-edge configured - Current port Auto Edge off
#
Bridge 2
#show spanning-tree
% 2: Bridge up - Spanning Tree Enabled  - topology change detected
% 2: Root Path Cost 20000 - Root Port 3 -  Bridge Priority 32768
% 2: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
% 2: Root Id 8000525400244323
% 2: Bridge Id 8000525400d15789
% 2: last topology change Mon Mar  4 11:40:43 2019
% 2: 11 topology change(s)  - last topology change Mon Mar  4 11:40:43 2019
 
% 2: portfast bpdu-filter disabled
% 2: portfast bpdu-guard disabled
% 2: portfast errdisable timeout disabled
% 2: portfast errdisable timeout interval 300 sec
%   eth1: Port Number 3 - Ifindex 3 - Port Id 0x8003 - Role Rootport - State Forwarding
%   eth1: Designated Path Cost 0
%   eth1: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth1: Designated Port Id 0x8003 - Priority 128  -
%   eth1: Root 8000525400244323
%   eth1: Designated Bridge 8000525400244323
%   eth1: Message Age 0 - Max Age 20
%   eth1: Hello Time 2 - Forward Delay 15
%   eth1: Forward Timer 0 - Msg Age Timer 4 - Hello Timer 0 - topo change timer 0
%   eth1: forward-transitions 1
%   eth1: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
%   eth1: No portfast configured - Current  portfast off
%   eth1: bpdu-guard  default  - Current bpdu-guard off
%   eth1: bpdu-filter default  - Current bpdu-filter off
%   eth1: no root guard configured     - Current root guard off
%   eth1: Configured Link Type point-to-point - Current point-to-point
%   eth1: No auto-edge configured - Current port Auto Edge off
%
%   eth2: Port Number 4 - Ifindex 4 - Port Id 0x8004 - Role Alternate - State Discarding
%   eth2: Designated Path Cost 0
%   eth2: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth2: Designated Port Id 0x8004 - Priority 128  -
%   eth2: Root 8000525400244323
%   eth2: Designated Bridge 8000525400244323
%   eth2: Message Age 0 - Max Age 20
%   eth2: Hello Time 2 - Forward Delay 15
%   eth2: Forward Timer 0 - Msg Age Timer 4 - Hello Timer 1 - topo change timer 0
%   eth2: forward-transitions 0
%   eth2: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
%   eth2: No portfast configured - Current  portfast off
%   eth2: bpdu-guard  default  - Current bpdu-guard off
%   eth2: bpdu-filter default  - Current bpdu-filter off
%   eth2: no root guard configured     - Current root guard off
%   eth2: Configured Link Type point-to-point - Current point-to-point
%   eth2: No auto-edge configured - Current port Auto Edge off
%
%   eth3: Port Number 5 - Ifindex 5 - Port Id 0x8005 - Role Designated - State Forwarding
%   eth3: Designated Path Cost 20000
%   eth3: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth3: Designated Port Id 0x8005 - Priority 128  -
%   eth3: Root 8000525400244323
%   eth3: Designated Bridge 8000525400d15789
%   eth3: Message Age 1 - Max Age 20
%   eth3: Hello Time 2 - Forward Delay 15
%   eth3: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
%   eth3: forward-transitions 1
%   eth3: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
%   eth3: No portfast configured - Current  portfast off
%   eth3: bpdu-guard  default  - Current bpdu-guard off
%   eth3: bpdu-filter default  - Current bpdu-filter off
%   eth3: no root guard configured     - Current root guard off
%   eth3: Configured Link Type point-to-point - Current point-to-point
%   eth3: No auto-edge configured - Current port Auto Edge off
%
%   eth4: Port Number 6 - Ifindex 6 - Port Id 0x8006 - Role Designated - State Forwarding
%   eth4: Designated Path Cost 20000
%   eth4: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth4: Designated Port Id 0x8006 - Priority 128  -
%   eth4: Root 8000525400244323
%   eth4: Designated Bridge 8000525400d15789
%   eth4: Message Age 1 - Max Age 20
%   eth4: Hello Time 2 - Forward Delay 15
%   eth4: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
%   eth4: forward-transitions 1
%   eth4: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
%   eth4: No portfast configured - Current  portfast off
%   eth4: bpdu-guard  default  - Current bpdu-guard off
%   eth4: bpdu-filter default  - Current bpdu-filter off
%   eth4: no root guard configured     - Current root guard off
%   eth4: Configured Link Type point-to-point - Current point-to-point
%   eth4: No auto-edge configured - Current port Auto Edge off
%
Bridge 3
#show spanning-tree
% 3: Bridge up - Spanning Tree Enabled  - topology change detected
% 3: Root Path Cost 0 - Root Port 0 -  Bridge Priority 32768
% 3: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
% 3: Root Id 80005254000835af
% 3: Bridge Id 80005254000835af
% 3: last topology change Mon Mar  4 11:39:11 2019
% 3: 2 topology change(s)  - last topology change Mon Mar  4 11:39:11 2019
 
% 3: portfast bpdu-filter disabled
% 3: portfast bpdu-guard disabled
% 3: portfast errdisable timeout disabled
% 3: portfast errdisable timeout interval 300 sec
%   eth1: Port Number 3 - Ifindex 3 - Port Id 0x8003 - Role Designated - State Forwarding
%   eth1: Designated Path Cost 0
%   eth1: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth1: Designated Port Id 0x8003 - Priority 128  -
%   eth1: Root 80005254000835af
%   eth1: Designated Bridge 80005254000835af
%   eth1: Message Age 0 - Max Age 20
%   eth1: Hello Time 2 - Forward Delay 15
%   eth1: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
%   eth1: forward-transitions 1
%   eth1: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
%   eth1: No portfast configured - Current  portfast off
%   eth1: bpdu-guard  default  - Current bpdu-guard off
%   eth1: bpdu-filter default  - Current bpdu-filter off
%   eth1: no root guard configured     - Current root guard off
%   eth1: Configured Link Type point-to-point - Current point-to-point
%   eth1: No auto-edge configured - Current port Auto Edge off
%
%   eth2: Port Number 4 - Ifindex 4 - Port Id 0x8004 - Role Designated - State Forwarding
%   eth2: Designated Path Cost 0
%   eth2: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth2: Designated Port Id 0x8004 - Priority 128  -
%   eth2: Root 80005254000835af
%   eth2: Designated Bridge 80005254000835af
%   eth2: Message Age 0 - Max Age 20
%   eth2: Hello Time 2 - Forward Delay 15
%   eth2: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
%   eth2: forward-transitions 1
%   eth2: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
%   eth2: No portfast configured - Current  portfast off
%   eth2: bpdu-guard  default  - Current bpdu-guard off
%   eth2: bpdu-filter default  - Current bpdu-filter off
%   eth2: no root guard configured     - Current root guard off
%   eth2: Configured Link Type point-to-point - Current point-to-point
%   eth2: No auto-edge configured - Current port Auto Edge off
%
 
Bridge 4
#show spanning-tree
% 4: Bridge up - Spanning Tree Enabled  - topology change detected
% 4: Root Path Cost 40000 - Root Port 3 -  Bridge Priority 32768
% 4: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
% 4: Root Id 8000525400244323
% 4: Bridge Id 8000525400b83253
% 4: last topology change Mon Mar  4 11:40:40 2019
% 4: 3 topology change(s)  - last topology change Mon Mar  4 11:40:40 2019
 
% 4: portfast bpdu-filter disabled
% 4: portfast bpdu-guard disabled
% 4: portfast errdisable timeout disabled
% 4: portfast errdisable timeout interval 300 sec
%   eth1: Port Number 3 - Ifindex 3 - Port Id 0x8003 - Role Rootport - State Forwarding
%   eth1: Designated Path Cost 20000
%   eth1: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth1: Designated Port Id 0x8005 - Priority 128  -
%   eth1: Root 8000525400244323
%   eth1: Designated Bridge 8000525400d15789
%   eth1: Message Age 1 - Max Age 20
%   eth1: Hello Time 2 - Forward Delay 15
%   eth1: Forward Timer 0 - Msg Age Timer 5 - Hello Timer 1 - topo change timer 0
%   eth1: forward-transitions 1
%   eth1: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
%   eth1: No portfast configured - Current  portfast off
%   eth1: bpdu-guard  default  - Current bpdu-guard off
%   eth1: bpdu-filter default  - Current bpdu-filter off
%   eth1: no root guard configured     - Current root guard off
%   eth1: Configured Link Type point-to-point - Current point-to-point
%   eth1: No auto-edge configured - Current port Auto Edge off
%
%   eth2: Port Number 4 - Ifindex 4 - Port Id 0x8004 - Role Alternate - State Discarding
%   eth2: Designated Path Cost 20000
%   eth2: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth2: Designated Port Id 0x8006 - Priority 128  -
%   eth2: Root 8000525400244323
%   eth2: Designated Bridge 8000525400d15789
%   eth2: Message Age 1 - Max Age 20
%   eth2: Hello Time 2 - Forward Delay 15
%   eth2: Forward Timer 0 - Msg Age Timer 5 - Hello Timer 0 - topo change timer 0
%   eth2: forward-transitions 0
%   eth2: Version Rapid Spanning Tree Protocol - Received RSTP - Send RSTP
%   eth2: No portfast configured - Current  portfast off
%   eth2: bpdu-guard  default  - Current bpdu-guard off
%   eth2: bpdu-filter default  - Current bpdu-filter off
%   eth2: no root guard configured     - Current root guard off
%   eth2: Configured Link Type point-to-point - Current point-to-point
%   eth2: No auto-edge configured - Current port Auto Edge off
%
%   eth3: Port Number 5 - Ifindex 5 - Port Id 0x8005 - Role Designated - State Forwarding
%   eth3: Designated Path Cost 40000
%   eth3: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth3: Designated Port Id 0x8005 - Priority 128  -
%   eth3: Root 8000525400244323
%   eth3: Designated Bridge 8000525400b83253
%   eth3: Message Age 2 - Max Age 20
%   eth3: Hello Time 2 - Forward Delay 15
%   eth3: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 1 - topo change timer 0
%   eth3: forward-transitions 1
%   eth3: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
%   eth3: No portfast configured - Current  portfast off
%   eth3: bpdu-guard  default  - Current bpdu-guard off
%   eth3: bpdu-filter default  - Current bpdu-filter off
%   eth3: no root guard configured     - Current root guard off
%   eth3: Configured Link Type point-to-point - Current point-to-point
%   eth3: No auto-edge configured - Current port Auto Edge off
%
%   eth4: Port Number 6 - Ifindex 6 - Port Id 0x8006 - Role Designated - State Forwarding
%   eth4: Designated Path Cost 40000
%   eth4: Configured Path Cost 20000  - Add type Explicit ref count 1
%   eth4: Designated Port Id 0x8006 - Priority 128  -
%   eth4: Root 8000525400244323
%   eth4: Designated Bridge 8000525400b83253
%   eth4: Message Age 2 - Max Age 20
%   eth4: Hello Time 2 - Forward Delay 15
%   eth4: Forward Timer 0 - Msg Age Timer 0 - Hello Timer 0 - topo change timer 0
%   eth4: forward-transitions 1
%   eth4: Version Rapid Spanning Tree Protocol - Received None - Send RSTP
%   eth4: No portfast configured - Current  portfast off
%   eth4: bpdu-guard  default  - Current bpdu-guard off
%   eth4: bpdu-filter default  - Current bpdu-filter off
%   eth4: no root guard configured     - Current root guard off
%   eth4: Configured Link Type point-to-point - Current point-to-point
%   eth4: No auto-edge configured - Current port Auto Edge off
%
#