OcNOS DC : Layer 2 Guide : Layer 2 Configuration Guide : Spanning Tree Protocol Configuration
Spanning Tree Protocol Configuration
This chapter contains a complete sample Spanning Tree Protocol (STP) configuration.
Spanning Tree Protocol (STP) is a network protocol that ensures a loop-free topology for Ethernet networks. The basic function of STP is to prevent bridge loops. Spanning tree also allows a network design to include redundant links to provide automatic backup paths if an active link fails, thus, eliminating the need to manually enable or disable the backup links.
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)#commit
Commit the transaction.
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)#commit
Commit the transaction.
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)#commit
Commit the transaction.
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.
Bridge1(config-if)#commit
Commit the transaction.
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)#commit
Commit the transaction.
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)#commit
Commit the transaction.
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)#commit
Commit the transaction.
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.
Bridge2(config-if)#commit
Commit the transaction.
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)#commit
Commit the transaction.
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.
Bridge1(config-if)#commit
Commit the transaction.
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)#commit
Commit the transaction.
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.
Bridge4(config-if)#commit
Commit the transaction.
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)#commit
Commit the transaction.
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.
Bridge3(config-if)#commit
Commit the transaction.
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 19 - Root Port 6 - Bridge Priority 32768
1: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
1: Root Id 800052540046f549
1: Bridge Id 80005254009cb7e6
1: last topology change Tue Aug 11 02:25:01 2020
1: 30 topology change(s) - last topology change Tue Aug 11 02:25:01 2020
1: portfast bpdu-filter disabled
1: portfast bpdu-guard disabled
eth2: Port Number 4 - Ifindex 4 - Port Id 0x8004 -State Blocked
eth2: Designated Path Cost 19
eth2: Configured Path Cost 19 - Add type Explicit ref count 1
eth2: Designated Port Id 0x8004 - Priority 128 -
eth2: Root 800052540046f549
eth2: Designated Bridge 8000525400751db5
eth2: Message Age 1 - Max Age 20
eth2: Hello Time 2 - Forward Delay 15
eth2: Forward Timer 0 - Msg Age Timer 4 - Hello Timer 0 - topo change timer 0
eth3: Port Number 5 - Ifindex 5 - Port Id 0x8005 - State blocked
eth3: Designated Path Cost 19
eth3: Configured Path Cost 19 - Add type Explicit ref count 1
eth3: Designated Port Id 0x8005 - Priority 128 -
eth3: Root 800052540046f549
eth3: Designated Bridge 8000525400751db5
eth3: Message Age 1 - Max Age 20
eth3: Hello Time 2 - Forward Delay 15
eth3: Forward Timer 0 - Msg Age Timer 3 - Hello Timer 0 - topo change timer 0
eth3: forward-transitions 3
eth3: Restricted-role OFF
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 Rootport-State Forwarding
eth4: Designated Path Cost 0
eth4: Configured Path Cost 19 - Add type Explicit ref count 1
eth4: Designated Port Id 0x8006 - Priority 128 -
eth4: Root 800052540046f549
eth4: Designated Bridge 800052540046f549
eth4: Message Age 0 - Max Age 20
eth4: Hello Time 2 - Forward Delay 15
eth4: Forward Timer 0 - Msg Age Timer 3-Hello Timer 0 - topo changen timer 0
eth4: forward-transitions 6
eth4: Restricted-role OFF
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
eth5: Port Number 7 - Ifindex 7 - Port Id 0x8007 - State Blocked
eth5: Designated Path Cost 19
eth5: Configured Path Cost 19 - Add type Explicit ref count 1
eth5: Designated Port Id 0x8004 - Priority 128 -
eth5: Root 800052540046f549
eth5: Designated Bridge 800052540065fd8c
eth5: Message Age 1 - Max Age 20
eth5: Hello Time 2 - Forward Delay 15
eth5: Forward Timer 0 - Msg Age Timer 3 - Hello Timer 0 - topo change timer 0
eth5: forward-transitions 4
eth5: Restricted-role OFF
eth5: No portfast configured - Current portfast off
eth5: bpdu-guard default - Current bpdu-guard off
eth5: bpdu-filter default - Current bpdu-filter off
eth5: no root guard configured - Current root guard off
eth5: Configured Link Type point-to-point - Current point-to-point
eth5: 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 19 - Root Port 7 - Bridge Priority 32768
2: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
2: Root Id 800052540046f549
2: Bridge Id 8000525400751db5
2: last topology change Tue Aug 11 02:25:00 2020
2: 22 topology change(s) - last topology change Tue Aug 11 02:25:00 2020
2: portfast bpdu-filter disabled
2: portfast bpdu-guard disabled
eth2: Port Number 4-Ifindex 4-Port Id 0x8004-Role Designated-State Forwarding
eth2: Designated Path Cost 19
eth2: Configured Path Cost 19 - Add type Explicit ref count 1
eth2: Designated Port Id 0x8004 - Priority 128 -
eth2: Root 800052540046f549
eth2: Designated Bridge 8000525400751db5
eth2: Message Age 1 - 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 3
eth2: Restricted-role OFF
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 19
eth3: Configured Path Cost 19 - Add type Explicit ref count 1
eth3: Designated Port Id 0x8005 - Priority 128 -
eth3: Root 800052540046f549
eth3: Designated Bridge 8000525400751db5
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 3
eth3: Restricted-role OFF
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 ---State Blocked
eth4: Designated Path Cost 0
eth4: Configured Path Cost 19 - Add type Explicit ref count 1
eth4: Designated Port Id 0x8007 - Priority 128 -
eth4: Root 800052540046f549
eth4: Designated Bridge 800052540046f549
eth4: Message Age 0 - Max Age 20
eth4: Hello Time 2 - Forward Delay 15
eth4: Forward Timer 0-Msg Age Timer 4-Hello Timer 0-topo change timer 0
eth4: forward-transitions 3
eth4: Restricted-role OFF
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
eth5: Port Number 7-Ifindex 7-Port Id 0x8007-Role Rootport-State Forwarding
eth5: Designated Path Cost 0
eth5: Configured Path Cost 19 - Add type Explicit ref count 1
eth5: Designated Port Id 0x8004 - Priority 128 -
eth5: Root 800052540046f549
eth5: Designated Bridge 800052540046f549
eth5: Message Age 0 - Max Age 20
eth5: Hello Time 2 - Forward Delay 15
eth5: Forward Timer 0-Msg Age Timer 4-Hello Timer 0-topo change timer 0
eth5: forward-transitions 2
eth5: Restricted-role OFF
eth5: No portfast configured - Current portfast off
eth5: bpdu-guard default - Current bpdu-guard off
eth5: bpdu-filter default - Current bpdu-filter off
eth5: no root guard configured - Current root guard off
eth5: Configured Link Type point-to-point - Current point-to-point
eth5: 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 19 - Root Port 5 - Bridge Priority 32768
3: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
3: Root Id 800052540046f549
3: Bridge Id 800052540065fd8c
3: last topology change Tue Aug 11 02:25:00 2020
3: 16 topology change(s) - last topology change Tue Aug 11 02:25:00 2020
3: portfast bpdu-filter disabled
3: portfast bpdu-guard disabled
eth2: Port Number 4-Ifindex 4-Port Id 0x8004-Role Designated-State Forwarding
eth2: Designated Path Cost 19
eth2: Configured Path Cost 19 - Add type Explicit ref count 1
eth2: Designated Port Id 0x8004 - Priority 128 -
eth2: Root 800052540046f549
eth2: Designated Bridge 800052540065fd8c
eth2: Message Age 1 - 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 2
eth2: Restricted-role OFF
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 Rootport - State Forwarding
eth3: Designated Path Cost 0
eth3: Configured Path Cost 19 - Add type Explicit ref count 1
eth3: Designated Port Id 0x8005 - Priority 128 -
eth3: Root 800052540046f549
eth3: Designated Bridge 800052540046f549
eth3: Message Age 0 - Max Age 20
eth3: Hello Time 2 - Forward Delay 15
eth3: Forward Timer 0 - Msg Age Timer 3 - Hello Timer 0 - topo change timer 0
eth3: forward-transitions 2
eth3: Restricted-role OFF
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
 
