# Calcolatore dell’elezione spanning tree

> Il root bridge, ogni porta root, ogni porta designata e le porte che restano alternative o di backup in una piccola rete di switch descritta in poche righe, ogni passaggio con il confronto che lo ha deciso; e i path cost long (802.1t) e short (802.1D-1998) per velocità del link, con il valore predefinito documentato da ogni vendor.

- Tool: https://ronutz.com/it/tools/stp-election-calculator
- Family: Reti

---

## Cosa fa

Lo STP (Spanning Tree Protocol) e il suo successore rapido, l’RSTP (Rapid Spanning Tree Protocol), mantengono senza loop una rete di switch con link ridondanti: gli switch eleggono un root bridge, ogni altro switch conserva la sua porta migliore verso il root bridge, ogni segmento conserva una porta che inoltra verso di esso, e ogni porta rimasta smette di inoltrare. L’elezione è determinata da confronti che chiunque può fare su carta, e il calcolatore li esegue per una piccola rete che descrivi in poche righe, in due modalità:

- **Elezione.** Per un numero di bridge da 2 a 16 e i link tra le loro porte: il root bridge, la porta root di ogni altro bridge, la porta designata di ogni segmento e le porte che restano alternative o di backup, ciascuna con il confronto che l’ha decisa, nell’ordine in cui lo insegna il corso «LAN Switch Operations and Maintenance» nel capitolo 2.4 (eleggere il root bridge, assegnare i path cost, trovare il bridge designato di ogni segmento, identificare porte root e porte designate, bloccare le altre).
- **Costo per velocità.** Per una velocità del link: i path cost di porta long (32 bit) e short (16 bit) indicati dai documenti consultati per lo strumento, quali documenti li indicano, e il metodo predefinito documentato da ogni vendor con il comando che lo cambia.

Tutto viene calcolato nel tuo browser.

## Elezione: la topologia

Un’istruzione per riga; un `#` inizia un commento, le righe vuote vengono ignorate e le parole chiave e i nomi dei bridge vengono letti senza distinguere maiuscole e minuscole.

