現在位置: ホーム / みらくるブログ / GNS3 活用 - Cisco スイッチ STP 編 その5 (portfast でユーザに迅速にサービスを提供)

GNS3 活用 - Cisco スイッチ STP 編 その5 (portfast でユーザに迅速にサービスを提供)

portfast の実験です。

お疲れさまです。ニックネーム たいちょう です。

今日は、portfast をやってみます。前回(GNS3 活用 - Cisco スイッチ STP 編 その4(port priority の変更による経路変更))の続きです。

アクセススイッチには、PCがぶら下がっていると思いますが、トポロジの変更があった時に、何10秒も待たされるのは困る、という時に設定するとよい機能です。

タスク

portfast を設定して、挙動を観察する。なぜそうなったのか考える。図に記入する。

まずは、以下の様なトポロジを作成します。

Sw4#sh spanning-tree bri

VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     c402.60c2.0000
             Cost        38
             Port        55 (FastEthernet1/14)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768
             Address     c406.2668.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    38 32768 c406.2668.0000 128.41
FastEthernet1/1      128.42   128    19 FWD    38 32768 c406.2668.0000 128.42
FastEthernet1/14     128.55   128    19 FWD    19 16384 c403.60d0.0000 128.55
FastEthernet1/15     128.56   128    19 BLK    19 32768 c404.60df.0000 128.56

Sw4#sh spanning-tree summary
Root bridge for: none.
PortFast BPDU Guard is disabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                1        0         0        3          4         
-------------------- -------- --------- -------- ---------- ----------
              1 VLAN 1        0         0        3          4        

portfast は無効になっています。


Sw4#conf t
Sw4(config)#spanning-tree portfast ?
  bpduguard  Enable portfast bpdu guard on this switch
Sw4(config)#spanning-tree portfast bpduguard
Sw4#sh spanning-tree summary
Root bridge for: none.
PortFast BPDU Guard is enabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                1        0         0        3          4         
-------------------- -------- --------- -------- ---------- ----------
              1 VLAN 1        0         0        3          4         

portfast が有効になりました。
一緒に、BPDU Guard も有効になったようです。

でもちょと待って。クライアントがぶら下がるポートだけに portfast を有効にしたいのですが。

やり直します。まず、設定を無効にします。


Sw4(config)#no spanning-tree portfast bpduguard

多くのインタフェースを設定できる range コマンドを活用します。


Sw4(config)#int range fa1/0 - 13  
Sw4(config-if-range)#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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/0 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/1 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/2 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/3 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/4 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/5 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/6 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/7 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/8 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/9 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/10 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/11 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/12 but will only
 have effect when the interface is in a non-trunking mode.
%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 spanning tree loops.
 Use with CAUTION

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

なんだかズラズラと表示されました。portfast はトランクモードには設定するなよ、と言っているようです。
fa1/0-13 は、クライアント専用ポートにしたいので、これでいいでしょう。


Sw4#sh spanning-tree summary
Root bridge for: none.
PortFast BPDU Guard is disabled
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
-------------------- -------- --------- -------- ---------- ----------
VLAN1                1        0         0        3          4         
-------------------- -------- --------- -------- ---------- ----------
              1 VLAN 1        0         0        3          4         

ブリッジ全体では、portfast は無効になっていますが。
設定したポートでは portfast が有効になっています。


Sw4#sh run | begin interface FastEthernet1/0
interface FastEthernet1/0
 spanning-tree portfast
!
interface FastEthernet1/1
 spanning-tree portfast
!
interface FastEthernet1/2
 spanning-tree portfast
!
interface FastEthernet1/3
 spanning-tree portfast
!
interface FastEthernet1/4
 spanning-tree portfast
!
interface FastEthernet1/5
 spanning-tree portfast
!
interface FastEthernet1/6
 spanning-tree portfast
!
interface FastEthernet1/7
 spanning-tree portfast
!         
interface FastEthernet1/8
 spanning-tree portfast
!         
interface FastEthernet1/9
 spanning-tree portfast
!         
interface FastEthernet1/10
 spanning-tree portfast
!         
interface FastEthernet1/11
 spanning-tree portfast
!         
interface FastEthernet1/12
 spanning-tree portfast
!         
interface FastEthernet1/13
 spanning-tree portfast
!         
interface FastEthernet1/14
!         
interface FastEthernet1/15
!

どれぐらい早くforwarding state になるか確認してみます。
まず、fa1/1 を shutdown してから、再度起動してみます。

         
Sw4# debug spanning-tree events
Sw4(config)#int fa1/1
Sw4(config-if)#shut
Sw4(config-if)#
*Mar  1 00:13:41.811: STP: VLAN1 Fa1/1 -> blocking
Sw4(config-if)#
*Mar  1 00:13:43.811: %LINK-5-CHANGED: Interface FastEthernet1/1, changed state to administratively down
*Mar  1 00:13:44.811: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to down
Sw4(config-if)#no shut
Sw4(config-if)#
*Mar  1 00:13:53.387: STP: VLAN1 Fa1/1 ->jump to forwarding from blocking
Sw4(config-if)#
*Mar  1 00:13:56.379: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up

かかった秒数は、数秒ですかね。
では、通常では何秒かかるでしょうか。


Sw4(config-if)#no spanning-tree portfast
Sw4(config-if)#shut
Sw4(config-if)#
*Mar  1 00:15:46.963: STP: VLAN1 sent Topology Change Notice on Fa1/14
*Mar  1 00:15:46.967: STP: VLAN1 Fa1/1 -> blocking
Sw4(config-if)#
*Mar  1 00:15:48.963: %LINK-5-CHANGED: Interface FastEthernet1/1, changed state to administratively down
*Mar  1 00:15:49.963: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to down
Sw4(config-if)#no shut
Sw4(config-if)#
*Mar  1 00:15:54.367: STP: VLAN1 Fa1/1 -> listening
Sw4(config-if)#
*Mar  1 00:15:57.351: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
Sw4(config-if)#
*Mar  1 00:16:09.367: STP: VLAN1 Fa1/1 -> learning
Sw4(config-if)#
*Mar  1 00:16:24.367: STP: VLAN1 sent Topology Change Notice on Fa1/14
*Mar  1 00:16:24.367: STP: VLAN1 Fa1/1 -> forwarding

30秒かかっています。
設定は戻しておきます。

Sw4(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 spanning tree loops.
 Use with CAUTION

%Portfast has been configured on FastEthernet1/1 but will only
 have effect when the interface is in a non-trunking mode.
Sw4(config-if)#end
Sw4#wr

このコマンドでも確認しておきます。


Sw4#sh spanning-tree interface fa1/1
 Port 42 (FastEthernet1/1) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.42.
   Designated root has priority 8192, address c402.60c2.0000
   Designated bridge has priority 32768, address c406.2668.0000
   Designated port id is 128.42, designated path cost 38
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 224, received 0
   The port is in the portfast mode

お疲れさまでした。今日の確認作業は終了です。

次回は、 uplinkfast をやってみたいです。

ニックネーム たいちょうでした。次回をお楽しみに。

 

タグ: