STPのプライオリティ設定の必要性について、CMLで環境を構築し説明します。
ネットワーク構成
CMLで下記の環境を構築します。全スイッチでVLAN1のSTPが有効で、プライオリティ値はデフォルトの”32768″となっています。
初期構築時のSTPの収束に関しては、下記を参照してください。

hostname L2SW-A
spanning-tree vlan 1
hostname L2SW-B
spanning-tree vlan 1
hostname L2SW-C
spanning-tree vlan 1
hostname L2SW-D
spanning-tree vlan 1
hostname Server1
ifconfig eth0 192.168.100.1 netmask 255.255.255.0 up
route add -net 0.0.0.0/0 dev eth0
hostname PC1
ifconfig eth0 192.168.100.100 netmask 255.255.255.0 up
route add -net 0.0.0.0/0 dev eth0
構成変更時のSTP動作(プライオリティ設定前)
ネットワーク構成変更
このネットワークに新規スイッチ(L2SW-E)が追加されることを想定し、STPの動作を確認します。

構成変更前の通信経路
構成変更前のPC1からServer1への通信経路は下記の通りです。

PC1からServer1へ連続Pingを実施し、通信断時間を測定します。
ping 192.168.1.1
PC1:~$ ping 192.168.100.1
PING 192.168.100.1 (192.168.100.1): 56 data bytes
64 bytes from 192.168.100.1: seq=0 ttl=42 time=48.083 ms
64 bytes from 192.168.100.1: seq=1 ttl=42 time=40.071 ms
64 bytes from 192.168.100.1: seq=2 ttl=42 time=29.111 ms
新規スイッチの接続
新規スイッチの接続前に、全てのスイッチでSTPのデバッグを有効にします。
debug spanning-tree events
L2SW-CとL2SW-EのGi0/2同士を接続します。

ルートブリッジの再選出
全スイッチのプライオリティ値はデフォルト設定のため、MACアドレスが一番小さいL2SW-Eがルートブリッジに選出されます。

各スイッチのデバッグ確認
各スイッチで、L2SW-EからのBPDUを認識し、ルートブリッジがL2SW-A(5254.000f.0d54)からL2SW-E(5254.0005.8a42)に変更されていることが分かります。
07:00:05.803: STP: VLAN0001 heard root 32769-5254.0005.8a42 on Gi0/1
07:00:05.804: supersedes 32769-5254.000f.0d54
07:00:05.805: STP: VLAN0001 new root is 32769, 5254.0005.8a42 on port Gi0/1, cost 8
07:00:06.678: STP: VLAN0001 heard root 32769-5254.0005.8a42 on Gi0/0
07:00:06.678: supersedes 32769-5254.000f.0d54
07:00:06.678: STP: VLAN0001 new root is 32769, 5254.0005.8a42 on port Gi0/0, cost 12
07:00:05.771: STP: VLAN0001 heard root 32769-5254.0005.8a42 on Gi0/2
07:00:05.771: supersedes 32769-5254.000f.0d54
07:00:05.772: STP: VLAN0001 new root is 32769, 5254.0005.8a42 on port Gi0/2, cost 4
07:00:06.651: STP: VLAN0001 heard root 32769-5254.0005.8a42 on Gi0/1
07:00:06.652: supersedes 32769-5254.000f.0d54
07:00:06.653: STP: VLAN0001 new root is 32769, 5254.0005.8a42 on port Gi0/1, cost 16
ポート役割の再選出
ルートブリッジが変更になったため、ポートの役割も再選出されます。L2SW-BのGi0/1が非指定ポート(ブロッキング状態)、L2SW-DのGi0/0がルートポート(リスニング状態)となるため、PC1からServer1への通信が不可となります。

各スイッチのデバッグ確認
07:00:06.717: STP: VLAN0001 Gi0/1 -> blocking
07:00:06.654: STP: VLAN0001 Gi0/0 -> listening
ポート状態の遷移
ラーニング状態に遷移
15秒の転送遅延タイマー経過後にリスニング状態からラーニング状態に遷移します。

07:00:21.655: STP: VLAN0001 Gi0/0 -> learning
フォーワーディング状態に遷移
更に15秒の転送遅延タイマー経過後にラーニング状態からフォワーディング状態に遷移し、通信が復旧します。

