Spanning Tree
Spanning Tree Protocol (STP) configuration prevents Layer 2 loops and provides redundant path management on NX-OS devices, supporting PVST+ (per-VLAN spanning tree) and MST (Multiple Spanning Tree) modes with bridge assurance and loop guard for enhanced network stability. Global settings control STP mode selection, pathcost method, FCoE integration, linecard ISSU behavior, L2 gateway STP domain ID, and default edge port behavior. Per-VLAN settings allow customization of timers, priority, and root bridge designation. Spanning tree interface-level configuration manages BPDU filter, BPDU guard, port cost, guard mode (root/loop), link type, port type (edge/network/normal), port priority, and MST interoperability settings across Ethernet and port-channel interfaces.
Diagram
Section titled “Diagram”Classes
Section titled “Classes”configuration (nxos.devices)
Section titled “configuration (nxos.devices)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| spanning_tree | Class | [spanning_tree] | No |
ethernets (nxos.devices.configuration.interfaces)
Section titled “ethernets (nxos.devices.configuration.interfaces)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| spanning_tree | Class | [spanning_tree] | No |
port_channels (nxos.devices.configuration.interfaces)
Section titled “port_channels (nxos.devices.configuration.interfaces)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| spanning_tree | Class | [spanning_tree] | No |
spanning_tree (nxos.devices.configuration)
Section titled “spanning_tree (nxos.devices.configuration)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| bridge_assurance | Boolean | true, false | No | |
| fcoe | Boolean | true, false | No | |
| l2_gateway_stp_domain_id | Integer | min: 0, max: 200000000 | No | |
| linecard_issu | Choice | disruptive, non-disruptive, auto | No | |
| loopguard | Boolean | true, false | No | |
| mode | Choice | mst, pvrst | No | |
| pathcost_method | Choice | auto, short, long | No | |
| port_type_edge_default | Boolean | true, false | No | |
| port_type_edge_bpdufilter_default | Boolean | true, false | No | |
| port_type_edge_bpduguard_default | Boolean | true, false | No | |
| vlans | List | [vlans] | No |
spanning_tree (nxos.devices.configuration.interfaces.ethernets)
Section titled “spanning_tree (nxos.devices.configuration.interfaces.ethernets)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| bpdufilter | Boolean | true, false | No | |
| bpduguard | Boolean | true, false | No | |
| cost | Integer | min: 0, max: 200000000 | No | |
| guard | Choice | root, loop, none | No | |
| link_type | Choice | auto, p2p, shared | No | |
| port_type | Choice | edge, network, normal | No | |
| port_priority | Integer | min: 0, max: 224 | No | |
| mst_pre_standard | Boolean | true, false | No | |
| mst_simulate_pvst | Boolean | true, false | No |
vlans (nxos.devices.configuration.spanning_tree)
Section titled “vlans (nxos.devices.configuration.spanning_tree)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| vlan_id | Integer | min: 1, max: 4094 | Yes | |
| forward_time | Integer | min: 4, max: 30 | No | |
| hello_time | Integer | min: 1, max: 10 | No | |
| max_age | Integer | min: 6, max: 40 | No | |
| priority | Integer | min: 0, max: 61440 | No | |
| root | Choice | primary, secondary | No | |
| diameter | Integer | min: 2, max: 7 | No |
Examples
Section titled “Examples”Example 1: PVST+ mode with bridge assurance, loopguard, and default edge port settings
nxos: devices: - name: LEAF1 configuration: spanning_tree: mode: pvrst loopguard: true bridge_assurance: true port_type_edge_default: true port_type_edge_bpduguard_default: trueExample 2: MST mode with long pathcost on a spine switch
nxos: devices: - name: SPINE1 configuration: spanning_tree: mode: mst bridge_assurance: true loopguard: true pathcost_method: longExample 3: Spanning tree with FCoE support, linecard ISSU behavior, and L2 gateway domain ID
nxos: devices: - name: BORDER-LEAF1 configuration: spanning_tree: mode: pvrst bridge_assurance: true loopguard: true fcoe: true linecard_issu: non-disruptive l2_gateway_stp_domain_id: 100Example 4: Per-VLAN spanning tree with root bridge designation and custom timers
nxos: devices: - name: LEAF1 configuration: spanning_tree: mode: pvrst vlans: - vlan_id: 100 priority: 4096 root: primary diameter: 3 forward_time: 15 hello_time: 2 max_age: 20 - vlan_id: 200 priority: 8192 root: secondaryExample 5: Interface-level spanning tree with edge port, BPDU guard, and MST interop settings
nxos: devices: - name: LEAF1 configuration: interfaces: ethernets: - id: 1/1 spanning_tree: port_type: edge bpduguard: true guard: root mst_pre_standard: true mst_simulate_pvst: true port_channels: - id: 100 spanning_tree: port_type: network guard: loop link_type: p2p cost: 500 port_priority: 128Spanning Tree Protocol (STP) configuration prevents Layer 2 loops and provides redundant path management on NX-OS devices, supporting PVST+ (per-VLAN spanning tree) and MST (Multiple Spanning Tree) modes with bridge assurance and loop guard for enhanced network stability. Global settings control STP mode selection, pathcost method, FCoE integration, linecard ISSU behavior, and L2 gateway STP domain ID. Spanning tree interface-level configuration manages BPDU filter, BPDU guard, port cost, guard mode (root/loop), link type, port type (edge/network/normal), and port priority across Ethernet and port-channel interfaces.
Diagram
Section titled “Diagram”Classes
Section titled “Classes”configuration (nxos.devices)
Section titled “configuration (nxos.devices)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| spanning_tree | Class | [spanning_tree] | No |
ethernets (nxos.devices.configuration.interfaces)
Section titled “ethernets (nxos.devices.configuration.interfaces)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| spanning_tree | Class | [spanning_tree] | No |
port_channels (nxos.devices.configuration.interfaces)
Section titled “port_channels (nxos.devices.configuration.interfaces)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| spanning_tree | Class | [spanning_tree] | No |
spanning_tree (nxos.devices.configuration)
Section titled “spanning_tree (nxos.devices.configuration)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| bridge_assurance | Boolean | true, false | No | |
| fcoe | Boolean | true, false | No | |
| l2_gateway_stp_domain_id | Integer | min: 0, max: 200000000 | No | |
| linecard_issu | Choice | disruptive, non-disruptive, auto | No | |
| loopguard | Boolean | true, false | No | |
| mode | Choice | mst, pvrst | No | |
| pathcost_method | Choice | auto, short, long | No |
spanning_tree (nxos.devices.configuration.interfaces.ethernets)
Section titled “spanning_tree (nxos.devices.configuration.interfaces.ethernets)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| bpdufilter | Boolean | true, false | No | |
| bpduguard | Boolean | true, false | No | |
| cost | Integer | min: 0, max: 200000000 | No | |
| guard | Choice | root, loop, none | No | |
| link_type | Choice | auto, p2p, shared | No | |
| port_type | Choice | edge, network, normal | No | |
| port_priority | Integer | min: 0, max: 224 | No |
Examples
Section titled “Examples”Example 1: PVST+ mode with bridge assurance and loopguard on a VXLAN leaf switch
nxos: devices: - name: LEAF1 configuration: spanning_tree: mode: pvrst loopguard: true bridge_assurance: trueExample 2: MST mode with long pathcost and stateful HA on a spine switch
nxos: devices: - name: SPINE1 configuration: spanning_tree: mode: mst bridge_assurance: true loopguard: true pathcost_method: longExample 3: Spanning tree with FCoE support, linecard ISSU behavior, and L2 gateway domain ID
nxos: devices: - name: BORDER-LEAF1 configuration: spanning_tree: mode: pvrst bridge_assurance: true loopguard: true fcoe: true linecard_issu: non-disruptive l2_gateway_stp_domain_id: 100Example 4: Interface-level spanning tree with edge port and BPDU guard on access-facing Ethernet
nxos: devices: - name: LEAF1 configuration: interfaces: ethernets: - id: 1/1 spanning_tree: port_type: edge bpduguard: true guard: root port_channels: - id: 100 spanning_tree: port_type: network guard: loop link_type: p2p