ネットワーク構成
設定条件
- VLAN1についてスパニングツリープロトコルによって、イーサネットフレームの転送経路を冗長化します。
- SW1をVLAN1のルートブリッジ、SW2をVLAN2のルートブリッジとします。そして、SW4 F0/9がブロックされるようにします。
- 各PCが接続されるポートはすぐにフォワーディング状態に移行するようにしてください。
初期設定
以下の内容は設定済みです。
- ホスト名
- IPアドレス
※GNS3プロジェクトファイル(http://www.n-study.com/gns3/01.STP_Basic_init.zip)
設定と確認
【Step1:スパニングツリーの確認】
CatalystスイッチはデフォルトでVLANごとにスパニングツリーが動作しています。現在のVLAN1のスパニングツリーの状態を確認します。そのために、show spanning-tree vlan1 briefコマンドを利用します。また、現在のVLAN1のスパニングツリーの状態を次の表にまとめてください。
※Catalystスイッチではshow spaning-tree vlan 1コマンドを利用します。
ブリッジプライオリティはデフォルトで同じ値なので、ルートブリッジの選出はMACアドレスに基づいて行われています。そのため、各ポートがどのような役割になっているかは環境によって異なってしまいます。
【Step2:ブリッジプライオリティの設定】
各スイッチのVLAN1のブリッジプライオリティを設定して、条件に一致するようなスパニングツリーの構成とします。SW1をVLAN1のルートブリッジになるようにSW1のブリッジプライオリティを最小にします。そして、SW2をVLAN1のルートブリッジになるようにブリッジプライオリティを2番目に小さい値にします。SW4のFa0/9がブロックされるようにするためには、SW4のブリッジプライオリティが最大になるようにします。
SW1 -------------------------------------------------------------- spanning-tree vlan 1 priority 4096 --------------------------------------------------------------
SW2 -------------------------------------------------------------- spanning-tree vlan 1 priority 8192 --------------------------------------------------------------
SW3 -------------------------------------------------------------- spanning-tree vlan 1 priority 12288 --------------------------------------------------------------
SW4 -------------------------------------------------------------- spanning-tree vlan 1 priority 16384 --------------------------------------------------------------
【Step3:スパニングツリーの確認】
ブリッジプライオリティを設定して明示的にスパニングツリーの構成を決定したあとの状態を確認します。各スイッチでshow spanning-tree vlan 1 briefコマンドを利用します。
SW1 -------------------------------------------------------------- SW1#show spanning-tree vlan 1 brief VLAN1 Spanning tree enabled protocol ieee Root ID Priority 4096 Address cc00.2a2c.0000 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 4096 Address cc00.2a2c.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 -------------------- ------- ---- ----- --- ----- -------------------- ------- FastEthernet0/1 128.2 128 19 FWD 0 4096 cc00.2a2c.0000 128.2 FastEthernet0/7 128.8 128 19 FWD 0 4096 cc00.2a2c.0000 128.8 FastEthernet0/9 128.10 128 19 FWD 0 4096 cc00.2a2c.0000 128.10 --------------------------------------------------------------
SW2 -------------------------------------------------------------- SW2#show spanning-tree vlan 1 brief VLAN1 Spanning tree enabled protocol ieee Root ID Priority 4096 Address cc00.2a2c.0000 Cost 19 Port 10 (FastEthernet0/9) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 8192 Address cc02.2a2c.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 -------------------- ------- ---- ----- --- ----- -------------------- ------- FastEthernet0/1 128.2 128 19 FWD 19 8192 cc02.2a2c.0000 128.2 FastEthernet0/7 128.8 128 19 FWD 19 8192 cc02.2a2c.0000 128.8 FastEthernet0/9 128.10 128 19 FWD 0 4096 cc00.2a2c.0000 128.10 --------------------------------------------------------------
SW3 -------------------------------------------------------------- SW3#show spanning-tree vlan 1 brief VLAN1 Spanning tree enabled protocol ieee Root ID Priority 4096 Address cc00.2a2c.0000 Cost 19 Port 8 (FastEthernet0/7) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 12288 Address cc01.2a2c.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 -------------------- ------- ---- ----- --- ----- -------------------- ------- FastEthernet0/1 128.2 128 19 FWD 19 12288 cc01.2a2c.0000 128.2 FastEthernet0/7 128.8 128 19 FWD 0 4096 cc00.2a2c.0000 128.8 FastEthernet0/9 128.10 128 19 FWD 19 12288 cc01.2a2c.0000 128.10 --------------------------------------------------------------
SW4 -------------------------------------------------------------- SW4#show spanning-tree vlan 1 brief VLAN1 Spanning tree enabled protocol ieee Root ID Priority 4096 Address cc00.2a2c.0000 Cost 38 Port 8 (FastEthernet0/7) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 16384 Address cc03.2a2c.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 -------------------- ------- ---- ----- --- ----- -------------------- ------- FastEthernet0/1 128.2 128 19 FWD 38 16384 cc03.2a2c.0000 128.2 FastEthernet0/7 128.8 128 19 FWD 19 8192 cc02.2a2c.0000 128.8 FastEthernet0/9 128.10 128 19 BLK 19 12288 cc01.2a2c.0000 128.10 --------------------------------------------------------------
表 VLAN1のスパニングツリーの状態(ブリッジプラオリティ設定後)
【Step4:スパニングツリーの再計算の確認】
PC1からPC4へ継続的にPingを実行します。継続的にPingを行っている状態でSW4 F0/7をshutdownして、どのぐらいでPingの応答が返ってくるようになるかを確認します。
PC1 -------------------------------------------------------------- PC1#ping 192.168.1.4 repeat 5000 Type escape sequence to abort. Sending 5000, 100-byte ICMP Echos to 192.168.1.4, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!................!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!. Success rate is 97 percent (702/719), round-trip min/avg/max = 12/19/28 ms --------------------------------------------------------------
もともと、PC1からPC4へのイーサネットフレームの転送経路は、
PC1→SW1(F0/9)→SW2(F0/7)→SW4(F/0/1)→PC4
です。
SW4 F0/7shutdownすることでスパニングツリーの再計算が発生します。スパニングツリーの再計算が完了すると、PC1からPC4へのイーサネットフレームの転送経路は、
PC1→SW1(F0/7)→SW3(F0/9)→SW4(F0/1)→PC4
に変わります。このスパニングツリーの再計算には約30秒かかっています。
図 PCx1-PCy2間のイーサネットフレームの転送経路(スパニングツリー再計算後)
【Step5:スパニングツリーの確認】
スパニングツリーの再計算が完了したときのVLAN1のスパニングツリーの状態を確認します。そのために、show spanning-tree vlan1コマンドを利用します。
SW1 -------------------------------------------------------------- SW1#show spanning-tree vlan 1 brief VLAN1 Spanning tree enabled protocol ieee Root ID Priority 4096 Address cc00.2a2c.0000 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 4096 Address cc00.2a2c.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 -------------------- ------- ---- ----- --- ----- -------------------- ------- FastEthernet0/1 128.2 128 19 FWD 0 4096 cc00.2a2c.0000 128.2 FastEthernet0/7 128.8 128 19 FWD 0 4096 cc00.2a2c.0000 128.8 FastEthernet0/9 128.10 128 19 FWD 0 4096 cc00.2a2c.0000 128.10 --------------------------------------------------------------
SW2 -------------------------------------------------------------- SW2#show spanning-tree vlan 1 brief VLAN1 Spanning tree enabled protocol ieee Root ID Priority 4096 Address cc00.2a2c.0000 Cost 19 Port 10 (FastEthernet0/9) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 8192 Address cc02.2a2c.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 -------------------- ------- ---- ----- --- ----- -------------------- ------- FastEthernet0/1 128.2 128 19 FWD 19 8192 cc02.2a2c.0000 128.2 FastEthernet0/9 128.10 128 19 FWD 0 4096 cc00.2a2c.0000 128.10 --------------------------------------------------------------
SW3 -------------------------------------------------------------- SW3#show spanning-tree vlan 1 brief VLAN1 Spanning tree enabled protocol ieee Root ID Priority 4096 Address cc00.2a2c.0000 Cost 19 Port 8 (FastEthernet0/7) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 12288 Address cc01.2a2c.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 -------------------- ------- ---- ----- --- ----- -------------------- ------- FastEthernet0/1 128.2 128 19 FWD 19 12288 cc01.2a2c.0000 128.2 FastEthernet0/7 128.8 128 19 FWD 0 4096 cc00.2a2c.0000 128.8 FastEthernet0/9 128.10 128 19 FWD 19 12288 cc01.2a2c.0000 128.10 --------------------------------------------------------------
SW4 -------------------------------------------------------------- SW4#show spanning-tree vlan 1 brief VLAN1 Spanning tree enabled protocol ieee Root ID Priority 4096 Address cc00.2a2c.0000 Cost 38 Port 10 (FastEthernet0/9) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 16384 Address cc03.2a2c.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 -------------------- ------- ---- ----- --- ----- -------------------- ------- FastEthernet0/1 128.2 128 19 FWD 38 16384 cc03.2a2c.0000 128.2 FastEthernet0/9 128.10 128 19 FWD 19 12288 cc01.2a2c.0000 128.10 --------------------------------------------------------------
スパニングツリーの状態を確認したら、SW4 F0/7をno shutdownして、元の状態に戻してください。
【Step6:PortFast設定前の通信確認】
PC1からPC4へPingを継続的に実行します。その状態でPC1が接続されているSW1 F0/1
をshutdown→no shutdownします。Pingの応答がどのぐらいで返ってくるようになるかを確認します。
PC1 -------------------------------------------------------------- PC1#ping 192.168.1.4 repeat 5000 Type escape sequence to abort. Sending 5000, 100-byte ICMP Echos to 192.168.1.4, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!................!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!. Success rate is 98 percent (897/914), round-trip min/avg/max = 8/19/32 ms --------------------------------------------------------------
SW1 F0/1をshutdown→no shutdownすると、スパニングツリーの再計算のためしばらく、Pingの応答は返ってこないままです。約30秒でPingの応答が返ってくるようになります。
※実機のCatalystスイッチでは、スパニングツリーの再計算のためブロッキング状態になっているとリンクLEDがオレンジ色になります。
【Step7:PortFastの設定】
各スイッチのPCが接続されているF0/1でPortFastを有効化します。
SW1-SW4 -------------------------------------------------------------- interface FastEthernet0/1 spanning-tree portfast --------------------------------------------------------------
【Step8:PortFastの確認】
Step6と同様の確認を行います。
PC1 -------------------------------------------------------------- PC1#ping 192.168.1.4 repeat 5000 Type escape sequence to abort. Sending 5000, 100-byte ICMP Echos to 192.168.1.4, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. Success rate is 99 percent (344/346), round-trip min/avg/max = 12/19/36 ms --------------------------------------------------------------
PortFastを有効にすると、shutdown→no shutdownしてもすぐにフォワーディング状態になり、Pingの応答もすぐに返ってくるようになります。