Skip to content

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, 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
NameTypeConstraintMandatoryDefault Value
spanning_treeClass[spanning_tree]No

ethernets (nxos.devices.configuration.interfaces)

Section titled “ethernets (nxos.devices.configuration.interfaces)”
NameTypeConstraintMandatoryDefault Value
spanning_treeClass[spanning_tree]No

port_channels (nxos.devices.configuration.interfaces)

Section titled “port_channels (nxos.devices.configuration.interfaces)”
NameTypeConstraintMandatoryDefault Value
spanning_treeClass[spanning_tree]No

spanning_tree (nxos.devices.configuration)

Section titled “spanning_tree (nxos.devices.configuration)”
NameTypeConstraintMandatoryDefault Value
bridge_assuranceBooleantrue, falseNo
fcoeBooleantrue, falseNo
l2_gateway_stp_domain_idIntegermin: 0, max: 200000000No
linecard_issuChoicedisruptive, non-disruptive, autoNo
loopguardBooleantrue, falseNo
modeChoicemst, pvrstNo
pathcost_methodChoiceauto, short, longNo

spanning_tree (nxos.devices.configuration.interfaces.ethernets)

Section titled “spanning_tree (nxos.devices.configuration.interfaces.ethernets)”
NameTypeConstraintMandatoryDefault Value
bpdufilterBooleantrue, falseNo
bpduguardBooleantrue, falseNo
costIntegermin: 0, max: 200000000No
guardChoiceroot, loop, noneNo
link_typeChoiceauto, p2p, sharedNo
port_typeChoiceedge, network, normalNo
port_priorityIntegermin: 0, max: 224No

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: true

Example 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: long

Example 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: 100

Example 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