```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**: un nome (una lettera, poi fino a 15 lettere, cifre, punti, trattini o trattini bassi), una priorità del bridge e un indirizzo MAC (Media Access Control) con due punti o trattini, in tre gruppi separati da punti, o come dodici cifre esadecimali. Terminare la riga con `short` o `long` assegna a quel bridge un proprio metodo di path cost; altrimenti usa il metodo scelto sopra la casella.
- **link**: due porte scritte come `bridge:port`, poi una velocità (10M, 100M, 1G, 10G, 25G, 40G, 50G, 100G, 1T o 10T, anche nella forma `1 Gb/s` o `1gbps`) oppure la parola `cost` e un numero. Tre o più porte sulla stessa riga formano un segmento condiviso, come attraverso un hub; due porte dello stesso bridge sulla stessa riga sono un cavo collegato ad anello tra le due.
- **port**: una porta già presente su un link, poi `priority` e un valore, `cost` e un valore, o entrambi.
- **vlan**: la VLAN di cui stai calcolando l’albero; il suo ID viene sommato a ogni priorità del bridge come system ID extension.
- **priority-format 802.1d**: le priorità del bridge a 16 bit dell’802.1D-1998, per i bridge che accettano qualsiasi valore da 0 a 65535.

Lo strumento legge fino a 16 bridge, 32 link, 8 porte per segmento, 128 porte in tutto, 80 righe e 4000 caratteri. Il path cost di una porta viene, in quest’ordine, da una riga `port`, da un costo inserito sul suo link oppure dalla velocità del link e dal metodo del suo bridge.

## Elezione: le regole che applica

**Identificatori.** Un bridge ID è formato da una priorità configurabile nei quattro bit più significativi, da una system ID extension nei bit successivi e dal Bridge Address nei bit restanti («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», [modulo YANG RSTP di IEEE 802.1Q](https://grouper.ieee.org/groups/802/1/files/public/YANGs/ieee802-dot1q-rstp.yang), revisione 2025-02-04), quindi sui bridge che seguono l’802.1t o l’802.1w la priorità ammette solo multipli di un passo fisso («permissible values are 0-61440, in steps of 4096», [RFC 4188](https://www.rfc-editor.org/rfc/rfc4188.txt), dot1dStpPriority; lo stesso nel [MIB spanning tree](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-SPANNING-TREE-MIB-202211080000Z.mib) dell’IEEE). Gli alberi per VLAN di Cisco mettono la VLAN nell’extension, un valore di system ID esteso pari all’ID della VLAN («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)), e il manuale di Arista indica il numero di VLAN per Rapid-PVST, il numero di istanza per MST e 0 per un unico albero RSTP ([Arista EOS 4.37.0F](https://www.arista.com/en/um-eos/eos-spanning-tree-protocol)). Un port ID è formato da una priorità nei quattro bit più significativi e da un numero di porta del bridge a dodici bit («a priority in the four most-significant bits, and a twelve-bit Bridge Port number», modulo YANG dell’IEEE), quindi le priorità di porta vanno da 0 a 240 a passi di 16 (RFC 4188, dot1dStpPortPriority). La pagina stampa gli ID come fanno gli switch: 32778.00-00-5E-00-53-01 per un bridge ID, 128.4 per un port ID.

**1. Il root bridge.** Viene eletto root bridge il bridge con il bridge ID più basso e, a parità di priorità o se la priorità non è configurata, quello con l’indirizzo MAC più basso («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)). La pagina elenca tutti i bridge in ordine di bridge ID e dice se a decidere è stata la priorità o l’indirizzo MAC. Quando tutti i bridge hanno la stessa priorità, avverte che il root bridge è stato scelto per caso: il consiglio del corso è abbassare di proposito la priorità del root bridge previsto.

**2. Costi verso il root bridge e porte root.** Il costo del percorso verso il root bridge è 0 per il root bridge stesso; per ogni altro bridge è la somma dei path cost delle porte sul percorso a costo minimo verso il root bridge («the sum of the Port Path Costs on the least-cost path to the Root Bridge»), e ogni bridge aggiunge il costo della porta su cui arriva un messaggio al costo annunciato dal vicino ([MikroTik RouterOS 7.24, guida STP](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/user-guides/spanning-tree-protocol/)). La porta root di un bridge si sceglie per costo del percorso più basso, poi bridge ID più basso, poi port ID più basso, in quest’ordine («lowest Root port path cost, lowest bridge identifier, and lowest bridge port ID in this particular order»), dove il bridge ID e il port ID sono quelli del dispositivo a monte che ha inviato la BPDU (Bridge Protocol Data Unit) (MikroTik, come sopra). Esiste un ulteriore confronto per un bridge con due porte su un segmento condiviso che ricevono dalla stessa porta a monte: decidono allora gli ID delle porte riceventi, cosa che Cisco formula come l’interfaccia con il numero più basso («the interface with the lowest interface number», Cisco, come sopra) e Arista come la porta con il numero di interfaccia più basso («the port with the lower interface number»). La pagina indica la porta root di ogni bridge, il suo costo e il confronto che l’ha decisa, con una frase che nomina entrambe le candidate.

**3. Porte designate.** Su ogni segmento è designata la porta il cui bridge ha il costo più basso verso il root bridge; a parità di costo diventa bridge designato quello con il bridge ID più basso («If two bridges have the same path cost to the root bridge, the bridge with the lowest bridge ID becomes the designated bridge», Juniper, come sopra); e tra due porte di quel bridge sul segmento decide il port ID più basso, che Cisco descrive sommando priorità e ID della porta e disattivando il link con il valore più alto («the port priority and port ID are added together, and spanning tree disables the link with the highest value»). Le porte del root bridge sono quindi designate, a meno che due di esse non condividano un segmento.

**4. Tutto il resto.** Una porta che non è né root né designata riceve una BPDU migliore di quella che invierebbe. Se quella BPDU arriva da un altro bridge, è una porta alternativa, un secondo percorso pronto verso il root bridge; se arriva da un’altra porta dello stesso bridge sullo stesso segmento, è una porta di backup, che può esistere solo dove due o più porte del bridge sono collegate alla stessa LAN di cui il bridge è il bridge designato («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, come sopra). In RSTP entrambe vengono messe nello stato discarding («placed in the discarding state», Juniper), che l’802.1D originale chiama blocking (RFC 4188, dot1dStpPortState). I quattro ruoli sono quelli dell’enumerazione port-role del modulo YANG dell’IEEE.

La pagina mostra i quattro passaggi in quest’ordine, poi una tabella di tutte le porte con il port ID, il costo e la sua provenienza, il ruolo e lo stato.

## Path cost: long e short

Si usano due scale. I valori long sono quelli a 32 bit dell’802.1t, mantenuti nell’802.1D-2004, da 1 a 200.000.000 (RFC 4188, dot1dStpPortPathCost32); i valori short sono quelli a 16 bit dell’802.1D-1998, da 1 a 65.535 (dot1dStpPortPathCost). Entrambi sono scelti in proporzione inversa alla velocità della LAN collegata («in inverse proportion to the speed of the attached LAN», RFC 4188). Gli standard IEEE non sono liberamente consultabili, quindi lo strumento usa i valori indicati nei documenti dei vendor, e li cita:

| Velocità | Long | Documentato da | Short | Documentato da |
|---|---|---|---|---|
| 10 Mb/s | 2000000 | Extreme Switch Engine, MikroTik, Cisco, HPE Aruba | 100 | Extreme (ExtremeXOS 11.5 e precedenti), MikroTik, Cisco Press |
| 100 Mb/s | 200000 | gli stessi quattro | 19 | gli stessi tre |
| 1 Gb/s | 20000 | gli stessi quattro, Arista e Huawei | 4 | gli stessi tre e Huawei |
| 2,5 Gb/s | 8000 | Huawei | 3 | Huawei |
| 10 Gb/s | 2000 | gli stessi quattro, Arista e Huawei | 2 | gli stessi tre e 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 | nessuno consultato | |
| 10 Tb/s | 2 | Cisco | nessuno consultato | |

Una velocità per cui nessun documento indica un valore (5 Gb/s, 400 Gb/s) viene rifiutata, e lo stesso vale per un costo short a 1 Tb/s o 10 Tb/s: inserisci invece il costo che usano i tuoi switch. Lo strumento non stima mai un costo.

**Mescolare le due scale.** Uno switch con costi short annuncia un costo verso il root bridge migliaia di volte più piccolo di un vicino con costi long, quindi i percorsi che lo attraversano sembrano i più economici a prescindere dalla velocità. Extreme avverte che un bridge conforme alla vecchia norma potrebbe diventare il percorso di transito più favorevole («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)), e il documento Cisco 225591 descrive una root inconsistency in cui uno switch era stato integrato nella rete con il metodo short («Switch 3 was integrated into the network utilizing the path cost method designated as 'short'») mentre gli altri usavano long, risolta con `spanning-tree pathcost method long` ([Cisco, documento 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)). La pagina avverte ogni volta che le velocità dei bridge vengono convertite in costi con entrambi i metodi; l’esempio **Metodi di costo misti** mostra uno switch di accesso la cui porta root passa per l’uplink a 100 Mb/s di un vecchio bridge invece che per quello a 10 Gb/s di un bridge più recente.

## Il valore predefinito di ogni vendor

I vendor trattati nel capitolo 2.4 del corso, con ciò che dicono i loro documenti all’8 novembre 2026:

- **Extreme Switch Engine 33.7.1**: i valori long per impostazione predefinita da ExtremeXOS 11.6 (da 2.000.000 per una porta a 10 Mbps fino a 2000 per 10 Gb/s), quelli short (100, 19, 4 e 2) in ExtremeXOS 11.5 e precedenti; nessuna opzione per cambiare metodo, e per allinearsi a un bridge 802.1D-1998 il consiglio è inserire il vecchio valore sulla porta. Per porta: `configure stpd <stpd> ports cost [auto | <cost>] <ports>`.
- **Extreme Fabric Engine 9.4**: `spanning-tree mstp pathcost-type <bits16 | bits32>`, e per impostazione predefinita si usa la variante long («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 e 26.x (Catalyst 9300)**: i documenti non concordano. Il riferimento dei comandi assegna a `spanning-tree pathcost method` un «Command Default» short in entrambe le release ([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)), e le guide di configurazione e la guida STP di IOS XE 17 (aggiornata il 17 luglio 2026) dicono che il metodo short è quello predefinito («The short path cost method is the default STP path cost method used»); eppure le tabelle della configurazione predefinita delle guide riportano «1 Gbps: 20000» e gli altri valori long, e l’esempio di `show spanning-tree summary` dello stesso riferimento dei comandi stampa «Configured Pathcost method used is long» accanto a un path cost di porta di 20000. `show spanning-tree summary` ti dice quale metodo usa uno switch. Fissa il metodo su ogni switch con `spanning-tree pathcost method long`, il comando del documento 225591. Per porta: `spanning-tree cost`, «the range is 1 to 200000000».
- **HPE Aruba Networking AOS-CX 10.16**: i valori long in base alla velocità, da «10 Mbps link speed equals a path cost of 2,000,000» a «1 Tbps link speed equals a path cost of 20»; la pagina consultata non indica alcun comando per cambiare metodo. Per porta: `spanning-tree cost`, da 1 a 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**: il costo del link è determinato dalla sua velocità («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)), senza alcuna istruzione per il metodo nelle pagine consultate; l’output di esempio di [show spanning-tree interface](https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/command/show-stp-interface-command.html) stampa 20000 su un’interfaccia ge- e 2000 sulle interfacce xe-. Per porta: `set protocols rstp interface <name> cost <cost>`.
- **MikroTik RouterOS 7.24**: `port-cost-mode` sul bridge, long o short, con long come valore predefinito («Default: long», [RouterOS 7.24, Bridging and Switching](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/)); le versioni più vecchie di RouterOS non adattano il path cost della porta alla velocità del link («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**: i costi predefiniti sono quelli long («1 gigabit interfaces have a default cost of 20000» e «10 gigabit interfaces have a default cost of 2000»); nel manuale consultato non compare alcuna impostazione del metodo. Per porta: `spanning-tree cost`.
- **Huawei VRP (S5700 e S6700 V200R025C00)**: «By default, the IEEE 802.1t is used to calculate the path cost», cioè i valori long. `stp pathcost-standard { dot1d-1998 | dot1t | legacy }` passa ai valori short o alla scala legacy di Huawei (20 per 1 Gb/s, 2 per 10 Gb/s), e cambiarlo riporta al valore predefinito il costo inserito su ogni porta. La tabella di Huawei indica 8000 long e 3 short per 2,5 Gb/s, uno in meno in full duplex a 10 e 100 Mb/s (1.999.999 e 199.999 long, 99 e 18 short) e costi più bassi per i link aggregati, quindi una porta Huawei a quelle velocità può differire dalla tabella qui sopra. Per porta: `stp [ instance <id> ] cost <cost>`, da 1 a 200.000.000 con l’802.1t ([Huawei, STP/RSTP/MSTP/VBST Configuration Commands](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/9ccc5041/stp-rstp-mstp-vbst-configuration-commands), consultato in un browser: il sito rifiuta le letture automatiche).

## Cosa rifiuta, e perché

- Una **priorità** che non è un multiplo di 4096 da 0 a 61440, a meno che la topologia non indichi `priority-format 802.1d`, nel qual caso viene letto qualsiasi valore a 16 bit; una priorità che non è un numero.
- **Due bridge con lo stesso indirizzo MAC**, che a parità di priorità avrebbero anche lo stesso bridge ID: l’indirizzo del bridge è quello che il bridge usa quando deve essere identificato in modo univoco («used by this bridge when it must be referred to in a unique fashion», RFC 4188, dot1dBaseBridgeAddress). Due bridge con lo stesso nome.
- Un **link verso un bridge che nessuna riga dichiara**, una porta su due link, un numero di porta fuori dall’intervallo da 1 a 4095 (da 1 a 255 con `priority-format 802.1d`), un link con meno di due o più di otto porte e un link senza velocità né costo.
- Una **topologia non connessa**: ogni parte separata eleggerebbe il proprio root bridge, quindi lo strumento dice quali bridge non possono raggiungere quali altri e calcola una sola rete connessa alla volta.
- Una **velocità per cui nessun documento indica un costo**, un costo short oltre i 100 Gb/s, un costo fuori dall’intervallo da 1 a 200.000.000 e un costo superiore a 65.535 su un bridge che usa i costi short (Extreme: «the path cost range setting is 1 to 65,535» sui bridge 802.1D-1998).
- Una **priorità di porta** che non è un multiplo di 16 da 0 a 240, una `vlan` fuori dall’intervallo da 1 a 4094 o insieme a `priority-format 802.1d`, qualsiasi istruzione che lo strumento non legge e i limiti indicati sopra.

Ogni rifiuto indica la riga e dice cosa le serve. Un indirizzo MAC con il bit di gruppo impostato viene calcolato, con un avviso: se il bit è a zero, l’indirizzo MAC è unicast («If it is zero, the MAC address is unicast», [RFC 9542](https://www.rfc-editor.org/rfc/rfc9542.txt), sezione 2.1.1), e l’indirizzo proprio di un bridge è unicast.

## Esempi svolti

- **L’Esempio** è l’esempio svolto del capitolo 2.4 del corso aperto [LAN Switch Operations and Maintenance](https://ronutz.com/it/materials/lan-switch-operations-and-maintenance), slide 259: sei bridge con gli ID da 80-00:1 a 80-00:6 (priorità 32768, indirizzi MAC crescenti da 1 a 6, qui nell’intervallo di documentazione da 00-00-5E-00-53-00 a 00-00-5E-00-53-FF della RFC 9542), path cost uguali (ogni link a 1 Gb/s, 20000) e due link tra il Bridge 3 e il Bridge 6. B1 è il root bridge, scelto per indirizzo MAC. B5 raggiunge il root bridge con costo 40000 attraverso B2 e attraverso B4; la BPDU di B2 ha il bridge ID più basso, quindi B5:1 è la sua porta root e B5:2 è una porta alternativa. B6 riceve due volte da B3 e una volta da B5, sempre con costo 60000: B3 ha un bridge ID più basso di B5, e tra le due porte di B3 il port ID del mittente più basso, 128.2 contro 128.3, rende B6:1 la porta root, quindi B6:2 e B6:3 sono porte alternative, esattamente le tre porte bloccate della slide.
- **Laboratorio della sezione Imparare, costi short**: il quadrato con una diagonale del laboratorio dell’articolo, con B-D a 100 Mb/s (costo 19): A è il root bridge, la porta root di C è diretta, e D raggiunge il root bridge attraverso C con costo 8 invece che attraverso B con costo 23.
- **Porta di backup su un hub**: SW1 è il root bridge per priorità e ha due porte su un unico segmento condiviso: SW1:2 è designata per il suo port ID più basso, SW1:3 è una porta di backup e SW2:2, che raggiunge il root bridge a un costo minore tramite il suo link a 10 Gb/s, è una porta alternativa.
- **Metodi di costo misti**: ROOT raggiunge OLD a 100 Mb/s e NEW a 10 Gb/s; OLD usa i costi short. La porta root di ACC passa per OLD (19 + 20000 = 20019) invece che per NEW (2000 + 20000 = 22000); con OLD sui costi long (200000), ACC sceglierebbe NEW.
- **VLAN 10, root bridge scelto di proposito**: la rete dell’Esempio con B5 a 4096 e una riga `vlan 10`: ogni campo della priorità aumenta di 10 (4106 per B5, 32778 per gli altri), e B5 diventa il root bridge.
- **Costo per velocità**: 1 Gb/s dà 20000 long e 4 short, il 20000 che la slide 266 del corso mostra su ge.2.1 e ge.2.4.

## Cosa non fa

Calcola il risultato stabile su cui concordano tutti i bridge, non il modo in cui la rete ci arriva. Non modella timer e convergenza, l’handshake di proposal e agreement, le edge port, i tipi di link, i cambi di topologia, le regioni e le istanze MSTP (Multiple Spanning Tree Protocol), PVST+ (Per-VLAN Spanning Tree Plus) oltre l’albero di una sola VLAN, i link guasti, né BPDU Guard, Root Guard e Loop Guard. Non comunica con alcuno switch. Per esercitarti con le stesse regole su una rete nuova ogni giorno, gioca all’[enigma Spanning Tree](https://ronutz.com/it/dev/fun/spanning-tree); l’articolo [Spanning tree in one article](https://ronutz.com/it/learn/spanning-tree-in-one-article) spiega il protocollo e include un laboratorio con quattro switch.

## Condivisione dei risultati

Sotto il verdetto, **Condividi i risultati** crea un link a questa pagina, solo quando lo premi, che contiene dopo il `#` la modalità e i campi della modalità visualizzata, così come li hai inseriti: `mode` (`election` o `cost`); nella modalità Elezione `method` (`long` o `short`) e `topology`, le righe così come le hai inserite; nella modalità Costo per velocità `speed`. I campi dell’altra modalità non sono inclusi. Nella modalità Elezione il riquadro a comparsa aggiunge un’avvertenza: i nomi dei bridge e gli indirizzi MAC possono descrivere una rete reale, quindi rileggili prima di inviare il link.

