[[CISCO入門]]

#setlinebreak(on)

バージョン: &Version; &br;
オンラインユーザー数: &online;
閲覧数表示 本日/トータル: &counter(today); / &counter(total); &br;
最終更新:&lastmod();&br;



*RSTPとは [#mfcab731]
IEEE802.1w標準仕様
Rapid Spanning Tree protocol

**ポートの役割 [#p27c9aa4]
以下の4種類ある。

-ルートポート(RP:Root Port)
ルートブリッジへの最短パスのポート
-指定ポート(DP:Designated Port)
セグメントへのBPDUを転送するポート

-ブロッキング状態のポート
代替ポート(AP:Alternate port)他のスイッチから上位のBPDUを受信し、ルートポートがダウンした時に代替となるポート
バックアップポート(BP:Backup Port)自スイッチから上位のBPDUを受信し、指定ポートがダウンした時にバックアップとなるポート

-ポートの役割決定時に比較する値
+パスコスト
+ブリッジID
+ポートID

-ポートの状態
RSTPでは3種類のポート状態を定義している。

,STP,RSTP
,フォワーディング,フォワーディング(転送)
,ラーニング,ラーニング(学習)
,リスニング,ディスカーディング(破棄)
,ブロッキング,ディスカーディング

-エッジポート
ループ構成するポートではないspanning-tree portfast適応ポート
BPDUを受信するとRSTP標準ポートへ移行する

-リンクタイプ
全二重ポートはポイントツーポイント
半二重ポートは共有ポートとみなされます

-プロポーザルとアグリーメント
スイッチ間でプロポーザルとアグリーメントを交換することにより
タイマーに依存せずにポートの役割を高速に決定します。



**STPのBPDUタイプ [#n117c2c1]

-コンフィギュレーションBPDU
トポロジの維持に使用される。
常時、ルートからエッジ方向へ2秒に1回送信


-TCN BPDU(トポロジ変更通知BPDU)
トポロジ変更を検出したルート以外のスイッチからルートへ送信される


**PVST+/PVRST+ [#c493d0d8]

-CST(Common Spanning Tree)
VLAN数に関係なくスイッチ接続のネットワーク全体で1つのSTPトポロジを構成する


-PVST+/PVRST+
PVST+(Per VLAN Spanning Tree)VLAN毎に異なるIEEE802.1DのSTPインスタンスを生成します。
PVRST+(Per VLAN Rapid Spanning Tree)RSTPのCISCO拡張機能であり、VLAN毎に異なるIEEE802,1wのSTPインスタンスを生成する。
VLAN単位でSTPの計算を行う為、CPUの負荷は高くなる。


-IEEE802.1s
MSTP(Multiple Spanning Tree Protocol)では複数のVLANをインスタンス単位にグループ化して
STP計算を行う為、PVST+やPVRST+よりスイッチのCPU負荷を軽減できます。
IEEE802.1s MSTPはIEEE802.1w RSTPに基づくため、RSTPの高速コンバージェンスも有効になります。


**MSTPの設定例 [#t52cd0a3]



,R(config)#spanning-tree mst configuration,MST設定モードへ移行
,R(config-mst)#name MST-Cisco,MST領域名(同一インスタンスポリシー識別子)設定
,R(config-mst)#revision 1,リビジョン番号(情報の新しさを表す番号)
,R(config-mst)#instance 1 vlan 100,VLAN番号群をインスタンスにマッピング
,R(config-mst)#instance 2 vlan 300,
,R(config)#spanning-tree mode mst,STPの動作をMSTPモードに変更


-RSTPの場合
,R1(config)#spanning-tree vlan 100 root primary,ルートブリッジ設定、ブリッジプライオリティが32768→24576に変更、予備のsecondaryもある
,R1(config)#spanning-tree vlan 200 primary 4096,任意のプライオリティを入力
-MSTの場合
,R1(config)#spanning-tree mst 1 root primary,インスタンスをルートブリッジ設定
,R1(config)#spanning-tree mst 2 priority 4096,任意のプライオリティを入力


**show での出力結果 [#q9046a9e]

R1#show spanning-tree

MST0
  Spanning tree enabled protocol mstp
  Root ID    Priority    32768
             Address     0019.aabe.bf80
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768  (priority 32768 sys-id-ext 0)
             Address     0019.aabe.bf80
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Po1                 Desg FWD 200000    128.488  P2p



MST1
  Spanning tree enabled protocol mstp
  Root ID    Priority    24577
             Address     0019.aabe.bf80
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
             Address     0019.aabe.bf80
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Po1                 Desg FWD 200000    128.488  P2p



MST2
  Spanning tree enabled protocol mstp
  Root ID    Priority    4098
             Address     0019.aabe.bf80
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    4098   (priority 4096 sys-id-ext 2)
             Address     0019.aabe.bf80
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Po1                 Desg FWD 200000    128.488  P2p


R1#

R2#show spanning-tree

MST0
  Spanning tree enabled protocol mstp
  Root ID    Priority    32768
             Address     0019.aabe.bf80
             Cost        0
             Port        488 (Port-channel1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768  (priority 32768 sys-id-ext 0)
             Address     0019.aabe.c180
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Po1                 Root FWD 200000    128.488  P2p



MST1
  Spanning tree enabled protocol mstp
  Root ID    Priority    24577
             Address     0019.aabe.bf80
             Cost        200000
             Port        488 (Port-channel1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0019.aabe.c180
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Po1                 Root FWD 200000    128.488  P2p



MST2
  Spanning tree enabled protocol mstp
  Root ID    Priority    4098
             Address     0019.aabe.bf80
             Cost        200000
             Port        488 (Port-channel1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     0019.aabe.c180
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Po1                 Root FWD 200000    128.488  P2p


R2#


*Cisco STP Toolkit [#zf0ff7a0]
STP環境の最適化やトラブルシューティングに役立つツールで
7つで構成されています。

***PortFast [#de635d7e]
スイッチに接続されたノードが直ぐに通信を開始出来る。
PortFast機能はSTP計算が回避されて即座にフォワーディングに以降します。
ループを引き起こす可能性があるので注意が必要です。
RSTP環境ではエッジポートとして認識され、BPDUを受信すると即座に
エッジポートが解除されます。

-PortFastを全てに適応
 R2(config)#spanning-tree portfast default
 %Warning: this command enables portfast by default on all interfaces. You
  should now disable portfast explicitly on switched ports leading to hubs,
  switches and bridges as they may create temporary bridging loops.

-PortFastをIF単位設定
 R2(config-if)#spanning-tree portfast
 %Warning: portfast should only be enabled on ports connected to a single
  host. Connecting hubs, concentrators, switches, bridges, etc... to this
  interface  when portfast is enabled, can cause temporary bridging loops.
  Use with CAUTION

 %Portfast has been configured on FastEthernet2/0/1 but will only
  have effect when the interface is in a non-trunking mode.



***BPDUガード(BPDU Guard) [#w86ab110]
''BPDUガードはPortFastポートでBPDUを受信した場合ポートを無効(err-disabled)''
にしてループが発生するのを回避します。
CISCOではPortFastポートにBPDUガードを設定することを推奨しています。

-BPDUGuardをグローバルで有効化
 R2(config)#spanning-tree portfast bpduguard default

-BPDUGuardをIF単位で有効化
 R2(config-if)#spanning-tree bpduguard enable

R2#show spanning-tree summary totals
Switch is in mst mode (IEEE Standard)
Root bridge for: none
Extended system ID           is enabled
Portfast Default             is disabled ←スイッチ全に対して非トランクポートでPortFastが無効
PortFast BPDU Guard Default  is enabled  ←スイッチ全に対して非トランクポートでBPDUGuardが有効になっている
Portfast BPDU Filter Default is disabled
Loopguard Default            is disabled
EtherChannel misconfig guard is enabled
UplinkFast                   is disabled
BackboneFast                 is disabled
Configured Pathcost method used is short (Operational value is long)

Name                   Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
3 msts                       0         0        0          3          3
R2#


***BPDUフィルタ(BPDUFilter) [#wd7dc505]
''BPDUフィルタはPortFastポートでのBPDUの送信を抑制します''
BPDUフィルタもスイッチ全体に対してグローバルで有効化することも
IF単位で有効化することも出来ます。


-BPDUFilterを全てに適応
 R1(config)#spanning-tree portfast bpdufilter default

-BPSUFilterをIF単位設定
 R1(config-if)#spanning-tree bpdufilter enable


***ルートガード(RootGuard) [#e9087ba2]
''ルートガードは管理外スイッチがルートブリッジになるのを抑制する''
ルートガードはIF単位で有効にする。
ルートガードを設定するとルートガードを適用したポートで上位BPDUを
受信してもroot-inconsistent状態になりポートがブロックされることから、上位BPDUは無視されます。
これにより既存のSTPトポロジは保護され、通信断の問題や予期しない場所がブロックされる事態は発生しません。

 R1(config-if)#spanning-tree guard root


ルートガード設定ポートは上位BPDUを受信するとroot-inconsistent状態となり
上位BPDUを破棄し、既存のトポロジを保護します。

***ループガード(LoopGuard) [#l0d75eed]
ループガードは単一方向リンク障害によるBPDUが受信出来ない場合に代替ポートや
ルートポートが指定ポートになりSTPループが発生するのを防ぎます。

''ループガードはルートガードとは同時に利用出来ません''

-グローバルにループガードを有効化
 R1(config)#spanning-tree loopguard default

-IFにループガードを有効化
 R1(config-if)#spanning-tree guard loop


***UplinkFast・BackboneFast [#f393cd1c]
UplinkFast及びBackboneFast機能はIEEE802.1w RSTPに含まれています。
これら二つの機能はRSTP下では使用されません。

UplinkFastはNDPを持つスイッチにUplinkFastを設定すると直接接続の
アップリンク障害が発生した時に5秒以内にNDPをフォワーディング状態に切り替える。

BackboneFastはNDPを持つスイッチの間接リンク障害時に経路を高速に切り替える。
ループを構成するすべてのスイッチにBackboneFastを設定すると、NDPを持つスイッチの
間接リンク上の障害時にNDPを直ぐにリスニング状態に移行し、30秒程度で経路を切り替えます。


***UDLD [#a9762bbb]
UDLD(UniDirectional Link Detection:単一方向リンク検出)


-UDLDの有効化
Globalの場合は光ポートのみ有効
IFの場合は指定のIFに有効、光以外も可能。


 R1(config)#udld enable

-IFのリセット
 R1#udld reset


-一覧

,,BPDUガード,BPDUフィルタ,ルートガード,ループガード,UDLD
,概要,ポートファーストを指定したポートにBPDUを送信する機器を接続するのを防ぐ,BPDUを送信しない,ルートブリッジになるのを防ぐ,BPDU喪失によるループ防止,BPDU喪失にようループ防止
,Globalでの動作,ポートファーストポートで自動有効,ポートファーストポートで自動有効,-,-(フォワーディング状態に移行しないようにする),Globalでは光のみ
,IFでの動作,ポートファーストが指定されていないポートでも有効化,ポートファーストが指定されていないポートでも有効化、BPDUの送信も受信もしない,-,-,IFでは指定IF(光以外も可能)
,発動条件,有効ポートでBPDU受信,有効ポートでBPDU受信,有効にしたポートでBPDUを受信,指定ポート以外で(MAX Ageを超えて)BPDUを受信しない,UDLDエコーメッセージを受信しない
,動作,エラーディセーブル(データ、BPDU送受信不可),Blobal:BPDU受信時はフィルター停止、IF時はBPDU破棄,ルート不整合Loop Inconsistent(データ不可、BPDU受信のみ),ルート不整合Loop Inconsistent(データ不可、BPDU受信のみ),エラーディセーブル(データ、BPDU送受信不可)
,STPによる自動復旧,-,-,上位からBPDUを受信しなくなると,上位からBPDUを受信すると,-
,その他,-,IF設定はPORTのSTP無効,-,-,STPに依存しない

※BPDUフィルタリングは 不要なBPDUをフィルタリングする機能で、BPDUフィルタリングが有効になっているポートからはBPDUを送信しなくなります。
BPDUガードは BPDUを受信した際にループを防ぐためにポートを使用できなくする機能で、通常時のBPDUの送信を止めるわけではありません。
なお、両方を設定した場合はBPDUフィルタリングが優先されます。

*おまけ [#z424ac07]
Catalyst2950で1対1で直結した時、BPDUガードが機能しませんでした。
どうやら、Catalyst2950は1ポートだけ接続した時にはBPDUを出さないようです。

                                      
    STP 初期値              STP 初期値
  ┌────┐            ┌────┐
  │  SW1   ├──────┤  SW2   │
  └────┘            └────┘
      BPDUGUARD                       

-SW2で動作を見るとsent 0になっている
    SW2#show spanning-tree detail
 
     VLAN0001 is executing the ieee compatible Spanning Tree protocol
      Bridge Identifier has priority 32768, sysid 1, address 000d.bca2.0500
      Configured hello time 2, max age 20, forward delay 15
      Current root has priority 32769, address 000d.28b6.49c0
      Root port is 11 (FastEthernet0/11), cost of root path is 19
      Topology change flag not set, detected flag not set
      Number of topology changes 0 last change occurred 00:09:51 ago
      Times:  hold 1, topology change 35, notification 2
              hello 2, max age 20, forward delay 15
      Timers: hello 0, topology change 0, notification 0, aging 300
 
     Port 11 (FastEthernet0/11) of VLAN0001 is forwarding
       Port path cost 19, Port priority 128, Port Identifier 128.11.
       Designated root has priority 32769, address 000d.28b6.49c0
       Designated bridge has priority 32769, address 000d.28b6.49c0
       Designated port id is 128.7, designated path cost 0
       Timers: message age 2, forward delay 0, hold 0
       Number of transitions to forwarding state: 1
       Link type is point-to-point by default
       BPDU: sent 0, received 295
 

-どうやらBPDUを抑制する機能が標準で搭載されているらしい
下のコマンドは消すことが出来ない。

 !
 spanning-tree mode pvst
 no spanning-tree optimize bpdu transmission
 !


-結局
Catalyst2950がBPDUを自動的に抑制するのが問題らしいので、
SW2の下にSW3を置いてみた。
すると見事にerr-disabledになった。
                                                          
    STP 初期値              STP 初期値          STP 初期値
  ┌────┐            ┌────┐        ┌────┐
  │  SW1   ├──────┤  SW2   ├────┤  SW3   │
  └────┘            └────┘        └────┘
      BPDUGUARD                                           


-確認
    Switch#show interfaces status
 
    Port      Name               Status       Vlan       Duplex  Speed Type
    Fa0/1                        notconnect   1            auto   auto 10/100BaseTX
      ~中略~
    Fa0/10                       notconnect   1            auto   auto 10/100BaseTX
    Fa0/11                       err-disabled 1            auto   auto 10/100BaseTX


-receivedカウンターも増えた

 Switch#show spanning-tree detail
 
 VLAN0001 is executing the ieee compatible Spanning Tree protocol
  Bridge Identifier has priority 32768, sysid 1, address 000d.bca2.0500
  Configured hello time 2, max age 20, forward delay 15
  We are the root of the spanning tree
  Topology change flag not set, detected flag not set
  Number of topology changes 1 last change occurred 00:03:00 ago
          from FastEthernet0/11
  Times:  hold 1, topology change 35, notification 2
          hello 2, max age 20, forward delay 15
  Timers: hello 1, topology change 0, notification 0, aging 300
 
 Port 11 (FastEthernet0/11) of VLAN0001 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.11.
   Designated root has priority 32769, address 000d.bca2.0500
   Designated bridge has priority 32769, address 000d.bca2.0500
   Designated port id is 128.11, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   Link type is point-to-point by default
   BPDU: sent 108, received 3

まぁーCatalyst2950で検証中に失敗したらこんなネタを思い出してみるのも良いかも。
CISCOに問い合わせたわけじゃないので、確証はありませんがメモとして。

**補足2 [#c26c1603]
細かい仕様がわからないのだが2台でSTPテーブルが無い状態で接続すると
高確率でERR-DISになる。
しかしならない時もある、Catalyst2950のBPDUを飛ばすタイミングによるので、詳細は不明。
確認した範囲ではルートブリッジが切り替わるBPDUを受け取るとようやくSENDを投げる。





トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS