# Spanning tree election calculator

> The root bridge, every root port, every designated port and the ports left as alternate or backup in a small switched network you describe in a few lines, each step with the comparison that decided it; and the long (802.1t) and short (802.1D-1998) path costs by link speed, with each vendor's documented default.

- Tool: https://ronutz.com/en/tools/stp-election-calculator
- Family: Networking

---

## What it does

The Spanning Tree Protocol (STP) and its rapid successor (RSTP, the Rapid Spanning Tree Protocol) keep a switched network with redundant links free of loops: the switches elect one root bridge, every other switch keeps its best port towards the root, every segment keeps one port that forwards towards it, and every port left over stops forwarding. The election is fixed by comparisons anyone can do on paper, and this calculator does them for a small network you describe in a few lines, in two modes:

- **Election.** For 2 to 16 bridges and the links between their ports: the root bridge, the root port of every other bridge, the designated port of every segment, and the ports left as alternate or backup ports, each with the comparison that decided it, in the order the course "LAN Switch Operations and Maintenance" teaches it in chapter 2.4 (elect the root, assign path costs, find the designated bridge of each segment, identify root and designated ports, block the rest).
- **Cost by speed.** For a link speed: the long (32-bit) and short (16-bit) port path costs that the documents read for the tool give, which documents give them, and each vendor's documented default method and the command that changes it.

Everything is computed in your browser.

## Election: the topology

One statement per line; a `#` starts a comment, blank lines are ignored, and keywords and bridge names are read without regard to case.

```text
bridge B1 32768 00-00-5E-00-53-01
bridge B2 32768 00-00-5E-00-53-02 short
link B1:1 B2:1 1G
link B1:2 B2:2 cost 4000
port B1:2 priority 64
vlan 10
priority-format 802.1d
```

- **bridge**: a name (a letter, then up to 15 letters, digits, dots, hyphens or underscores), a bridge priority and a MAC (media access control) address with colons or hyphens, in three dotted groups, or as twelve hexadecimal digits. Ending the line with `short` or `long` gives that bridge its own path cost method; otherwise it uses the method chosen above the box.
- **link**: two ports written as `bridge:port`, then a speed (10M, 100M, 1G, 10G, 25G, 40G, 50G, 100G, 1T or 10T, also spelled `1 Gb/s` or `1gbps`) or the word `cost` and a number. Three or more ports on one line make a shared segment, as through a hub; two ports of the same bridge on one line are a cable looped between them.
- **port**: a port already on a link, then `priority` and a value, `cost` and a value, or both.
- **vlan**: the VLAN whose tree you are computing; its ID is added to every bridge priority as the system ID extension.
- **priority-format 802.1d**: the 16-bit bridge priorities of 802.1D-1998, for bridges that accept any value from 0 to 65535.

The tool reads up to 16 bridges, 32 links, 8 ports on one segment, 128 ports in all, 80 lines and 4000 characters. A port's path cost comes, in this order, from a `port` line, from a cost typed on its link, or from its link's speed and its own bridge's method.

## Election: the rules it applies