Bridge 4
#show spanning-tree
4: Bridge up - Spanning Tree Enabled - topology change detected
4: Root Path Cost 0 - Root Port 0 - Bridge Priority 32768
4: Forward Delay 15 - Hello Time 2 - Max Age 20 - Transmit Hold Count 6
4: Root Id 800052540046f549
4: Bridge Id 800052540046f549
4: last topology change Tue Aug 11 02:24:58 2020
4: 6 topology change(s) - last topology change Tue Aug 11 02:24:58 2020
4: portfast bpdu-filter disabled
4: portfast bpdu-guard disabled
eth2: Port Number 4-Ifindex 4-Port Id 0x8004-Role Designated-State Forwarding
eth2: Designated Path Cost 0
eth2: Configured Path Cost 19 - Add type Explicit ref count 1
eth2: Designated Port Id 0x8004 - Priority 128 -
eth2: Root 800052540046f549
eth2: Designated Bridge 800052540046f549
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: Restricted-role OFF
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 19 - Add type Explicit ref count 1
eth3: Designated Port Id 0x8005 - Priority 128 -
eth3: Root 800052540046f549
eth3: Designated Bridge 800052540046f549
eth3: Message Age 0 - 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: Restricted-role OFF
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 19 - Add type Explicit ref count 1
eth4: Designated Port Id 0x8006 - Priority 128 -
eth4: Root 800052540046f549
eth4: Designated Bridge 800052540046f549
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: Restricted-role OFF
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
eth5: Port Number 7-Ifindex 7-Port Id 0x8007-Role Designated-State Forwarding
eth5: Designated Path Cost 0
eth5: Configured Path Cost 19 - Add type Explicit ref count 1
eth5: Designated Port Id 0x8007 - Priority 128 -
eth5: Root 800052540046f549
eth5: Designated Bridge 800052540046f549
eth5: Message Age 0 - Max Age 20
eth5: Hello Time 2 - Forward Delay 15
eth5: Forward Timer 0-Msg Age Timer 0-Hello Timer 0-topo change timer 0
eth5: forward-transitions 1
eth5: Restricted-role OFF
eth5: No portfast configured - Current portfast off
eth5: bpdu-guard default - Current bpdu-guard off
eth5: bpdu-filter default - Current bpdu-filter off
eth5: no root guard configured - Current root guard off
eth5: Configured Link Type point-to-point - Current point-to-point
eth5: No auto-edge configured - Current port Auto Edge off