computerの日記

Cisco,SHELL,C,Qt,C++,Linux,ネットワーク,Windows Scriptなどの発言です

STPトポロジ-3(パスコスト変更による通信経路の変更1)

このタスクでは、802.1d PVST Spanning-Tree VLAN-3 のある特定のパスを操ることによって、VLAN-3 に所属する R2 から R3 へのトラフィックping)を、SW3-->SW2 の経路ではなく、SW3-->SW1-->SW2 の経路を通るようにしなさい。

ただ一つのコマンドを、ただ一つのスイッチ上で、上記を実現させなさい。
SW3 から SW1 へのトラフィックは、Fa1/15 上で行いなさい。SW1 と SW2 との間で、EtherChannel のどのリンクがフレームの送信に使用されるかは、はっきりとしない。
このタスクを完遂するために、ルートブリッジの設定を変更することは許されない。

トポロジは、以下を使います。

f:id:intrajp:20171205031524p:plain

--------
現在のコストを確認すると、SW2 がルートブリッジで、SW3 は、SW2 と直接繋がっているので、パスコストは、19である事が分かる。
SW3 fa1/15-->SW1 fa1/15-->SW2 という経路にするためには、SW3-->SW2 のパスコスト 19 より小さいパスコストをとればよい。
したがって、総パスコストを、18にすれば、実現できるはずである。ここで、SW2 と SW1 のポートチャネルのパスコストを確認すると、
9 となっている。したがって、SW3 fa1/15 のパスコストを 9 にすれば、良いと思われる。

SW2#show spanning-tree vlan 3 brief

VLAN3
Spanning tree enabled protocol ieee
Root ID Priority 8192
Address c207.153c.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 8192
Address c207.153c.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/0 128.41 128 19 FWD 0 8192 c207.153c.0000 128.41
FastEthernet1/6 128.47 128 19 FWD 0 8192 c207.153c.0000 128.47
FastEthernet1/7 128.48 128 19 FWD 0 8192 c207.153c.0000 128.48
FastEthernet1/8 128.49 128 19 FWD 0 8192 c207.153c.0000 128.49
Port-channel1 129.65 128 9 FWD 0 8192 c207.153c.0000 129.65

SW3#show spanning-tree vlan 3 brief

VLAN3
Spanning tree enabled protocol ieee
Root ID Priority 8192
Address c207.153c.0000
Cost 19
Port 47 (FastEthernet1/6)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32768
Address c201.1621.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/0 128.41 128 19 FWD 19 32768 c201.1621.0000 128.41
FastEthernet1/6 128.47 128 19 FWD 0 8192 c207.153c.0000 128.47
FastEthernet1/7 128.48 128 19 BLK 0 8192 c207.153c.0000 128.48
FastEthernet1/8 128.49 128 19 BLK 0 8192 c207.153c.0000 128.49
FastEthernet1/13 128.54 128 19 BLK 9 32768 c206.152d.0001 128.54
FastEthernet1/14 128.55 128 19 BLK 9 32768 c206.152d.0001 128.55
FastEthernet1/15 128.56 128 19 BLK 9 32768 c206.152d.0001 128.56

SW1#show spanning-tree vlan 3 brief

VLAN3
Spanning tree enabled protocol ieee
Root ID Priority 8192
Address c207.153c.0000
Cost 9
Port 321 (Port-channel1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32768
Address c206.152d.0001
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/13 128.54 128 19 FWD 9 32768 c206.152d.0001 128.54
FastEthernet1/14 128.55 128 19 FWD 9 32768 c206.152d.0001 128.55
FastEthernet1/15 128.56 128 19 FWD 9 32768 c206.152d.0001 128.56
Port-channel1 129.65 128 9 FWD 0 8192 c207.153c.0000 129.65


では、コマンドを発行してみる。

SW3#conf t
SW3(config)#interface fa1/15
SW3(config-if)#spanning-tree vlan 3 cost 9

SW3#show spanning-tree vlan 3 brief

SW3 上で、fa1/6 がブロッキングになり、fa1/15 がフォワードになりました。

VLAN3
Spanning tree enabled protocol ieee
Root ID Priority 8192
Address c207.153c.0000
Cost 18
Port 56 (FastEthernet1/15)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32768
Address c201.1621.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/0 128.41 128 19 FWD 18 32768 c201.1621.0000 128.41
FastEthernet1/6 128.47 128 19 BLK 0 8192 c207.153c.0000 128.47
FastEthernet1/7 128.48 128 19 BLK 0 8192 c207.153c.0000 128.48
FastEthernet1/8 128.49 128 19 BLK 0 8192 c207.153c.0000 128.49
FastEthernet1/13 128.54 128 19 BLK 9 32768 c206.152d.0001 128.54
FastEthernet1/14 128.55 128 19 BLK 9 32768 c206.152d.0001 128.55
FastEthernet1/15 128.56 128 9 FWD 9 32768 c206.152d.0001 128.56

ここで、目で見て確認したいと考えたのですが、いいコマンドがあります。
以下の debug コマンドで、spanning-tree の イベントを観察できます。

# debug spannin-tree events

停止するには、頭に no をつけます。

# no debug spanning-tree events

では、一度、SW3 の fa1/15 のパスコストを 19 に戻しておきます。

SW3(config-if)#spanning-tree vlan 3 cost 19

デバッグモードで、spanning-tree events を観察する設定にします。

SW3#debug spanning-tree events
Spanning Tree event debugging is on

では、もう一度、SW3 の fa1/15 のパスコストを 9 にして、また 19 に戻す、というのをやってみます。

SW3(config-if)#spanning-tree vlan 3 cost 9
SW3(config-if)#
*Mar 1 07:23:14.710: STP: VLAN3 new root port Fa1/15, cost 18
*Mar 1 07:23:14.710: STP: VLAN3 sent Topology Change Notice on Fa1/15
*Mar 1 07:23:14.762: STP: VLAN3 Fa1/6 -> blocking
*Mar 1 07:23:14.762: STP: VLAN3 Fa1/15 -> listening
SW3(config-if)#
*Mar 1 07:23:29.762: STP: VLAN3 Fa1/15 -> learning
SW3(config-if)#
*Mar 1 07:23:44.770: STP: VLAN3 sent Topology Change Notice on Fa1/15
*Mar 1 07:23:44.774: STP: VLAN3 Fa1/15 -> forwarding
SW3(config-if)#spanning-tree vlan 3 cost 19
SW3(config-if)#
*Mar 1 07:24:43.122: STP: VLAN3 new root port Fa1/6, cost 19
*Mar 1 07:24:43.158: STP: VLAN3 Fa1/6 -> listening
*Mar 1 07:24:43.158: STP: VLAN3 sent Topology Change Notice on Fa1/6
*Mar 1 07:24:43.158: STP: VLAN3 Fa1/15 -> blocking
SW3(config-if)#
*Mar 1 07:24:58.166: STP: VLAN3 Fa1/6 -> learning
SW3(config-if)#
*Mar 1 07:25:13.174: STP: VLAN3 sent Topology Change Notice on Fa1/6
*Mar 1 07:25:13.178: STP: VLAN3 Fa1/6 -> forwarding

30秒で変更されたようです。戻す時も同じでした。

デバッグモードを戻します。

SW3#no debug spanning-tree events
Spanning Tree event debugging is off

お疲れさまです。次回をお楽しみに。