Download This Guide
Supported Platforms
Related Documentation
Example: Configuring Faster Convergence and Improving Network Stability with RSTP
The QFX Series products use Rapid Spanning Tree Protocol (RSTP) to provide a loop-free topology. RSTP identifies certain links as point to point. When a point-to-point link fails, the alternate link can transition to the forwarding state. RSTP provides quicker reconvergence time than original STP because it uses protocol handshake messages rather than fixed timeouts. Eliminating the need to wait for timers to expire makes RSTP more efficient than STP.
This example describes how to configure RSTP on four QFX3500 switches:
Requirements
This example uses the following hardware and software components:
- Junos OS Release 11.1 for the QFX3500 switches
- Four QFX3500 switches
Overview and Topology
In this example, QFX3500 switches are connected in the topology displayed in Figure 1 to create a loop-free topology.
Figure 1: Network Topology for RSTP

The interfaces shown in Table 1 will be configured for RSTP.
![]() | Note: You can configure RSTP on logical or physical interfaces. This example shows RSTP configured on logical interfaces. |
Table 1: Topology for Configuring RSTP on the QFX Series
Components | Settings |
---|---|
Switch 1 | The following ports on Switch 1 are connected in this way:
|
Switch 2 | The following ports on Switch 2 are connected in this way:
|
Switch 3 | The following ports on Switch 3 are connected in this way:
|
Switch 4 | The following ports on Switch 4 are connected in this way:
|
VLAN names and tag IDs | sales-vlan,
tag 10 |
This configuration example creates a loop-free topology between four switches using RSTP.
An RSTP topology contains ports that have specific roles:
- The root port is responsible for forwarding data to the root bridge.
- The alternate port is a standby port for the root port. When a root port goes down, the alternate port becomes the active root port.
- The designated port forwards data to the downstream network segment or device.
- The backup port is a backup port for the designated port. When a designated port goes down, the backup port becomes the active designated port and starts forwarding data.
Configuring RSTP on Switch 1
CLI Quick Configuration
To quickly configure interfaces and RSTP on Switch 1, copy the following commands and paste them into the switch terminal window:
[edit]
set vlans sales-vlan
description “Sales VLAN”
set vlans sales-vlan
vlan-id 10
set vlans engineering-vlan
description “Engineering VLAN”
set vlans engineering-vlan
vlan-id 20
set vlans publications-vlan
description “Publications VLAN”
set vlans publications-vlan
vlan-id 30
set vlans support-vlan
description “Support VLAN”
set vlans support-vlan
vlan-id 40
set interfaces xe-0/0/13
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/9
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/11
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/13
unit 0 family ethernet-switching port-mode trunk
set interfaces xe-0/0/9
unit 0 family ethernet-switching port-mode trunk
set interfaces xe-0/0/11
unit 0 family ethernet-switching port-mode trunk
set protocols rstp
bridge-priority 16k
set protocols rstp
interface xe-0/0/13.0 cost 1000
set protocols rstp
interface xe-0/0/13.0 mode point-to-point
set protocols rstp
interface xe-0/0/9.0 cost 1000
set protocols rstp
interface xe-0/0/9.0 mode point-to-point
set protocols rstp
interface xe-0/0/11.0 cost 1000
set protocols rstp
interface xe-0/0/11.0 mode point-to-point
Step-by-Step Procedure
To configure interfaces and RSTP on Switch 1:
- Configure the VLANs sales-vlan, engineering-vlan and publications-vlan, and support-vlan:
[edit vlans]
user@switch1# set sales-vlan description “Sales VLAN”
user@switch1# set sales-vlan vlan-id 10
user@switch1# set engineering-vlan description “Engineering VLAN”
user@switch1# set engineering-vlan vlan-id 20
user@switch1# set publications-vlan description “Publications VLAN”
user@switch1# set publications-vlan vlan-id 30
- Configure the VLANs on the interfaces, including support
for the Ethernet switching protocol:
[edit interfaces]
user@switch1# set xe-0/0/13 unit 0 family ethernet-switching vlan members [10 20 30 40]
user@switch1# set xe-0/0/9 unit 0 family ethernet-switching vlan members [10 20 30 40]
user@switch1# set xe-0/0/11 unit 0 family ethernet-switching vlan members [10 20 30 40]
- Configure the port mode for the interfaces:
[edit interfaces]
user@switch1# set xe-0/0/13 unit 0 family ethernet-switching port-mode trunk
user@switch1# set xe-0/0/9 unit 0 family ethernet-switching port-mode trunk
user@switch1# set xe-0/0/11 unit 0 family ethernet-switching port-mode trunk - Configure RSTP on the switch:
[edit protocols]
user@switch1# rstp bridge-priority 16k
user@switch1# rstp interface xe-0/0/13.0 cost 1000
user@switch1# rstp interface xe-0/0/13.0 mode point-to-point
user@switch1# rstp interface xe-0/0/9.0 cost 1000
user@switch1# rstp interface xe-0/0/9.0 mode point-to-point
user@switch1# rstp interface xe-0/0/11.0 cost 1000
user@switch1# rstp interface xe-0/0/11.0 mode point-to-point
Results
Check the results of the configuration:
Configuring RSTP on Switch 2
CLI Quick Configuration
To quickly configure interfaces and RSTP on Switch 2, copy the following commands and paste them into the switch terminal window:
[edit]
set vlans sales-vlan
description “Sales VLAN”
set vlans sales-vlan
vlan-id 10
set vlans engineering-vlan
description “Engineering VLAN”
set vlans engineering-vlan
vlan-id 20
set vlans publications-vlan
description “Publications VLAN”
set vlans publications-vlan
vlan-id 30
set vlans support-vlan
description “Support VLAN”
set vlans support-vlan
vlan-id 40
set interfaces xe-0/0/14
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/18
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/14
unit 0 family ethernet-switching port-mode trunk
set interfaces xe-0/0/18
unit 0 family ethernet-switching port-mode trunk
set protocols rstp
bridge-priority 32k
set protocols rstp
interface xe-0/0/14.0 cost 1000
set protocols rstp
interface xe-0/0/14.0 mode point-to-point
set protocols rstp
interface xe-0/0/18.0 cost 1000
set protocols rstp
interface xe-0/0/18.0 mode point-to-point
Step-by-Step Procedure
To configure interfaces and RSTP on Switch 2:
- Configure the VLANs sales-vlan, engineering-vlan and publications-vlan, and support-vlan:
[edit vlans]
user@switch2# set sales-vlan description “Sales VLAN”
user@switch2# set sales-vlan vlan-id 10
user@switch2# set engineering-vlan description “Engineering VLAN”
user@switch2# set engineering-vlan vlan-id 20
user@switch2# set publications-vlan description “Publications VLAN”
user@switch2# set publications-vlan vlan-id 30
user@switch2# set support-vlan vlan-description “Support VLAN”
user@switch2# set publications-vlan vlan-id 40
- Configure the VLANs on the interfaces, including support
for the Ethernet switching protocol:
[edit interfaces]
user@switch2# set xe-0/0/14 unit 0 family ethernet-switching vlan members [10 20 30 40]
user@switch2# set xe-0/0/18 unit 0 family ethernet-switching vlan members [10 20 30 40]
- Configure the port mode for the interfaces:
[edit interfaces]
user@switch2# set xe-0/0/14 unit 0 family ethernet-switching port-mode trunk
user@switch2# set xe-0/0/18 unit 0 family ethernet-switching port-mode trunk - Configure RSTP on the switch:
[edit protocols]
user@switch2# rstp bridge-priority 32k
user@switch2# rstp interface xe-0/0/14.0 cost 1000
user@switch2# rstp interface xe-0/0/14.0 mode point-to-point
user@switch2# rstp interface xe-0/0/18.0 cost 1000
user@switch2# rstp interface xe-0/0/18.0 mode point-to-point
Results
Check the results of the configuration:
Configuring RSTP on Switch 3
CLI Quick Configuration
To quickly configure interfaces and RSTP on Switch 3, copy the following commands and paste them into the switch terminal window:
[edit]
set vlans sales-vlan
description “Sales VLAN”
set vlans sales-vlan
vlan-id 10
set vlans engineering-vlan
description “Engineering VLAN”
set vlans engineering-vlan
vlan-id 20
set vlans publications-vlan
description “Publications VLAN”
set vlans publications-vlan
vlan-id 30
set vlans support-vlan
description “Support VLAN”
set vlans support-vlan
vlan-id 40
set interfaces xe-0/0/26
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/28
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/24
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/26
unit 0 family ethernet-switching port-mode trunk
set interfaces xe-0/0/28
unit 0 family ethernet-switching port-mode trunk
set interfaces xe-0/0/24
unit 0 family ethernet-switching port-mode trunk
set protocols rstp
bridge-priority 8k
set protocols rstp
interface xe-0/0/26.0 cost 1000
set protocols rstp
interface xe-0/0/26.0 mode point-to-point
set protocols rstp
interface xe-0/0/28.0 cost 1000
set protocols rstp
interface xe-0/0/28.0 mode point-to-point
set protocols rstp
interface xe-0/0/24.0 cost 1000
set protocols rstp
interface xe-0/0/24.0 mode point-to-point
Step-by-Step Procedure
To configure interfaces and RSTP on Switch 3:
- Configure the VLANs sales-vlan, engineering-vlan, publications-vlan, and support-vlan:
[edit vlans]
user@switch3# set sales-vlan description “Sales VLAN”
user@switch3# set sales-vlan vlan-id 10
user@switch3# set engineering-vlan description “Engineering VLAN”
user@switch3# set engineering-vlan vlan-id 20
user@switch3# set publications-vlan description “Publications VLAN”
user@switch3# set publications-vlan vlan-id 30
user@switch3# set support-vlan description “Support VLAN”
user@switch3# set publications-vlan vlan-id 40
- Configure the VLANs on the interfaces, including support
for the Ethernet switching protocol:
[edit interfaces]
user@switch3# set xe-0/0/26 unit 0 family ethernet-switching vlan members [10 20 30 40]
user@switch3# set xe-0/0/28 unit 0 family ethernet-switching vlan members [10 20 30 40]
user@switch3# set xe-0/0/24 unit 0 family ethernet-switching vlan members [10 20 30 40]
- Configure the port mode for the interfaces:
[edit interfaces]
user@switch3# set xe-0/0/26 unit 0 family ethernet-switching port-mode trunk
user@switch3# set xe-0/0/28 unit 0 family ethernet-switching port-mode trunk
user@switch3# set xe-0/0/24 unit 0 family ethernet-switching port-mode trunk - Configure RSTP on the switch:
[edit protocols]
user@switch3# rstp bridge-priority 8k
user@switch3# rstp interface xe-0/0/26.0 cost 1000
user@switch3# rstp interface xe-0/0/26.0 mode point-to-point
user@switch3# rstp interface xe-0/0/28.0 cost 1000
user@switch3# rstp interface xe-0/0/28.0 mode point-to-point
user@switch3# rstp interface xe-0/0/24.0 cost 1000
user@switch3# rstp interface xe-0/0/24.0 mode point-to-point
Results
Check the results of the configuration:
Configuring RSTP on Switch 4
CLI Quick Configuration
To quickly configure interfaces and RSTP on Switch 4, copy the following commands and paste them into the switch terminal window:
[edit]
set vlans sales-vlan
description “Sales VLAN”
set vlans sales-vlan
vlan–id 10
set vlans engineering-vlan
description “Engineering VLAN”
set vlans engineering-vlan
vlan-id 20
set vlans publications-vlan
description “Publications VLAN”
set vlans publications-vlan
vlan-id 30
set vlans support-vlan
description “Support VLAN”
set vlans support-vlan
vlan-id 40
set interfaces xe-0/0/23
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/19
unit 0 family ethernet-switching vlan members [10 20 30 40]
set interfaces xe-0/0/23
unit 0 family ethernet-switching port-mode trunk
set interfaces xe-0/0/19
unit 0 family ethernet-switching port-mode trunk
set protocols rstp
bridge-priority 16k
set protocols rstp
interface xe-0/0/23.0 cost 1000
set protocols rstp
interface xe-0/0/23.0 mode point-to-point
set protocols rstp
interface xe-0/0/19.0 cost 1000
set protocols rstp
interface xe-0/0/19.0 mode point-to-point
Step-by-Step Procedure
To configure interfaces and RSTP on Switch 4:
- Configure the VLANs sales-vlan, engineering-vlan, publications-vlan, and support-vlan:
[edit vlans]
user@switch4# set sales-vlan description “Sales VLAN”
user@switch4# set sales-vlan vlan-id 10
user@switch4# set engineering-vlan description “Engineering VLAN”
user@switch4# set engineering-vlan vlan-id 20
user@switch4# set publications-vlan description “Publications VLAN”
user@switch4# set publications-vlan vlan-id 30
user@switch4# set support-vlan description “Support VLAN”
user@switch4# set publications-vlan vlan-id 40
- Configure the VLANs on the interfaces, including support
for the Ethernet switching protocol:
[edit interfaces]
user@switch4# set xe-0/0/23 unit 0 family ethernet-switching vlan members [10 20 30 40]
user@switch4# set xe-0/0/19 unit 0 family ethernet-switching vlan members [10 20 30 40]
- Configure the port mode for the interfaces:
[edit interfaces]
user@switch4# set xe-0/0/23 unit 0 family ethernet-switching port-mode trunk
user@switch4# set xe-0/0/19 unit 0 family ethernet-switching port-mode trunk - Configure RSTP on the switch:
[edit protocols]
user@switch4# rstp bridge-priority 16k
user@switch4# rstp interface all cost 1000
user@switch4# rstp interface xe-0/0/23.0 cost 1000
user@switch4# rstp interface xe-0/0/23.0 mode point-to-point
user@switch4# rstp interface xe-0/0/19.0 cost 1000
user@switch4# rstp interface xe-0/0/19.0 mode point-to-point
Results
Check the results of the configuration:
Verification
To confirm that the configuration is working properly, perform these tasks:
- Verifying RSTP Configuration on Switch 1
- Verifying RSTP Configuration on Switch 2
- Verifying RSTP Configuration on Switch 3
- Verifying RSTP Configuration on Switch 4
Verifying RSTP Configuration on Switch 1
Purpose
Verify that the RSTP configuration on Switch 1 is correct.
Action
In operational mode, issue the show spanning-tree interface command:
user@switch1> show spanning-tree interface
Spanning tree interface parameters for instance 0 Interface Port ID Designated Designated Port State Role port ID bridge ID Cost xe-0/0/13.0 128:527 128:525 16384.0019e25040e0 1000 BLK ALT xe-0/0/9.0 128:529 128:513 32768.0019e2503d20 1000 BLK ALT xe-0/0/11.0 128:531 128:513 8192.0019e25051e0 1000 FWD ROOT
Meaning
See the topology in Figure 1. The operational mode command show spanning-tree interface shows that xe-0/0/13.0 is in a forwarding state. The other interfaces on Switch 1 are blocked.
Verifying RSTP Configuration on Switch 2
Purpose
Verify that the RSTP configuration on Switch 2 is correct.
Action
In operational mode issue the show spanning-tree interface command:
user@switch2> show spanning-tree interface
Spanning tree interface parameters for instance 0 Interface Port ID Designated Designated Port State Role port ID bridge ID Cost xe-0/0/14.0 128:513 128:513 32768.0019e2503d20 1000 BLK DESG xe-0/0/18.0 128:519 128:515 8192.0019e25051e0 1000 FWD ROOT
Meaning
See the topology in Figure 1. The operational mode command show spanning-tree interface shows that interface xe-0/0/18.0 is in a forwarding state and the root port. The other interface on Switch 2 is blocked.
Verifying RSTP Configuration on Switch 3
Purpose
Verify that the RSTP configuration on Switch 3 is correct.
Action
In operational mode, issue the show spanning-tree interface command:
user@switch3> show spanning-tree interface
Spanning tree interface parameters for instance 0 Interface Port ID Designated Designated Port State Role port ID bridge ID Cost xe-0/0/26.0 128:513 128:513 8192.0019e25051e0 1000 FWD DESG xe-0/0/28.0 128:515 128:515 8192.0019e25051e0 1000 FWD DESG xe-0/0/24.0 128:517 128:517 8192.0019e25051e0 1000 FWD DESG
Meaning
See the topology in Figure 1. The operational mode command show spanning-tree interface shows that no interface is the root interface.
Verifying RSTP Configuration on Switch 4
Purpose
Verify the RSTP configuration on Switch 4.
Action
In operational mode, issue the show spanning-tree interface command:
user@switch4> show spanning-tree interface
Spanning tree interface parameters for instance 0 Interface Port ID Designated Designated Port State Role port ID bridge ID Cost xe-0/0/23.0 128:523 128:517 8192.0019e25051e0 1000 FWD ROOT xe-0/0/19.0 128:525 128:525 16384.0019e25040e0 1000 FWD DESG
Meaning
See the topology in Figure 1. The operational mode command show spanning-tree interface shows that interface xe-0/0/23.0 is the root interface and is in the forwarding state.