La [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) (sezione 3.5, consultata l’08/11/2026) descrive il frammento come la parte di un riferimento che si usa solo dopo aver recuperato il documento: l’identificatore di frammento non entra nell’elaborazione specifica dello schema e viene separato dal resto dell’URI prima della dereferenziazione («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»). Questi valori quindi non vengono inviati al server quando si apre il link; restano nella barra degli indirizzi e nella cronologia di chi lo apre, e chiunque abbia il link può leggerli.

- **Lunghezza massima.** Un link contiene al massimo 16.384 caratteri, il limite che il sito applica a ogni valore dopo il `#`; una topologia ne contiene al massimo 4000.
- **Apertura di un link.** La modalità e i suoi campi vengono impostati come se li inserissi tu (un link senza `method` vale long), l’altra modalità conserva i suoi valori e la pagina esegue il calcolo. Un link con una modalità o un metodo sconosciuti, un campo dell’altra modalità, un campo obbligatorio mancante o vuoto, una topologia più lunga di 4000 caratteri, o una velocità su due righe o più lunga di 24 caratteri viene ignorato. Accettati o no, i valori poi lasciano subito l’indirizzo della pagina, senza alcuna richiesta.

## Provenienza

Il motore è un calcolo del percorso più breve e tre ordinamenti, senza orologio, senza rete e senza casualità. Include 178 vettori di test di riferimento (golden vectors, set `stp-election-calculator-golden-2026-11-08b`): 78 elezioni (l’Esempio, i quattro esempi pronti, quattordici varianti e sessanta topologie casuali generate da un seme, che insieme mettono alla prova ogni criterio di spareggio: il root bridge per priorità e per indirizzo MAC; le porte root per costo, bridge ID del mittente, port ID del mittente e ID della porta ricevente; le porte designate per costo, bridge ID e port ID; 22 porte di backup), 22 ricerche di costo e 78 casi descritti per esteso (frasi, grafie, l’API e 59 rifiuti). Ogni root bridge, ruolo, costo e porta root attesi sono stati ricavati da un’implementazione separata, non eseguendo questo motore: un programma Python che legge le tabelle dei costi dai documenti salvati ed esegue l’elezione scambiando messaggi tra le porte finché nessun bridge cambia idea, poi assegna il ruolo di ogni porta confrontando ciò che invierebbe con ciò che riceve. Quattro errori introdotti di proposito nel motore (gli ultimi due criteri di spareggio scambiati, il costo della porta mittente sommato al posto di quello della porta ricevente, il confronto per la porta designata riordinato, il ruolo di backup rimosso) hanno fatto fallire ciascuno tra 3 e 21 vettori.