**Identifiers.** A bridge ID is "a manageable priority in the four most-significant bits, a system ID extension in the next 12 bits, and the Bridge Address in the remaining 48 bits" ([IEEE 802.1Q RSTP YANG module](https://grouper.ieee.org/groups/802/1/files/public/YANGs/ieee802-dot1q-rstp.yang), revision 2025-02-04), so on bridges that follow 802.1t or 802.1w the priority's "permissible values are 0-61440, in steps of 4096" ([RFC 4188](https://www.rfc-editor.org/rfc/rfc4188.txt), dot1dStpPriority; the same in the IEEE's [spanning tree MIB](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-SPANNING-TREE-MIB-202211080000Z.mib)). Cisco's per-VLAN trees put the VLAN in the extension, "a 12-bit extended system ID value equal to the VLAN ID" ([Cisco, Catalyst 9300, IOS XE 17.18](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/17-18/configuration_guide/lyr2/b_1718_lyr2_9300_cg/configuring_spanning_tree_protocol.html)), and Arista's manual gives the VLAN number for Rapid-PVST, the instance number for MST and 0 for a single RSTP tree ([Arista EOS 4.37.0F](https://www.arista.com/en/um-eos/eos-spanning-tree-protocol)). A port ID is "a priority in the four most-significant bits, and a twelve-bit Bridge Port number" (IEEE YANG module), so port priorities are 0 to 240 in steps of 16 (RFC 4188, dot1dStpPortPriority). The page prints IDs the way switches do: 32778.00-00-5E-00-53-01 for a bridge ID, 128.4 for a port ID.

**1. The root bridge.** "The bridge with the lowest bridge ID is elected as the root bridge. If the bridge priorities are equal or if the bridge priority is not configured, the bridge with the lowest MAC address is elected the root bridge" ([Juniper, spanning tree overview](https://www.juniper.net/documentation/us/en/software/junos/stp-l2/topics/topic-map/spanning-tree-overview.html)). The page lists every bridge in bridge ID order and says whether the priority or the MAC address decided. When every bridge has the same priority it warns that the root was chosen by accident: the course's advice is to lower the intended root's priority on purpose.

**2. Root path costs and root ports.** The root's root path cost is 0; every other bridge's is "the sum of the Port Path Costs on the least-cost path to the Root Bridge", each bridge adding the cost of the port a message arrives on to the cost its neighbour advertises ([MikroTik RouterOS 7.24, STP guide](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/user-guides/spanning-tree-protocol/)). A bridge's root port is chosen by the "lowest Root port path cost, lowest bridge identifier, and lowest bridge port ID in this particular order", where the bridge identifier and the port ID are those of the upstream device that sent the BPDU (bridge protocol data unit) (MikroTik, as above). One more comparison exists for a bridge with two ports on a shared segment that hear the same upstream port: then the receiving ports' own IDs decide, which Cisco states as "the interface with the lowest interface number" (Cisco, as above) and Arista as "the port with the lower interface number". The page gives each bridge's root port, its cost and the comparison that decided it, with a sentence naming both candidates.

**3. Designated ports.** On every segment, the port whose bridge has the lowest root path cost is designated; "If two bridges have the same path cost to the root bridge, the bridge with the lowest bridge ID becomes the designated bridge" (Juniper, as above); and between two ports of that bridge on the segment, the lower port ID, which Cisco describes as "the port priority and port ID are added together, and spanning tree disables the link with the highest value". The root bridge's own ports are therefore designated, unless two of them share a segment.

**4. Everything else.** A port that is neither root nor designated hears a better BPDU than it would send. If that BPDU comes from another bridge, it is an alternate port, a ready second path to the root; if it comes from another port of its own bridge on the same segment, it is a backup port, and "A backup port can exist only where two or more bridge ports connect to the same LAN for which the bridge serves as the designated bridge" (Juniper, as above). Both are "placed in the discarding state" in RSTP (Juniper), which the original 802.1D calls blocking (RFC 4188, dot1dStpPortState). The four roles are those of the IEEE YANG module's port-role enumeration.

The page shows the four steps in that order, then a table of every port with its port ID, its cost and where the cost came from, and its role and state.

## Path costs: long and short

Two scales are in use. The long values are the 32-bit ones of 802.1t, kept in 802.1D-2004, from 1 to 200,000,000 (RFC 4188, dot1dStpPortPathCost32); the short values are the 16-bit ones of 802.1D-1998, from 1 to 65,535 (dot1dStpPortPathCost). Both are chosen "in inverse proportion to the speed of the attached LAN" (RFC 4188). The IEEE standards themselves are not freely readable, so the tool uses the values the vendors' documents give, and names them:

| Speed | Long | Documented by | Short | Documented by |
|---|---|---|---|---|
| 10 Mb/s | 2000000 | Extreme Switch Engine, MikroTik, Cisco, HPE Aruba | 100 | Extreme (ExtremeXOS 11.5 and earlier), MikroTik, Cisco Press |
| 100 Mb/s | 200000 | the same four | 19 | the same three |
| 1 Gb/s | 20000 | the same four, Arista and Huawei | 4 | the same three and Huawei |
| 2.5 Gb/s | 8000 | Huawei | 3 | Huawei |
| 10 Gb/s | 2000 | the same four, Arista and Huawei | 2 | the same three and Huawei |
| 25 Gb/s | 800 | MikroTik | 1 | MikroTik |
| 40 Gb/s | 500 | MikroTik, Cisco, Huawei | 1 | MikroTik, Huawei |
| 50 Gb/s | 400 | MikroTik | 1 | MikroTik |
| 100 Gb/s | 200 | MikroTik, Cisco, HPE Aruba | 1 | MikroTik |
| 1 Tb/s | 20 | Cisco, HPE Aruba | none read | |
| 10 Tb/s | 2 | Cisco | none read | |

A speed no document gives a value for (5 Gb/s, 400 Gb/s) is refused, and so is a short cost at 1 Tb/s or 10 Tb/s: type the cost your switches use instead. The tool never estimates a cost.

**Mixing the two scales.** A switch on short costs advertises a root path cost thousands of times smaller than a neighbour on long costs, so paths through it look cheapest whatever their speed. Extreme warns that "an 802.1D-1998 compliant bridge could become the most favorable transit path" ([Extreme, configure stpd ports cost](https://documentation.extremenetworks.com/Switch%20Engine%20v33.7.1%20Command%20References/content/documents/Switch_Operating_Systems/Switch_Engine/Command_References/configure_stpd_ports_cost.shtml)), and Cisco's document 225591 describes a root inconsistency in which "Switch 3 was integrated into the network utilizing the path cost method designated as 'short'" while the others used long, solved with `spanning-tree pathcost method long` ([Cisco, document 225591](https://www.cisco.com/c/en/us/support/docs/lan-switching/per-vlan-spanning-tree-plus-pvst-/225591-troubleshoot-stp-root-inconsistency-due.html)). The page warns whenever the bridges' speeds are costed with both methods; the **Mixed cost methods** sample shows an access switch whose root port goes through an old bridge's 100 Mb/s uplink rather than a newer bridge's 10 Gb/s one.

## Each vendor's default

The vendors chapter 2.4 of the course covers, with what their documents say on 8 November 2026:

- **Extreme Switch Engine 33.7.1**: the long values by default since ExtremeXOS 11.6 (2,000,000 for a 10 Mbps port down to 2,000 for 10 Gb/s), the short ones (100, 19, 4 and 2) in ExtremeXOS 11.5 and earlier; no method switch, and to match an 802.1D-1998 bridge the advice is to type the old value on the port. Per port: `configure stpd <stpd> ports cost [auto | <cost>] <ports>`.
- **Extreme Fabric Engine 9.4**: `spanning-tree mstp pathcost-type <bits16 | bits32>`, and "The default is 32 bits" ([Fabric Engine 9.4 User Guide](https://documentation.extremenetworks.com/Fabric%20Engine%20v9.4%20User%20Guide/fe_9.4_ug_revacdev/content/documents/Switch_Operating_Systems/VOSS_and_Fabric_Engine/fabric_engine_user_guide/configuring_multiple_spanning_tree_protocol.shtml)).
- **Cisco IOS XE 17.18 and 26.x (Catalyst 9300)**: the documents disagree. The command reference gives `spanning-tree pathcost method` a "Command Default" of short in both releases ([17.18](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/17-18/command_reference/b_1718_9300_cr/layer_2_3_commands.html), [26.x](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/26-x/command_reference/b_26x_9300_cr/layer_2_3_commands.html)), and the configuration guides and the IOS XE 17 STP guide (updated 17 July 2026) say "The short path cost method is the default STP path cost method used"; yet the guides' default configuration tables list "1 Gbps: 20000" and the other long values, and the command reference's own `show spanning-tree summary` example prints "Configured Pathcost method used is long" beside a port path cost of 20000. `show spanning-tree summary` tells you which method a switch is using. Pin the method on every switch with `spanning-tree pathcost method long`, the command of document 225591. Per port: `spanning-tree cost`, "the range is 1 to 200000000".
- **HPE Aruba Networking AOS-CX 10.16**: the long values by speed, from "10 Mbps link speed equals a path cost of 2,000,000" to "1 Tbps link speed equals a path cost of 20"; the page read gives no command to change the method. Per port: `spanning-tree cost`, 1 to 200,000,000 ([AOS-CX 10.16, spanning-tree cost](https://arubanetworking.hpe.com/techdocs/AOS-CX/10.16/HTML/l2_bridging_6300-6400/Content/Chp_stp/mstp_cmds/spa-tre-cos.htm)).
- **Juniper Junos OS**: "The link cost is determined by the link speed" ([Junos CLI reference, cost](https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/statement/cost-edit-protocols-stp.html)), with no method statement in the pages read; the example output of [show spanning-tree interface](https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/command/show-stp-interface-command.html) prints 20000 on a ge- interface and 2000 on xe- interfaces. Per port: `set protocols rstp interface <name> cost <cost>`.
- **MikroTik RouterOS 7.24**: `port-cost-mode` on the bridge, long or short, "Default: long" ([RouterOS 7.24, Bridging and Switching](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/)); "RouterOS versions prior to 7.13 do not change port path cost based on the link speed" ([RouterOS 7.24, Spanning Tree Protocol](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/user-guides/spanning-tree-protocol/)).
- **Arista EOS 4.37.0F**: "1 gigabit interfaces have a default cost of 20000" and "10 gigabit interfaces have a default cost of 2000"; no method setting appears in the manual read. Per port: `spanning-tree cost`.
- **Huawei VRP (S5700 and S6700 V200R025C00)**: "By default, the IEEE 802.1t is used to calculate the path cost", that is the long values. `stp pathcost-standard { dot1d-1998 | dot1t | legacy }` switches to the short values or to Huawei's own legacy scale (20 for 1 Gb/s, 2 for 10 Gb/s), and changing it puts every port's typed cost back to the default. Huawei's table gives 8000 long and 3 short for 2.5 Gb/s, one less for full duplex at 10 and 100 Mb/s (1,999,999 and 199,999 long, 99 and 18 short) and lower costs for aggregated links, so a Huawei port at those speeds can differ from the table above. Per port: `stp [ instance <id> ] cost <cost>`, 1 to 200,000,000 under 802.1t ([Huawei, STP/RSTP/MSTP/VBST Configuration Commands](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/9ccc5041/stp-rstp-mstp-vbst-configuration-commands), read in a browser: the site refuses automated reads).

## What it refuses, and why

- A **priority** that is not a multiple of 4096 from 0 to 61440, unless the topology says `priority-format 802.1d`, where any 16-bit value is read; a priority that is not a number.
- **Two bridges with the same MAC address**, which would also give them the same bridge ID at equal priorities: the bridge address is "used by this bridge when it must be referred to in a unique fashion" (RFC 4188, dot1dBaseBridgeAddress). Two bridges with the same name.
- A **link to a bridge no line declares**, a port on two links, a port number outside 1 to 4095 (1 to 255 with `priority-format 802.1d`), a link with fewer than two or more than eight ports, and a link without a speed or a cost.
- A **disconnected topology**: each separate part would elect its own root, so the tool says which bridges cannot reach which and computes one connected network at a time.
- A **speed no document gives a cost for**, a short cost above 100 Gb/s, a cost outside 1 to 200,000,000, and a cost above 65,535 on a bridge that uses short costs (Extreme: "the path cost range setting is 1 to 65,535" on 802.1D-1998 bridges).
- A **port priority** that is not a multiple of 16 from 0 to 240, a `vlan` outside 1 to 4094 or with `priority-format 802.1d`, any statement the tool does not read, and the bounds above.

Every refusal names the line and says what the line needs. A MAC address with the group bit set is computed, with a warning: "If it is zero, the MAC address is unicast" ([RFC 9542](https://www.rfc-editor.org/rfc/rfc9542.txt), section 2.1.1), and a bridge's own address is a unicast one.

## Worked examples

- **The Example** is the worked example of chapter 2.4 of the open course [LAN Switch Operations and Maintenance](https://ronutz.com/en/materials/lan-switch-operations-and-maintenance), slide 259: six bridges with the IDs 80-00:1 to 80-00:6 (priority 32768, MAC addresses rising from 1 to 6, here in the documentation range 00-00-5E-00-53-00 to 00-00-5E-00-53-FF of RFC 9542), equal path costs (every link at 1 Gb/s, 20000), and two links between Bridge 3 and Bridge 6. B1 is the root, chosen by its MAC address. B5 reaches the root at 40000 through B2 and through B4; the BPDU from B2 has the lower bridge ID, so B5:1 is its root port and B5:2 is an alternate port. B6 hears B3 twice and B5 once, all at 60000: B3 has the lower bridge ID than B5, and between B3's two ports the lower sender port ID, 128.2 against 128.3, makes B6:1 the root port, so B6:2 and B6:3 are alternate ports, exactly the three blocked ports of the slide.
- **Learn lab, short costs**: the square with one diagonal of the article's lab, with B-D at 100 Mb/s (cost 19): A is the root, C's root port is direct, and D reaches the root through C at 8 rather than through B at 23.
- **Backup port on a hub**: SW1 is the root by priority and has two ports on one shared segment: SW1:2 is designated by its lower port ID, SW1:3 is a backup port and SW2:2, which reaches the root more cheaply over its 10 Gb/s link, is an alternate port.
- **Mixed cost methods**: ROOT reaches OLD over 100 Mb/s and NEW over 10 Gb/s; OLD uses short costs. ACC's root port goes through OLD (19 + 20000 = 20019) instead of NEW (2000 + 20000 = 22000); with OLD on long costs (200000), ACC would choose NEW.
- **VLAN 10, root on purpose**: the Example's network with B5 at 4096 and a `vlan 10` line: every priority field gains 10 (4106 for B5, 32778 for the others), and B5 becomes the root.
- **Cost by speed**: 1 Gb/s gives 20000 long and 4 short, the 20000 the course's slide 266 shows on ge.2.1 and ge.2.4.

## What it does not do

It computes the stable result every bridge agrees on, not how the network gets there. It does not model timers and convergence, the proposal and agreement handshake, edge ports, link types, topology changes, MSTP (Multiple Spanning Tree Protocol) regions and instances, PVST+ (per-VLAN spanning tree plus) beyond one VLAN's tree, failed links, or BPDU Guard, Root Guard and Loop Guard. It does not talk to any switch. To practise the same rules on a new network every day, play the [Spanning Tree puzzle](https://ronutz.com/en/dev/fun/spanning-tree); the article [Spanning tree in one article](https://ronutz.com/en/learn/spanning-tree-in-one-article) explains the protocol and has a lab with four switches.

## Share results

Under the verdict, **Share results** builds a link to this page, only when you press it, that carries the mode and the fields of the mode shown, as typed, after the `#`: `mode` (`election` or `cost`); in Election mode `method` (`long` or `short`) and `topology`, the lines as typed; in Cost by speed mode `speed`. The other mode's fields are not carried. In Election mode the popover adds a caution: bridge names and MAC addresses can describe a real network, so read them before you send the link.

[RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) (section 3.5, read 2026-11-08) describes the fragment as the part of a reference that is used only after the document is retrieved: "the fragment identifier is not used in the scheme-specific processing of a URI; instead, the fragment identifier is separated from the rest of the URI prior to a dereference". These values are therefore not sent to the server when the link is opened; they stay in the address bar and the history of whoever opens it, and anyone who has the link can read them.

- **How long.** A link carries at most 16,384 characters, the bound the site uses for every value after the `#`; a topology is at most 4000.
- **Opening a link.** The mode and its fields are set as typing would set them (a link without `method` means long), the other mode keeps its values, and the page computes. A link with an unknown mode or method, a field of the other mode, a missing or blank required field, a topology longer than 4000 characters, or a speed on two lines or longer than 24 characters is ignored. Accepted or not, the values then leave the page's own address at once, without a request.

## Provenance

The engine is a shortest-path pass and three sorts, with no clock, no network and no randomness. It ships 178 golden vectors (set `stp-election-calculator-golden-2026-11-08b`): 78 elections (the Example, the four samples, fourteen variations and sixty seeded random topologies, which together exercise every tie-break: the root by priority and by MAC address; root ports by cost, the sender's bridge ID, the sender's port ID and the receiving port's ID; designated ports by cost, bridge ID and port ID; 22 backup ports), 22 cost lookups, and 78 written out (sentences, spellings, the API and 59 refusals). Every expected root, role, cost and root port was derived by a separate implementation, not by running this engine: a Python program that reads its cost tables from the saved documents and elects by passing messages between ports until no bridge changes its mind, then assigns each port's role by comparing what it would send with what it hears. Four deliberate faults put into the engine (the last two tie-breaks swapped, the sending port's cost added instead of the receiving port's, the designated comparison reordered, the backup role removed) each made between 3 and 21 vectors fail.

## API

The same engine answers `/api/v1/stp-election-calculator` on the site's HTTP API; the contract is on the [API page](https://ronutz.com/en/api), which also says whether this site serves the API.

- **Request.** A JSON object. Election: `{"mode": "election", "method": "long", "topology": "bridge B1 32768 00-00-5E-00-53-01\nbridge B2 32768 00-00-5E-00-53-02\nlink B1:1 B2:1 1G"}`, with `method` optional (long by default). Cost: `{"mode": "cost", "speed": "1G"}`.
- **Response, election.** `mode`, `method`, `methodDefault`, `priorityFormat`, `vlan`, `bridges` (each: `index`, `name`, `priority`, `extension`, `priorityField`, `mac`, `bridgeId`, `bridgeIdHex`, `method`, `methodSet`, `rank`, `isRoot`, `rootPathCost`, `rootPort`), `ports` (each: `index`, `bridge`, `bridgeName`, `number`, `priority`, `portId`, `portIdValue`, `segment`, `cost`, `costSource`, `speed`, `role`, `forwarding`, `designatedPort`), `segments`, `root`, `rootStep`, `rootPortSteps` (with every candidate), `designatedSteps` (with every candidate), `blockedSteps`, `counts`, `verdictText`, `warnings` and `notes`.
- **Response, cost.** `mode`, `speed` (`id`, `mbps`, `label`, `long` and `short`, each with `value` and `sources`, or null), `table` (every speed), `vendors` (each: `id`, `platform`, `defaultMethod`, `change`, `perPort`, `sources`, `valueAtSpeed`, `text`), `verdictText` and `notes`.
- **Errors.** HTTP 400, `invalid_input`, with the engine's message, for example `Line 1: A: priority 32769 is not a multiple of 4096 from 0 to 61440. ...`.

## Sources

- [IEEE 802.1, ieee802-dot1q-rstp YANG module, revision 2025-02-04](https://grouper.ieee.org/groups/802/1/files/public/YANGs/ieee802-dot1q-rstp.yang) (read 2026-11-08): bridge-id, port-id, port-role, root-path-cost, port-path-cost
- [IEEE 802.1, IEEE8021-SPANNING-TREE-MIB, 2022-11-08](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-SPANNING-TREE-MIB-202211080000Z.mib) (read 2026-11-08): bridge and port priority steps, path costs in inverse proportion to speed
- [RFC 4188, Definitions of Managed Objects for Bridges](https://www.rfc-editor.org/rfc/rfc4188.txt) (read 2026-11-08): a Proposed Standard, neither obsoleted nor updated
- [RFC 9542, IANA Considerations and IETF Protocol and Documentation Usage for IEEE 802 Parameters](https://www.rfc-editor.org/rfc/rfc9542.txt) (read 2026-11-08): BCP 141, which obsoletes RFC 7042; the documentation MAC block and the group bit
- [IEEE SA, IEEE 802.1D-2004](https://standards.ieee.org/ieee/802.1D/3387/) (read 2026-11-08): Superseded Standard, superseded by 802.1Q-2014; [IEEE 802.1Q-2022](https://standards.ieee.org/ieee/802.1Q/10323/): Active Standard
- [Juniper, spanning tree protocols overview](https://www.juniper.net/documentation/us/en/software/junos/stp-l2/topics/topic-map/spanning-tree-overview.html), [cost](https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/statement/cost-edit-protocols-stp.html) and [show spanning-tree interface](https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/command/show-stp-interface-command.html) (read 2026-11-08)
- [MikroTik RouterOS 7.24, Bridging and Switching](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/) and [Spanning Tree Protocol](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/user-guides/spanning-tree-protocol/) (read 2026-11-08)
- [Extreme Switch Engine 33.7.1, configure stpd ports cost](https://documentation.extremenetworks.com/Switch%20Engine%20v33.7.1%20Command%20References/content/documents/Switch_Operating_Systems/Switch_Engine/Command_References/configure_stpd_ports_cost.shtml) and [configure stpd priority](https://documentation.extremenetworks.com/Switch%20Engine%20v33.7.1%20Command%20References/content/documents/Switch_Operating_Systems/Common_EXOS_Switch_Engine/33.4.1/configure_stpd_priority.shtml); [Extreme Fabric Engine 9.4, Configure Multiple Spanning Tree Protocol](https://documentation.extremenetworks.com/Fabric%20Engine%20v9.4%20User%20Guide/fe_9.4_ug_revacdev/content/documents/Switch_Operating_Systems/VOSS_and_Fabric_Engine/fabric_engine_user_guide/configuring_multiple_spanning_tree_protocol.shtml) (read 2026-11-08)
- [Cisco, Catalyst 9300 IOS XE 17.18, Configuring Spanning Tree Protocol](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/17-18/configuration_guide/lyr2/b_1718_lyr2_9300_cg/configuring_spanning_tree_protocol.html), [the 26.x edition](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/26-x/configuration_guide/lyr2/b_26x_lyr2_9300_cg/configuring_spanning_tree_protocol.html), [STP Configuration Guide, IOS XE 17](https://www.cisco.com/c/en/us/td/docs/switches/lan/c9000/lyr2-fwd/stp/stp-configuration-guide/m-stp.html) and [document 225591](https://www.cisco.com/c/en/us/support/docs/lan-switching/per-vlan-spanning-tree-plus-pvst-/225591-troubleshoot-stp-root-inconsistency-due.html) (read 2026-11-08 through a reader, because the site refused a direct download)
- [HPE Aruba Networking, AOS-CX 10.16, spanning-tree cost](https://arubanetworking.hpe.com/techdocs/AOS-CX/10.16/HTML/l2_bridging_6300-6400/Content/Chp_stp/mstp_cmds/spa-tre-cos.htm) and [Arista EOS 4.37.0F, Spanning Tree Protocol](https://www.arista.com/en/um-eos/eos-spanning-tree-protocol) (read 2026-11-08 through a reader, because the sites refused a direct download)
- [Cisco, Catalyst 9300 Command Reference, IOS XE 17.18, Layer 2/3 Commands](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/17-18/command_reference/b_1718_9300_cr/layer_2_3_commands.html) and [the 26.x edition](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/26-x/command_reference/b_26x_9300_cr/layer_2_3_commands.html) (read 2026-11-08 in a browser: the site refuses automated reads): spanning-tree pathcost method, spanning-tree cost, show spanning-tree
- [Huawei, S5700 and S6700 V200R025C00 Command Reference, STP/RSTP/MSTP/VBST Configuration Commands](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/9ccc5041/stp-rstp-mstp-vbst-configuration-commands) (read 2026-11-08 in a browser: the site refuses automated reads): stp pathcost-standard (Table 5-92), stp cost, stp mode
- [Cisco Networking Academy, Scaling Networks Companion Guide, Cisco Press, 2014, chapter 2](https://ptgmedia.pearsoncmg.com/images/9781587133282/downloads/9781587133282%20_chapter_2.pdf) (read 2026-11-08): Table 2-1, the short costs
- [RFC Editor, RFC index (XML)](https://www.rfc-editor.org/rfc-index.xml) (read 2026-11-08): the status of RFC 4188, RFC 9542 and RFC 7042
- [RFC 3986, Uniform Resource Identifier (URI): Generic Syntax](https://www.rfc-editor.org/rfc/rfc3986) (read 2026-11-08): section 3.5, the fragment, which carries a Share results link's values

## Standards and references

- [IEEE 802.1, ieee802-dot1q-rstp YANG module, revision 2025-02-04: bridge-id (4-bit priority, 12-bit system ID extension, 48-bit address), port-id (4-bit priority, 12-bit port number), port-role, root-path-cost, port-path-cost (1 to 200000000)](https://grouper.ieee.org/groups/802/1/files/public/YANGs/ieee802-dot1q-rstp.yang) - the bridge ID and port ID layouts, the four port roles, the root path cost and the port path cost range
- [IEEE 802.1, IEEE8021-SPANNING-TREE-MIB, LAST-UPDATED 2022-11-08 (published with IEEE 802.1Q-2022): ieee8021SpanningTreePriority, ...PortPriority, ...PortPathCost](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-SPANNING-TREE-MIB-202211080000Z.mib) - bridge priority 0 to 61440 in steps of 4096 and port priority 0 to 240 in steps of 16 on 802.1t or 802.1w bridges; port path costs "in inverse proportion to the speed of the attached LAN" (Table 13-4 of 802.1Q)
- [RFC 4188, Definitions of Managed Objects for Bridges, September 2005: dot1dStpPriority, dot1dBaseBridgeAddress, dot1dStpPortPriority, dot1dStpPortPathCost, dot1dStpPortPathCost32, dot1dStpPortState](https://www.rfc-editor.org/rfc/rfc4188.txt) - the 802.1t priority steps and the 16-bit 802.1D-1998 priority; the unique bridge address; the port ID octets; path costs 1 to 65535 and 1 to 200000000; the blocking and forwarding states
- [RFC 9542, IANA Considerations and IETF Protocol and Documentation Usage for IEEE 802 Parameters, April 2024 (BCP 141, obsoletes RFC 7042): sections 2.1.1 and 2.1.4](https://www.rfc-editor.org/rfc/rfc9542.txt) - the documentation MAC block 00-00-5E-00-53-00 to 00-00-5E-00-53-FF used by the Examples, and the group (M) bit
- [IEEE SA, IEEE 802.1D-2004, Media Access Control (MAC) Bridges: Superseded Standard, published 2004-06-09, superseded by 802.1Q-2014](https://standards.ieee.org/ieee/802.1D/3387/) - where 802.1D-2004 stands: superseded by 802.1Q-2014
- [IEEE SA, IEEE 802.1Q-2022, Bridges and Bridged Networks: Active Standard, published 2022-12-22](https://standards.ieee.org/ieee/802.1Q/10323/) - the current home of RSTP and MSTP
- [Juniper Networks, Spanning Tree Protocols User Guide, Junos OS: spanning tree protocols overview (bridge priority, root and designated bridge election, port roles and states)](https://www.juniper.net/documentation/us/en/software/junos/stp-l2/topics/topic-map/spanning-tree-overview.html) - lowest bridge ID is root, lowest MAC on equal priorities; equal path cost goes to the lowest bridge ID for the designated bridge; root, designated, alternate and backup roles; alternate and backup ports discard
- [Juniper Networks, Junos OS CLI Reference: cost (Protocols STP, RSTP, VSTP, MSTP)](https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/statement/cost-edit-protocols-stp.html) - "The link cost is determined by the link speed"; range 1 through 200,000,000
- [Juniper Networks, Junos OS CLI Reference: show spanning-tree interface (example output)](https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/command/show-stp-interface-command.html) - port cost 20000 on a ge- interface and 2000 on xe- interfaces in the example output; port ID and designated port ID as priority and number
- [MikroTik, RouterOS Manual 7.24: Bridging and Switching (bridge settings: priority, protocol-mode, port-cost-mode; port settings: path-cost, priority)](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/) - port-cost-mode long or short, Default: long, with the long and short costs for 10 Mb/s to 100 Gb/s; priority in steps of 4096 recommended
- [MikroTik, RouterOS Manual 7.24: Spanning Tree Protocol user guide (default values, election process)](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/user-guides/spanning-tree-protocol/) - root path cost as the sum of port path costs; root port by lowest root path cost, then lowest bridge identifier, then lowest bridge port ID of the upstream device; RouterOS before 7.13 gave every port 10
- [Extreme Networks, Switch Engine v33.7.1 Command References: configure stpd ports cost](https://documentation.extremenetworks.com/Switch%20Engine%20v33.7.1%20Command%20References/content/documents/Switch_Operating_Systems/Switch_Engine/Command_References/configure_stpd_ports_cost.shtml) - default costs 2,000,000, 200,000, 20,000 and 2,000 for 10 Mb/s to 10 Gb/s; 100, 19, 4 and 2 in ExtremeXOS 11.5 and earlier; the 802.1D-2004 versus 802.1D-1998 warning; 1 to 65,535 on 802.1D-1998 bridges
- [Extreme Networks, Switch Engine v33.7.1 Command References: configure stpd priority](https://documentation.extremenetworks.com/Switch%20Engine%20v33.7.1%20Command%20References/content/documents/Switch_Operating_Systems/Common_EXOS_Switch_Engine/33.4.1/configure_stpd_priority.shtml) - priority 0 to 61,440 in steps of 4,096 in dot1t priority mode, in steps of 1 in dot1d mode; extended-system-id 0 to 4095
- [Extreme Networks, Fabric Engine v9.4 User Guide: Configure Multiple Spanning Tree Protocol](https://documentation.extremenetworks.com/Fabric%20Engine%20v9.4%20User%20Guide/fe_9.4_ug_revacdev/content/documents/Switch_Operating_Systems/VOSS_and_Fabric_Engine/fabric_engine_user_guide/configuring_multiple_spanning_tree_protocol.shtml) - spanning-tree mstp pathcost-type bits16 or bits32, "The default is 32 bits."
- [Cisco, Layer 2 Configuration Guide, Cisco IOS XE 17.18.x (Catalyst 9300 Switches): Configuring Spanning Tree Protocol (read via WebFetch: the site refused curl)](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/17-18/configuration_guide/lyr2/b_1718_lyr2_9300_cg/configuring_spanning_tree_protocol.html) - the 4-bit priority and 12-bit extended system ID equal to the VLAN ID; priority 0 to 61440 in steps of 4096; the default port costs by speed (2000000 for 10 Mbps to 2 for 10 Tbps); "The short path cost method is the default STP path cost method used"; the lowest interface number on equal cost; the port roles
- [Cisco, Layer 2 Configuration Guide, Cisco IOS XE 26.x (Catalyst 9300): Configuring Spanning Tree Protocol (read via WebFetch: the site refused curl)](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/26-x/configuration_guide/lyr2/b_26x_lyr2_9300_cg/configuring_spanning_tree_protocol.html) - the same note (short is the default method) and the same default cost table as 17.18
- [Cisco, STP Configuration Guide, Cisco IOS XE 17: Spanning Tree Protocol (updated 17 July 2026) (read via WebFetch: the site refused curl)](https://www.cisco.com/c/en/us/td/docs/switches/lan/c9000/lyr2-fwd/stp/stp-configuration-guide/m-stp.html) - "The short path cost method is the default STP path cost method", beside a default cost table on the long scale
- [Cisco, Command Reference, Cisco IOS XE 17.18.x (Catalyst 9300 Switches): Layer 2/3 Commands, spanning-tree pathcost method, spanning-tree cost, show spanning-tree (read in a browser on 2026-11-08: the site refuses automated reads)](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/17-18/command_reference/b_1718_9300_cr/layer_2_3_commands.html) - spanning-tree pathcost method: "Command Default: short", long and short as the 32-bit and 16-bit default port costs; spanning-tree cost 1 to 200000000; the show spanning-tree summary example prints "Configured Pathcost method used is long" and the detail example "Port path cost 20000"
- [Cisco, Command Reference, Cisco IOS XE 26.x.x (Catalyst 9300 Switches): Layer 2/3 Commands, spanning-tree pathcost method (read in a browser on 2026-11-08: the site refuses automated reads)](https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/26-x/command_reference/b_26x_9300_cr/layer_2_3_commands.html) - the same "Command Default: short" as 17.18
- [Huawei, S5700 and S6700 V200R025C00 Command Reference: STP/RSTP/MSTP/VBST Configuration Commands, stp pathcost-standard (Table 5-92), stp cost, stp mode (read in a browser on 2026-11-08: the site refuses automated reads)](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/9ccc5041/stp-rstp-mstp-vbst-configuration-commands) - "By default, the IEEE 802.1t is used to calculate the path cost"; stp pathcost-standard { dot1d-1998 | dot1t | legacy }; Table 5-92 by rate and mode (full duplex: 1 Gbit/s 4 and 20,000, 2.5 Gbit/s 3 and 8000, 10 Gbit/s 2 and 2000, 40 Gbit/s 1 and 500; one less at 10 and 100 Mbit/s full duplex; aggregated links lower); changing the standard restores every port's default cost; stp cost 1 to 200,000,000 under 802.1t; MSTP is the default mode
- [Cisco, Troubleshoot STP Root Inconsistency Due to Path Cost Mismatch, document 225591, updated 11 March 2026 (read via WebFetch: the site refused curl)](https://www.cisco.com/c/en/us/support/docs/lan-switching/per-vlan-spanning-tree-plus-pvst-/225591-troubleshoot-stp-root-inconsistency-due.html) - spanning-tree pathcost method long; a switch on short costs among switches on long costs, fixed by changing it to long
- [HPE Aruba Networking, AOS-CX 10.16 Layer-2 Bridging Guide (6300/6400): spanning-tree cost (read via WebFetch: the site refused curl)](https://arubanetworking.hpe.com/techdocs/AOS-CX/10.16/HTML/l2_bridging_6300-6400/Content/Chp_stp/mstp_cmds/spa-tre-cos.htm) - range 1 to 200,000,000; default by link speed, 2,000,000 for 10 Mbps to 20 for 1 Tbps; no method command on the page
- [Arista Networks, EOS 4.37.0F User Manual: Spanning Tree Protocol (read via WebFetch: the site refused curl)](https://www.arista.com/en/um-eos/eos-spanning-tree-protocol) - 1 gigabit 20000 and 10 gigabit 2000 by default, 1 to 200000000; priority multiples of 4096; the bridge ID's 12-bit field (VLAN for Rapid-PVST, instance for MST, 0 for RST); the lower interface number on equal port priority; no method setting
- [Cisco Networking Academy, Scaling Networks Companion Guide, Cisco Press, 2014 (ISBN 978-1-58713-328-2), chapter 2: Table 2-1](https://ptgmedia.pearsoncmg.com/images/9781587133282/downloads/9781587133282%20_chapter_2.pdf) - the short costs 100, 19, 4 and 2 for 10 Mb/s to 10 Gb/s
- [RFC Editor, RFC index (XML): the current status of RFC 4188, RFC 9542 and RFC 7042](https://www.rfc-editor.org/rfc-index.xml) - RFC 4188 is a Proposed Standard, neither obsoleted nor updated; RFC 9542 (BCP 141) obsoletes RFC 7042
- [RFC 3986, Uniform Resource Identifier (URI): Generic Syntax, January 2005: section 3.5 (fragment)](https://www.rfc-editor.org/rfc/rfc3986.txt) - the fragment that carries a Share results link's values is not sent to the server

## Related reading

- [BUM traffic, loops and broadcast storms: why one cable can stop a LAN, and what bounds it](https://ronutz.com/en/learn/bum-traffic-loops-and-broadcast-storms.md): A switch floods three kinds of frame because its table cannot place them: broadcast, unknown unicast and multicast, which the EVPN standard abbreviates BUM. Flooding is how a LAN works, and it is also how a LAN dies: Ethernet has no hop count, so a flooded frame caught in a loop never stops. Where unknown unicast comes from (a 4-hour ARP timer against a 5-minute MAC timer, worked through), why a loop of two switches fills slowly while a mesh of four doubles every hop (computed by hand), what a storm does to tables and processors, and the protections in layers: spanning tree, the edge guards, the loop detection protocols of H3C, Huawei, Extreme and Aruba, storm control on six platforms with its units and steps, and design. With the 2007 outage at Los Angeles airport from the Inspector General's report, and the Brazilian exchange points' broadcast rules and a unicast storm presented at GTER.
- [Layer 2 redundancy: LAG, MLAG and spanning tree](https://ronutz.com/en/learn/layer-2-redundancy-lag-mlag-and-spanning-tree.md): Redundant links at layer 2 either get blocked by spanning tree or bundled by link aggregation, and a bundle that ends on two switches needs a pair that agrees on who it is. The numbers behind STP and RSTP convergence, the guards that stop loops, multi-chassis link aggregation in five vendors' own documents, stacking and virtual chassis, the IEEE's DRNI, and EVPN multihoming as the standard answer. After reading, you can predict how each design fails, compute its timers, and know what to test before you trust it.
- [MAC flooding and STP root takeover: two ways to make the switch carry traffic the wrong way](https://ronutz.com/en/learn/mac-flooding-and-stp-root-takeover.md): ARP poisoning lies to hosts; these two attacks lie to the switch. MAC flooding fills the table a switch learns addresses into, so that it floods what it can no longer place; a spanning tree root claim wins an election that believes the lowest number it hears, so that the network's paths bend towards the claimant. This part works both through with the tables and the 35 bytes of a bridge protocol data unit written out by hand, gives the measured numbers from the 2002 Cisco and @stake tests and the 2023 Linux bridge limit, and sets out the guards (port security, MAC limits, BPDU guard, root guard, restricted topology change) from the vendors' own documents and the IEEE model, with their defaults. After reading, you can estimate how long a table takes to fill, say which traffic leaks and which does not, decode a configuration BPDU, predict the election it causes, and choose the guard for each kind of port.
- [Redundant architectures: how networks survive failure](https://ronutz.com/en/learn/redundant-architectures-how-networks-survive-failure.md): Redundancy is a second way to perform a function, paid for in equipment, complexity and testing, and it helps only against failures that cannot reach both ways at once. This article maps the failure domains from a power supply to a cloud region, walks the layers where networks add redundancy (power and paths, layer 2, the first hop, layer 3, stateful devices, application delivery and global load balancing, data and services, operations) with the time each needs to notice a failure, and reads twelve operators' and regulators' reports on outages in which redundancy did not hold. After reading, you can place any redundancy mechanism in its layer and failure domain, estimate how long it takes to fail over, and ask the questions that find a shared fate before an outage does.
- [Spanning tree in one article: why a blocked port is the feature, and how RSTP and MSTP made it fast](https://ronutz.com/en/learn/spanning-tree-in-one-article.md): Redundant links between switches make loops, and Ethernet has nothing in its header to stop a frame circling forever. The Spanning Tree Protocol solves it by electing a root and blocking every port the tree does not need. The election, the costs and the timers, the 30 to 50 seconds classic STP took to recover, the handshake that made RSTP fast, the regions and instances of MSTP, Cisco's per-VLAN variants and guards, and the engineer who wrote the algorithm's abstract as a poem.
