GNS3 活用 - Cisco スイッチ STP 編 その4(port priority の変更による経路変更)
お疲れさまです。ニックネーム たいちょう です。
これまでで、少しコマンドにも慣れてきましたね。
今回は、前回(GNS3 活用 - Cisco スイッチ STP 編 その3(path cost の変更による経路変更) )の続きです。複数の経路が存在している場合にデフォルトの経路を変更する方法を実験します。
タスク
まずは、以下の様なトポロジを作成します。
bridge priority はデフォルトに戻しています。また、mac access-table コマンドで、MAC アドレスを確認しました。
この状態だと、Sw1 が ROOT BRIDGE になっています。
確実に ROOT BRIDGE にするコマンドがあります。Sw1 に明示的に primary を設定して、Sw2 secondary を設定してみます。
Sw1(config)#spanning-tree vlan 1 root primary
% This switch is already the root of VLAN1 spanning tree
VLAN 1 bridge priority set to 8192
VLAN 1 bridge max aging time unchanged at 20
VLAN 1 bridge hello time unchanged at 2
VLAN 1 bridge forward delay unchanged at 15
Sw2(config)#spanning-tree vlan 1 root secondary
VLAN 1 bridge priority set to 16384
VLAN 1 bridge max aging time unchanged at 20
VLAN 1 bridge hello time unchanged at 2
VLAN 1 bridge forward delay unchanged at 15
spanning-tree [VLAN ID] root <primary|secondary> コマンドで、自動的に設定が出来るのですね。
それぞれのスイッチ上で port の役割と状態を確認してみます。
Sw1#sh spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 8192
Address c402.60c2.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 8192
Address c402.60c2.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 8192 c402.60c2.0000 128.42
FastEthernet1/3 128.44 128 19 FWD 0 8192 c402.60c2.0000 128.44
FastEthernet1/4 128.45 128 19 FWD 0 8192 c402.60c2.0000 128.45
FastEthernet1/6 128.47 128 19 FWD 0 8192 c402.60c2.0000 128.47
Sw2#sh spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 8192
Address c402.60c2.0000
Cost 19
Port 42 (FastEthernet1/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 16384
Address c403.60d0.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 8192 c402.60c2.0000 128.42
FastEthernet1/2 128.43 128 19 FWD 19 16384 c403.60d0.0000 128.43
FastEthernet1/4 128.45 128 19 BLK 0 8192 c402.60c2.0000 128.45
FastEthernet1/5 128.46 128 19 FWD 19 16384 c403.60d0.0000 128.46
Sw3#sh spanning-tree bri
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 8192
Address c402.60c2.0000
Cost 19
Port 44 (FastEthernet1/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32768
Address c404.60df.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/2 128.43 128 19 BLK 19 16384 c403.60d0.0000 128.43
FastEthernet1/3 128.44 128 19 FWD 0 8192 c402.60c2.0000 128.44
FastEthernet1/5 128.46 128 19 BLK 19 16384 c403.60d0.0000 128.46
FastEthernet1/6 128.47 128 19 BLK 0 8192 c402.60c2.0000 128.47
ここで、Sw2 と Sw3 の Root port は、それぞれ、f1/1 と f1/3 となっています。
Sw2#sh spanning-tree active | begin Root port
Root port is 42 (FastEthernet1/1), cost of root path is 19
...(snip)...
Sw3#sh spanning-tree active | begin Root port
Root port is 44 (FastEthernet1/3), cost of root path is 19
...(snip)...
図に記入します。
さて、Sw1f1/1-Sw2f1/1という接続状態になっているのを、Sw1f1/4-Sw2f1/4に変えてみたいです。
ここで、パスコストは FastEthernet なので、19 なんですけど、パスコストを変更すると、例えばSw にさらにスイッチを接続した場合に影響を与えることになってしまいます。なので、今回は、送信元である、Sw1側の、f1/4のポートIDをf1/1 よりも下げることによって、f1/4の優先順位をあげたいです。
例によって、デバッグモードを活用してみます。
debug spanning-tree events コマンドをそれぞれのスイッチで実行しておきます。
Sw1(config-if)#spanning-tree port-priority 64
Sw1(config-if)#
*Mar 1 00:02:59.959: STP: VLAN1 Topology Change rcvd on Fa1/4
Sw1(config-if)#
*Mar 1 00:03:29.967: STP: VLAN1 Topology Change rcvd on Fa1/4
Sw2#
*Mar 1 00:02:59.951: STP: VLAN1 new root port Fa1/4, cost 19
*Mar 1 00:02:59.951: STP: VLAN1 sent Topology Change Notice on Fa1/4
*Mar 1 00:02:59.951: STP: VLAN1 Fa1/1 -> blocking
*Mar 1 00:02:59.955: STP: VLAN1 Fa1/4 -> listening
Sw2#
*Mar 1 00:03:14.955: STP: VLAN1 Fa1/4 -> learning
Sw2#
*Mar 1 00:03:29.955: STP: VLAN1 sent Topology Change Notice on Fa1/4
*Mar 1 00:03:29.955: STP: VLAN1 Fa1/4 -> forwarding
Sw1,Sw2 の状態を確認します。
Sw1#sh spanning-tree bri | begin Interface
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 FWD 0 8192 c402.60c2.0000 128.42
FastEthernet1/3 128.44 128 19 FWD 0 8192 c402.60c2.0000 128.44
FastEthernet1/4 64.45 64 19 FWD 0 8192 c402.60c2.0000 64.45
FastEthernet1/6 128.47 128 19 FWD 0 8192 c402.60c2.0000 128.47
Sw2#sh spanning-tree bri | begin Interface
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1 128.42 128 19 BLK 0 8192 c402.60c2.0000 128.42
FastEthernet1/2 128.43 128 19 FWD 19 16384 c403.60d0.0000 128.43
FastEthernet1/4 128.45 128 19 FWD 0 8192 c402.60c2.0000 64.45
FastEthernet1/5 128.46 128 19 FWD 19 16384 c403.60d0.0000 128.46
Sw2#sh spanning-tree active | begin Root port
Root port is 45 (FastEthernet1/4), cost of root path is 19
図に記入します。
Sw1#wr
Sw2#wr
Sw3#wr
お疲れさまでした。今日の確認作業は終了です。
次回は、portfast をやってみたいです。
ニックネーム たいちょうでした。次回をお楽しみに。