## API

Lo stesso motore risponde a `/api/v1/stp-election-calculator` nell’API HTTP del sito; il contratto si trova nella [pagina dell’API](https://ronutz.com/it/api), che indica anche se questo sito serve l’API.

- **Richiesta.** Un oggetto JSON. Elezione: `{"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"}`, con `method` facoltativo (long per impostazione predefinita). Costo: `{"mode": "cost", "speed": "1G"}`.
- **Risposta, elezione.** `mode`, `method`, `methodDefault`, `priorityFormat`, `vlan`, `bridges` (ciascuno: `index`, `name`, `priority`, `extension`, `priorityField`, `mac`, `bridgeId`, `bridgeIdHex`, `method`, `methodSet`, `rank`, `isRoot`, `rootPathCost`, `rootPort`), `ports` (ciascuna: `index`, `bridge`, `bridgeName`, `number`, `priority`, `portId`, `portIdValue`, `segment`, `cost`, `costSource`, `speed`, `role`, `forwarding`, `designatedPort`), `segments`, `root`, `rootStep`, `rootPortSteps` (con ogni candidata), `designatedSteps` (con ogni candidata), `blockedSteps`, `counts`, `verdictText`, `warnings` e `notes`.
- **Risposta, costo.** `mode`, `speed` (`id`, `mbps`, `label`, `long` e `short`, ciascuno con `value` e `sources`, oppure null), `table` (ogni velocità), `vendors` (ciascuno: `id`, `platform`, `defaultMethod`, `change`, `perPort`, `sources`, `valueAtSpeed`, `text`), `verdictText` e `notes`.
- **Errori.** HTTP 400, `invalid_input`, con il messaggio del motore, ad esempio `Line 1: A: priority 32769 is not a multiple of 4096 from 0 to 61440. ...`.

## Fonti

- [IEEE 802.1, modulo YANG ieee802-dot1q-rstp, revisione 2025-02-04](https://grouper.ieee.org/groups/802/1/files/public/YANGs/ieee802-dot1q-rstp.yang) (consultato l’08/11/2026): 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) (consultato l’08/11/2026): i passi delle priorità di bridge e di porta, i path cost in proporzione inversa alla velocità
- [RFC 4188, Definitions of Managed Objects for Bridges](https://www.rfc-editor.org/rfc/rfc4188.txt) (consultata l’08/11/2026): una Proposed Standard, né resa obsoleta né aggiornata
- [RFC 9542, IANA Considerations and IETF Protocol and Documentation Usage for IEEE 802 Parameters](https://www.rfc-editor.org/rfc/rfc9542.txt) (consultata l’08/11/2026): BCP 141, che rende obsoleta la RFC 7042; il blocco MAC di documentazione e il bit di gruppo
- [IEEE SA, IEEE 802.1D-2004](https://standards.ieee.org/ieee/802.1D/3387/) (consultato l’08/11/2026): Superseded Standard, sostituito dall’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) e [show spanning-tree interface](https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/command/show-stp-interface-command.html) (consultati l’08/11/2026)
- [MikroTik RouterOS 7.24, Bridging and Switching](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/) e [Spanning Tree Protocol](https://manual.mikrotik.com/docs/7.24/bridging-and-switching/user-guides/spanning-tree-protocol/) (consultati l’08/11/2026)
- [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) e [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) (consultati l’08/11/2026)
- [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), [l’edizione 26.x](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) e [documento 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) (consultati l’08/11/2026 tramite un lettore, perché il sito ha rifiutato il download diretto)
- [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) e [Arista EOS 4.37.0F, Spanning Tree Protocol](https://www.arista.com/en/um-eos/eos-spanning-tree-protocol) (consultati l’08/11/2026 tramite un lettore, perché i siti hanno rifiutato il download diretto)
- [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) e [l’edizione 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) (consultati l’08/11/2026 in un browser: il sito rifiuta le letture automatiche): 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) (consultato l’08/11/2026 in un browser: il sito rifiuta le letture automatiche): stp pathcost-standard (Table 5-92), stp cost, stp mode
- [Cisco Networking Academy, Scaling Networks Companion Guide, Cisco Press, 2014, capitolo 2](https://ptgmedia.pearsoncmg.com/images/9781587133282/downloads/9781587133282%20_chapter_2.pdf) (consultato l’08/11/2026): Table 2-1, i costi short
- [RFC Editor, RFC index (XML)](https://www.rfc-editor.org/rfc-index.xml) (consultato l’08/11/2026): lo stato della RFC 4188, della RFC 9542 e della RFC 7042
- [RFC 3986, Uniform Resource Identifier (URI): Generic Syntax](https://www.rfc-editor.org/rfc/rfc3986) (consultata l’08/11/2026): sezione 3.5, il frammento, che contiene i valori di un link creato con Condividi i risultati

## 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.