07:00:36.655: STP: VLAN0001 Gi0/0 -> forwarding
通信断時間の確認
PC1で実施していた連続Pingを確認すると、約30秒で通信が復旧していることが分かります。(seq=12〜42が通信NGでPing応答が無い時間です。)
PC1:~$ ping 192.168.100.1
PING 192.168.100.1 (192.168.100.1): 56 data bytes
64 bytes from 192.168.100.1: seq=0 ttl=42 time=48.083 ms
64 bytes from 192.168.100.1: seq=1 ttl=42 time=40.071 ms
64 bytes from 192.168.100.1: seq=2 ttl=42 time=29.111 ms
64 bytes from 192.168.100.1: seq=3 ttl=42 time=85.469 ms
64 bytes from 192.168.100.1: seq=4 ttl=42 time=50.130 ms
64 bytes from 192.168.100.1: seq=5 ttl=42 time=17.139 ms
64 bytes from 192.168.100.1: seq=6 ttl=42 time=21.236 ms
64 bytes from 192.168.100.1: seq=7 ttl=42 time=17.162 ms
64 bytes from 192.168.100.1: seq=8 ttl=42 time=22.949 ms
64 bytes from 192.168.100.1: seq=9 ttl=42 time=52.691 ms
64 bytes from 192.168.100.1: seq=10 ttl=42 time=49.317 ms
64 bytes from 192.168.100.1: seq=11 ttl=42 time=22.499 ms
64 bytes from 192.168.100.1: seq=43 ttl=42 time=2155.359 ms
64 bytes from 192.168.100.1: seq=44 ttl=42 time=1166.198 ms
64 bytes from 192.168.100.1: seq=45 ttl=42 time=168.116 ms
64 bytes from 192.168.100.1: seq=46 ttl=42 time=25.153 ms
64 bytes from 192.168.100.1: seq=47 ttl=42 time=18.463 ms
64 bytes from 192.168.100.1: seq=48 ttl=42 time=19.258 ms
64 bytes from 192.168.100.1: seq=49 ttl=42 time=31.852 ms
64 bytes from 192.168.100.1: seq=50 ttl=42 time=27.366 ms
64 bytes from 192.168.100.1: seq=51 ttl=42 time=18.299 ms
64 bytes from 192.168.100.1: seq=52 ttl=42 time=29.291 ms
64 bytes from 192.168.100.1: seq=53 ttl=42 time=27.417 ms
64 bytes from 192.168.100.1: seq=54 ttl=42 time=23.558 ms
64 bytes from 192.168.100.1: seq=55 ttl=42 time=17.055 ms
^C
--- 192.168.100.1 ping statistics ---
56 packets transmitted, 25 packets received, 55% packet loss
round-trip min/avg/max = 17.055/167.329/2155.359 ms
構成変更時のSTP動作(プライオリティ設定後)
プライオリティ値の変更
L2SW-Aを明示的にルートブリッジにするために、プライオリティ値を設定します。プライオリティ値は下記のコマンドで設定でき、数値が小さい機器がルートブリッジに選出されます。
spanning-tree vlan 1 priority 4096

なお、プライオリティ値は0〜61440の間で、4096の倍数で設定が可能です。下記の通り、設定できない数値を入力した場合、設定可能な数値が表示されます。
L2SW-A(config)#spanning-tree vlan 1 priority ?
<0-61440> bridge priority in increments of 4096
L2SW-A(config)#spanning-tree vlan 1 priority 4095
% Bridge Priority must be in increments of 4096.
% Allowed values are:
0 4096 8192 12288 16384 20480 24576 28672
32768 36864 40960 45056 49152 53248 57344 61440
新規スイッチの接続
新規スイッチを接続しても、ルートブリッジ(L2SW-A)に変更はないため、既存のSTP構成に影響は与えません。そのため、PC1からServer1への通信断は発生しません。

下記の通り、L2SW-CとL2SW-Eの間のSTP収束のみ発生します。
ポート役割の再選出
L2SW-EのGi0/2がルートポート(リスニング状態)となり、L2SW-CのGi0/2が指定ポート(リスニング状態)となります。

Jan 29 07:00:04.255: STP: VLAN0001 Gi0/2 -> listening
Jan 29 07:00:04.247: STP: VLAN0001 Gi0/2 -> listening
ポート状態の遷移
ラーニング状態に遷移
15秒の転送遅延タイマー経過後にリスニング状態からラーニング状態に遷移します。

Jan 29 07:00:19.256: STP: VLAN0001 Gi0/2 -> learning
Jan 29 07:00:19.248: STP: VLAN0001 Gi0/2 -> learning
フォーワーディング状態に遷移
更に15秒の転送遅延タイマー経過後にラーニング状態からフォワーディング状態に遷移し、STPが収束します。

Jan 29 07:00:34.259: STP: VLAN0001 Gi0/2 -> forwarding
Jan 29 07:00:34.250: STP: VLAN0001 Gi0/2 -> forwarding
このように、プライオリティ値を設定することで、意図しないSTPの状態遷移による通信断を防ぐことができます。
以上で、STPのプライオリティ設定の必要性の説明は完了です!