このブログを検索

ラベル STP の投稿を表示しています。 すべての投稿を表示
ラベル STP の投稿を表示しています。 すべての投稿を表示

2012/02/03

ループガード

loopガード。bpduが途絶えると検知する。
cata1#sho run interface fastEthernet 0/3
Building configuration...

Current configuration : 134 bytes
!
interface FastEthernet0/3
switchport access vlan 10
switchport mode access
spanning-tree portfast
spanning-tree guard loop
end

cata1#
02:48:31: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
02:48:32: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to down
02:48:35: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
02:48:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up



cata1#sho spanning-tree

VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 10
Address 0016.9da0.4ec0
Cost 19
Port 3 (FastEthernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 000f.90b3.b380
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Back BLK 19 128.2 P2p
Fa0/3 Root FWD 19 128.3 P2p




Cata2950_2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Cata2950_2(config)#no spanning-tree vlan 10
Cata2950_2(config)#end




cata1#sho spanning-tree

VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 10
Address 0016.9da0.4ec0
Cost 19
Port 3 (FastEthernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 000f.90b3.b380
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Back BLK 19 128.2 P2p
Fa0/3 Desg BKN*19 128.3 P2p *LOOP_Inc

cata1#
02:49:47: %SPANTREE-2-LOOPGUARD_BLOCK: Loop guard blocking port FastEthernet0/3 on VLAN0010.
cata1#sho spanning-tree

VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 32778
Address 000f.90b3.b380
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 000f.90b3.b380
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Back BLK 19 128.2 P2p
Fa0/3 Desg BKN*19 128.3 P2p *LOOP_Inc

cata1#
cata1#sho spanning-tree interface fastEthernet 0/3 detail
Port 3 (FastEthernet0/3) of VLAN0010 is broken (Loop Inconsistent)
Port path cost 19, Port priority 128, Port Identifier 128.3.
Designated root has priority 32778, address 000f.90b3.b380
Designated bridge has priority 32778, address 000f.90b3.b380
Designated port id is 128.3, 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
Loop guard is enabled on the port
BPDU: sent 2, received 28
cata1#



cata1#show spanning-tree inconsistentports


Name Interface Inconsistency
-------------------- ---------------------- ------------------
VLAN0010 FastEthernet0/3 Loop Inconsistent

Number of inconsistent ports (segments) in the system : 1
「portfastとループガードは同時に設定できない」と、黒本に書いてあり、ciscoのサイトにもそういう記述があったけど、 設定できるぜぇ?
cata1#sho spanning-tree interface fastEthernet 0/3 detail

 Port 3 (FastEthernet0/3) of VLAN0010 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.3.
   Designated root has priority 16394, address 000b.fdb9.a680
   Designated bridge has priority 32778, address 000f.90b3.b380
   Designated port id is 128.3, designated path cost 19
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   The port is in the portfast mode
   Link type is point-to-point by default
   Loop guard is enabled on the port
   BPDU: sent 250, received 0
cata1#

ね?

BPDUガード

portfastを設定したポートにスイッチをつないでループが発生する状況を作ろうと思ったが、どうしてもできない。

ループが発生するのは2つのスイッチで両方spanning treeを無効にした場合だけである。
2つのスイッチのvlan 10に所属する二つのポートをそれぞれportfastに設定して2本のケーブルでつないだら、 全部FWDになってループが発生すると思ったのだが、ちゃんと一個がBLKになる。どうしてだろう・・・?

portfastを設定したことによってループが発生することになる例が思いつかない。

基本的なところから確認していこう。 まず、STPに対応していないL2スイッチを、ループが発生するようなトポロジで、つまり、2本のケーブルで同じセグメントを接続してみたらどうなるか。

1本目のケーブルを接続すると、LIS, LRNを経てFWDになる。 2本目を接続すると、即時BLKとなる。 この、2本目を接続するポートをportfastにしたらループが発生しそうだ。 

やってみよう。 ・・・が、ポートはやはり即時BLKとなる。

Interface Role Sts Cost Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Back BLK 19 128.2 P2p


fa0/1,0/2をともにportfastに設定してSTPに対応していないスイッチングハブに接続したが、ひとつがBLKになり、 ループは発生しない。これでループが発生しないなら問題ないでしょ・・・・

でも、どうして両方portfastにしても片方がBLKになるんだろう? STP未対応のスイッチングハブでも、BPDUは転送するから、ひとつのポートから送信されたBPDUをもう一方で受信することでBLKになるのか。

http://www.cisco.com/cisco/web/support/JP/100/1007/1007812_65-j.html

どうやら、portfastを設定することによりループが発生することにはならないようだ。 portfastを設定することによって問題となる可能性のあるのは、そのポートにL2スイッチを接続してそれがルートになることにより、トポロジに予期しない変化が発生することのようだ。

そこで、bpduguardを設定する。これはグローバルに設定する。 bpduguardを設定した状態で、portfastを設定したポートにSTP対応スイッチを接続すると、 リンクアップするがすぐにerrdisableになる。

cata1(config)#spanning-tree portfast ?
bpdufilter Enable portfast bdpu filter on this switch
bpduguard Enable portfast bpdu guard on this switch
default Enable portfast by default on all access ports

cata1(config)#spanning-tree portfast bpduguard
cata1(config)#end
cata1#
02:19:08: %SYS-5-CONFIG_I: Configured from console by console
cata1#sho spanning-tree



VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 32778
Address 000f.90b3.b380
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 000f.90b3.b380
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Back BLK 19 128.2 P2p





cata1#
02:19:30: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
02:19:30: %SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port FastEthernet0/3 with BPDU Guard enabled. Disabling port.
02:19:30: %PM-4-ERR_DISABLE: bpduguard error detected on Fa0/3, putting Fa0/3 in err-disable state
02:19:32: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to down
cata1#
cata1#sho spanning-tree

VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 32778
Address 000f.90b3.b380
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 000f.90b3.b380
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Back BLK 19 128.2 P2p


bpduguardの意味が、やっとわかった。

2008/03/01

uplinkfastとbackbonefast

uplinkfast と backbonefastをやってみる。

例の三角形トポロジにおいて、blocking portを持っているスイッチの、fwd portの線を抜いて見ると、root portがダウンするためaltn portがlearning, listening, forwardingと遷移する。

00:40:14: STP: VLAN0001 new root port Fa0/5, cost 38
00:40:14: STP: VLAN0001 Fa0/5 -> listening
00:40:15: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to down
00:40:16: STP: VLAN0001 sent Topology Change Notice on Fa0/5
00:40:16: %LINK-3-UPDOWN: Interface FastEthernet0/12, changed state to down
00:40:29: STP: VLAN0001 Fa0/5 -> learning
00:40:44: STP: VLAN0001 Fa0/5 -> forwarding



今度はuplinkfastを有効にしてみる。

2950_2(config)#spanning-tree uplinkfast
2950_2(config)#
00:43:30: setting bridge id (which=1) prio 49153 prio cfg 49152 sysid 1 (on) id C001.0008.e32e.5980
00:43:30: STP: VLAN0001 Fa0/5 -> blocking (uplinkfast)
00:43:30: %SPANTREE_FAST-7-PORT_FWD_UPLINK: VLAN0001 FastEthernet0/12 moved to Forwarding (UplinkFast).
00:43:30: STP: VLAN0001 sent Topology Change Notice on Fa0/12
00:43:30: setting bridge id (which=1) prio 49154 prio cfg 49152 sysid 2 (on) id C002.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49155 prio cfg 49152 sysid 3 (on) id C003
2950_2(config)#.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49156 prio cfg 49152 sysid 4 (on) id C004.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49157 prio cfg 49152 sysid 5 (on) id C005.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49158 prio cfg 49152 sysid 6 (on) id C006.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49159 prio cfg 49152 sysid 7 (on) id C007.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49160 prio cfg 49152 sysid 8 (on) id C008.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49161 prio cfg 49152 sysid 9 (on) id C009.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49162 prio cfg 49152 sysid 10 (on) id C00A.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49186 prio cfg 49152 sysid 34 (on) id C022.0008.e32e.5980
00:43:30: setting bridge id (which=1) prio 49251 prio cfg 49152 sysid 99 (on) id C063.0008.e32e.5980



今度はlink downが起きると瞬時にalt portがforwardingになる。

00:46:38: STP: VLAN0001 new root port Fa0/5, cost 3038
00:46:38: %SPANTREE_FAST-7-PORT_FWD_UPLINK: VLAN0001 FastEthernet0/5 moved to Forwarding (UplinkFast).
00:46:39: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to down
00:46:40: STP: VLAN0001 sent Topology Change Notice on Fa0/5
00:46:40: %LINK-3-UPDOWN: Interface FastEthernet0/12, changed state to down
2950_2#


backbonefastは、自分のportではない間接linkdownの際に機能する。Root Link Queryの要求と応答によって機能するため、ネットワーク上のすべてのSWで設定する必要がある。

また、portfastやuplinkfastと違い、瞬時にalt portをアップさせることはできない。
ちなみに私はbackbonefastをサポートしているSWを2台しか持っていないので実際の動作は確認できない。

2008/02/09

HSRPとportfastの実験

 2514_1       2514_2
  |.101        |.102
  |            |
  |   (.100)   |
  |            |
  |   ------   |
  +---+ SW +---+
      ------
        |      192.168.1.0/24
    pc

2514_1
priority:100 (default)
preemptあり

2514_2
priority:90
preemptなし



この状態から 2514_1をダウンさせる。
2514_2#debug standby events
HSRP Events debugging is on
2514_2#
2514_1がリンクダウン
2514_2#
00:13:15: SB1: Et0 Standby: c/Active timer expired (192.168.1.101)
00:13:15: SB1: Et0 Active router is local, was 192.168.1.101
00:13:15: SB: Et0 Remove active hash 192.168.1.101 (vIP 192.168.1.100)
00:13:15: SB: Et0 Add passive hash 192.168.1.101
00:13:15: SB: Et0 Add active hash 192.168.1.102 (vIP 192.168.1.100)
00:13:15: SB1: Et0 Standby router is unknown, was local
00:13:15: SB1: Et0 Standby - Active
00:13:15: %STANDBY-6-STATECHANGE: Ethernet0 Group 1 state Standby -> Active
00:13:15: SB1: Et0 Redundancy "hsrp-Et0-1" state Standby -> Active
00:13:15: SB: Et0 Redirect adv stop
00:13:15: SB1: Et0 Changing interface MAC address to 0000.0c07.ac01
2514_2#
2514_2#sho standby
Ethernet0 - Group 1
Local state is Active, priority 90
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 1.140
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is unknown
Virtual mac address is 0000.0c07.ac01
8 state changes, last state change 00:00:19
IP redundancy name is "hsrp-Et0-1" (default)
2514_2がactiveになった。

ここで2514_1がリンクアップすると、

2514_2#
00:14:14: SB1: Et0 Active: j/Coup rcvd from higher pri router (100/192.168.1.101)
00:14:14: SB1: Et0 Active router is 192.168.1.101, was local
00:14:14: SB: Et0 Remove active hash 192.168.1.102 (vIP 192.168.1.100)
00:14:14: SB: Et0 Remove passive hash 192.168.1.101 (frc 0)
00:14:14: SB: Et0 Add active hash 192.168.1.101 (vIP 192.168.1.100)
00:14:14: SB1: Et0 Active -> Speak
00:14:14: %STANDBY-6-STATECHANGE: Ethernet0 Group 1 state Active -> Speak
00:14:14: SB1: Et0 Redundancy "hsrp-Et0-1" state Active -> Speak
00:14:14: SB: Et0 Redirect adv start
00:14:24: SB1: Et0 Speak: d/Standby timer expired (unknown)
00:14:24: SB1: Et0 Standby router is local
00:14:24: SB1: Et0 Speak -> Standby
00:14:24: SB1: Et0 Redundancy "hsrp-Et0-1" state Speak -> Standby
priorityが高い2514_1が現れ、preemptが設定されているため、
2514_1がactiveになり、2514_2はstandbyになる。

2514_1#sho standby
Ethernet0 - Group 1
Local state is Active, priority 100, may preempt
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 0.044
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is 192.168.1.102, priority 90 expires in 8.620
Virtual mac address is 0000.0c07.ac01
11 state changes, last state change 00:02:53
IP redundancy name is "hsrp-Et0-1" (default)
2514_2#sho standby
Ethernet0 - Group 1
Local state is Standby, priority 90
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 2.064
Virtual IP address is 192.168.1.100 configured
Active router is 192.168.1.101, priority 100 expires in 7.828
Standby router is local
10 state changes, last state change 00:00:12
IP redundancy name is "hsrp-Et0-1" (default)
2台のルータのhsrpのconfigは以下のとおり。
2514_1#sho run
Building configuration...

!
interface Ethernet0
ip address 192.168.1.101 255.255.255.0
standby 1 ip 192.168.1.100
standby 1 preempt
!

2514_2#sho run
Building configuration...

interface Ethernet0
ip address 192.168.1.102 255.255.255.0
standby 1 ip 192.168.1.100
standby 1 priority 90
!
2をdownさせるとstandbyがいなくなるだけで、1はactiveのまま。

2514_2をupさせると、preemptが設定されてはいるが、1のほうがpriorityが高いのでやはり1がactiveのまま。

2514_2がup
2514_1#
00:40:46: SB1: Et0 Hello in 192.168.1.102 Active pri 90 ip 192.168.1.100
00:40:46: SB1: Et0 Active: h/Hello rcvd from lower pri Active router (90/192.168.1.102)
00:40:49: SB1: Et0 Redundancy group hsrp-Et0-1 state Active -> Active
00:40:52: SB1: Et0 Redundancy group hsrp-Et0-1 state Active -> Active
00:40:56: SB1: Et0 Standby router is 192.168.1.102
2514_1#
2514_1#sho standby
Ethernet0 - Group 1
Local state is Active, priority 100
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 2.498
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is 192.168.1.102, priority 90 expires in 7.912
Virtual mac address is 0000.0c07.ac01
14 state changes, last state change 00:02:59
IP redundancy name is "hsrp-Et0-1" (default)
ではここから1をdown&upさせたらどうなるか。
1がdownすると当然2がactiveになるが、1をupさせるとpriorityの高い1がactiveになった。
1にはpreemptを設定していないのに・・・・
2514_2#
00:41:49: SB1: Et0 Standby: c/Active timer expired (192.168.1.101)
00:41:49: SB1: Et0 Active router is local, was 192.168.1.101
00:41:49: SB: Et0 Remove active hash 192.168.1.101 (vIP 192.168.1.100)
00:41:49: SB: Et0 Add passive hash 192.168.1.101
00:41:49: SB: Et0 Add active hash 192.168.1.102 (vIP 192.168.1.100)
00:41:49: SB1: Et0 Standby router is unknown, was local
00:41:49: SB1: Et0 Standby -> Active
00:41:49: %STANDBY-6-STATECHANGE: Ethernet0 Group 1 state Standby -> Active
00:41:49: SB1: Et0 Redundancy "hsrp-Et0-1" state Standby -> Active
00:41:49: SB: Et0 Redirect adv stop
00:41:49: SB1: Et0 Changing interface MAC address to 0000.0c07.ac01
2514_2#
2514_2#sho stand
Ethernet0 - Group 1
Local state is Active, priority 90, may preempt
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 1.584
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is unknown
Virtual mac address is 0000.0c07.ac01
26 state changes, last state change 00:00:33
IP redundancy name is "hsrp-Et0-1" (default)
2514_1がup

2514_1#
00:43:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0, changed state to up
00:43:31: SB: Et0 Interface up
00:43:31: SB: Et0 Starting minimum interface delay (1 secs)
00:43:32: SB: Et0 Interface min delay expired
00:43:32: SB1: Et0 Init: a/HSRP enabled
00:43:32: SB1: Et0 Init -> Listen
00:43:32: SB1: Et0 Redundancy "hsrp-Et0-1" state Init -> Backup
00:43:32: SB: Et0 Redirect adv start
00:43:42: SB1: Et0 Listen: c/Active timer expired (unknown)
00:43:42: SB1: Et0 Listen -> Speak
00:43:42: SB1: Et0 Redundancy "hsrp-Et0-1" state Backup -> Speak
00:43:52: SB1: Et0 Speak: d/Standby timer expired (unknown)
00:43:52: SB1: Et0 Standby router is local
00:43:52: SB1: Et0 Speak -> Standby
00:43:52: SB1: Et0 Redundancy "hsrp-Et0-1" state Speak -> Standby
00:43:52: SB1: Et0 Standby: c/Active timer expired (unknown)
00:43:52: SB1: Et0 Active router is local
00:43:52: SB: Et0 Add active hash 192.168.1.101 (vIP 192.168.1.100)
00:43:52: SB1: Et0 Standby router is unknown, was local
00:43:52: SB1: Et0 Standby -> Active
00:43:52: %STANDBY-6-STATECHANGE: Ethernet0 Group 1 state Standby -> Active
00:43:52: SB1: Et0 Redundancy "hsrp-Et0-1" state Standby -> Active
00:43:52: SB: Et0 Redirect adv stop
00:43:52: SB1: Et0 Changing interface MAC address to 0000.0c07.ac01
00:43:58: SB1: Et0 Hello in 192.168.1.102 Active pri 90 ip 192.168.1.100
00:43:58: SB1: Et0 Active: h/Hello rcvd from lower pri Active router (90/192.168.1.102)
00:44:01: SB1: Et0 Redundancy group hsrp-Et0-1 state Active -> Active
00:44:04: SB1: Et0 Redundancy group hsrp-Et0-1 state Active -> Active
00:44:08: SB1: Et0 Standby router is 192.168.1.102
2514_1#2514_1#sho standby
Ethernet0 - Group 1
Local state is Active, priority 100
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 1.010
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is 192.168.1.102, priority 90 expires in 9.536
Virtual mac address is 0000.0c07.ac01
17 state changes, last state change 00:00:22
IP redundancy name is "hsrp-Et0-1" (default)
では、両方preemptを消して見よう。
こうすると1を down upさせても 2がactiveのままになるはず。

2514_1がdown
2514_2#debug stand eve
HSRP Events debugging is on

01:00:31: SB1: Et0 Standby: c/Active timer expired (192.168.1.101)
01:00:31: SB1: Et0 Active router is local, was 192.168.1.101
01:00:31: SB: Et0 Remove active hash 192.168.1.101 (vIP 192.168.1.100)
01:00:31: SB: Et0 Add passive hash 192.168.1.101
01:00:31: SB: Et0 Add active hash 192.168.1.102 (vIP 192.168.1.100)
01:00:31: SB1: Et0 Standby router is unknown, was local
01:00:31: SB1: Et0 Standby -> Active
01:00:31: %STANDBY-6-STATECHANGE: Ethernet0 Group 1 state Standby -> Active
01:00:31: SB1: Et0 Redundancy "hsrp-Et0-1" state Standby -> Active
01:00:31: SB: Et0 Redirect adv stop
01:00:31: SB1: Et0 Changing interface MAC address to 0000.0c07.ac01
2514_2#
2514_2#sho stand
Ethernet0 - Group 1
Local state is Active, priority 90
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 0.396
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is unknown
Virtual mac address is 0000.0c07.ac01
34 state changes, last state change 00:00:14
IP redundancy name is "hsrp-Et0-1" (default)
2514_1がup
2514_2#
01:01:26: SB1: Et0 Active: j/Coup rcvd from higher pri router (100/192.168.1.101)
01:01:26: SB1: Et0 Active router is 192.168.1.101, was local
01:01:26: SB: Et0 Remove active hash 192.168.1.102 (vIP 192.168.1.100)
01:01:26: SB: Et0 Remove passive hash 192.168.1.101 (frc 0)
01:01:26: SB: Et0 Add active hash 192.168.1.101 (vIP 192.168.1.100)
01:01:26: SB1: Et0 Active -> Speak
01:01:26: %STANDBY-6-STATECHANGE: Ethernet0 Group 1 state Active -> Speak
01:01:26: SB1: Et0 Redundancy "hsrp-Et0-1" state Active -> Speak
01:01:26: SB: Et0 Redirect adv start
01:01:36: SB1: Et0 Speak: d/Standby timer expired (unknown)
01:01:36: SB1: Et0 Standby router is local
01:01:36: SB1: Et0 Speak -> Standby
01:01:36: SB1: Et0 Redundancy "hsrp-Et0-1" state Speak -> Standby
2514_2#
2514_2#sho stand
Ethernet0 - Group 1
Local state is Standby, priority 90
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 1.296
Virtual IP address is 192.168.1.100 configured
Active router is 192.168.1.101, priority 100 expires in 7.560
Standby router is local
36 state changes, last state change 00:01:08
IP redundancy name is "hsrp-Et0-1" (default)
あれ、おかしいな、1がactiveになった・・・

これは、2台のルータを接続しているcatalystのポートがデフォルト設定のままのため、link upまでに30秒かかっていることが原因と思われる。portfastを設定して即時リンクアップするようにしたら1が復帰しても2がactiveのままになった。

では、portfastを設定した状態で、priorityの低い2だけにpreemptを設定した場合をもう一度やってみる。

まず、1:active, 2:standyで、1をdown upさせた場合。
2514_2#sho stand
Ethernet0 - Group 1
Local state is Standby, priority 90, may preempt
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 0.750
Virtual IP address is 192.168.1.100 configured
Active router is 192.168.1.101, priority 100 expires in 9.340
Standby router is local
10 state changes, last state change 00:00:13
IP redundancy name is "hsrp-Et0-1" (default)
2514_1がDOWN
2514_2#
00:16:35: SB1: Et0 Standby: c/Active timer expired (192.168.1.101)
00:16:35: SB1: Et0 Active router is local, was 192.168.1.101
00:16:35: SB: Et0 Remove active hash 192.168.1.101 (vIP 192.168.1.100)
00:16:35: SB: Et0 Add passive hash 192.168.1.101
00:16:35: SB: Et0 Add active hash 192.168.1.102 (vIP 192.168.1.100)
00:16:35: SB1: Et0 Standby router is unknown, was local
00:16:35: SB1: Et0 Standby -> Active
00:16:35: %STANDBY-6-STATECHANGE: Ethernet0 Group 1 state Standby -> Active
00:16:35: SB1: Et0 Redundancy "hsrp-Et0-1" state Standby -> Active
00:16:35: SB: Et0 Redirect adv stop
00:16:35: SB1: Et0 Changing interface MAC address to 0000.0c07.ac01
2514_2#
2514_2#sho stand
Ethernet0 - Group 1
Local state is Active, priority 90, may preempt
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 2.712
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is unknown
Virtual mac address is 0000.0c07.ac01
11 state changes, last state change 00:00:09
IP redundancy name is "hsrp-Et0-1" (default)
2514_1がup
2514_2#sho stand
Ethernet0 - Group 1
Local state is Active, priority 90, may preempt
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 2.684
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is 192.168.1.101, priority 100 expires in 9.036
Virtual mac address is 0000.0c07.ac01
11 state changes, last state change 00:00:55
IP redundancy name is "hsrp-Et0-1" (default)
1のほうがpriorityが高いが、preemptを設定していないので、2がactiveのままとなる。

では、preemptを設定した2をdown upさせる。

2514_2がdown
2514_2#
00:17:53: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0, changed state to down
00:17:53: SB: Et0 Interface down
00:17:53: SB1: Et0 Active: b/HSRP disabled
00:17:53: SB1: Et0 Active router is unknown, was local
00:17:53: SB: Et0 Remove active hash 192.168.1.102 (vIP 192.168.1.100)
00:17:54: SB1: Et0 Standby router is unknown, was 192.168.1.101
00:17:54: SB1: Et0 Active -> Init
00:17:54: %STANDBY-6-STATECHANGE: Ethernet0 Group 1 state Active -> Init
00:17:54: SB1: Et0 Redundancy "hsrp-Et0-1" state Active -> Init
2514_2#
2514_2#sho standby
Ethernet0 - Group 1
Local state is Init (interface down), priority 90, may preempt
Hellotime 3 sec, holdtime 10 sec
Virtual IP address is 192.168.1.100 configured
Active router is unknown
Standby router is unknown
12 state changes, last state change 00:00:06
IP redundancy name is "hsrp-Et0-1" (default)
2514_2#


2514_1#debug stand eve
HSRP Events debugging is on
2514_1#2514_1#sho stand
Ethernet0 - Group 1
Local state is Active, priority 100
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 0.096
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is unknown
Virtual mac address is 0000.0c07.ac01
14 state changes, last state change 00:00:43
IP redundancy name is "hsrp-Et0-1" (default)
2514_2がup
2514_1#2514_1#sho stand
Ethernet0 - Group 1
Local state is Active, priority 100
Hellotime 3 sec, holdtime 10 sec
Next hello sent in 0.038
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is 192.168.1.102, priority 90 expires in 8.944
Virtual mac address is 0000.0c07.ac01
14 state changes, last state change 00:01:27
IP redundancy name is "hsrp-Et0-1" (default)
00:19:18: SB1: Et0 Standby router is 192.168.1.102
2にはpreemptを設定してあるが、priorityが1より低いため、その機能は有効にならない。

HSRPはRFC2281、VRRPはRFC2338で定義(?)されている。
しかし2281はCategory: informationalで、2338は Proposal Standardである。
HSRPはcisco独自の規格であり、VRRPは汎用化されたためにそうなっているようであるが、
VRRPはHSRPを元に作られたようで、動きもそっくりなようだ。

・・・

やっぱり実際に設定して動かして見ないとわかんないね。
portfastとのカラミでおかしなことになるのもいい勉強になった。

STPの実験

pty:32768
mac:0004.2xxx.0ec0
   +----+10
   |24_1+--------------+
   +--+-+              |
      |2               |
      |                |
      |2               |10(X)
   +--+-+           +--+-+
   |24_2+-----------+12_1|
   +----+6         6+----+
  pty:32768            pty:32768
  mac:0003.fxxx.8580   mac:0004.9xxx.23c0
  ROOT

デフォルトの設定だと、24_2のMACが最小なのでルートになる。

各switchでの、show spanning-treeの結果(最初の部分だけ)
cata2924_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.2xxx.0ec0 ※自分のmac
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address 0003.fe67.8580 ※root bridgeのMAC
Root port is 14, cost of root path is 19
Topology change flag not set, detected flag not set, changes 15
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0





cata2924_02#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0003.fxxx.8580 ※自分のMAC
Configured hello time 2, max age 20, forward delay 15
We are the root of the spanning tree ※自分がrootである
Topology change flag not set, detected flag not set, changes 14
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 1, topology change 0, notification 0

cata2912_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.9xxx.23c0 ※自分のMAC
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address 0003.fxxx.8580 ※rootのMAC
Root port is 18, cost of root path is 19
Topology change flag not set, detected flag not set, changes 14
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0

ここでdebugを有効にしてから、24_1と12_1間のケーブルを抜いて、さして見る。
cata2924_01#debug spantree events
Spanning Tree event debugging is on
cata2924_01#
02:48:08: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to down
02:48:08: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
02:48:08: ST: FastEthernet0/10 vlan 1 -> blocking
02:48:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to down
02:48:16: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to up
02:48:16: ST: FastEthernet0/10 vlan 1 -> listening
02:48:17: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to up
02:48:31: ST: FastEthernet0/10 vlan 1 -> learning
02:48:47: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
02:48:47: ST: FastEthernet0/10 vlan 1 -> forwarding
cata2924_01#

listening -> learning -> forwarding まで15秒ずつ、合計30秒かかっている。 15というのはforward delay の値である。それでは、24_1で、forward delayの値を変えて見よう。
cata2924_01(config)#spanning-tree forward-time 18

cata2924_01#
02:52:07: %SYS-5-CONFIG_I: Configured from console by consolesho spa
cata2924_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.2xxx.0ec0
Configured hello time 2, max age 20, forward delay 18
Current root has priority 32768, address 0003.fxxx.8580
Root port is 14, cost of root path is 19
Topology change flag not set, detected flag not set, changes 20
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0

2箇所あるforward delayのうち、Configuredで始まる行の方だけが、変更した値になっている。それではまた先ほどのようにケーブルを抜き差ししてみよう。
cata2924_01#

02:54:17: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to down
02:54:17: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
02:54:17: ST: FastEthernet0/10 vlan 1 -> blocking
02:54:18: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to down
02:54:23: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to up
02:54:23: ST: FastEthernet0/10 vlan 1 -> listening
02:54:24: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to up
02:54:38: ST: FastEthernet0/10 vlan 1 -> learning
02:54:53: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
02:54:53: ST: FastEthernet0/10 vlan 1 -> forwarding

各stateの間隔は15秒のままである。他のスイッチのshow spanning-treeの結果をみても、15秒のままになっている。timerの値はrootで変更しなければ反映しない。
cata2924_02#conf t

Enter configuration commands, one per line. End with CNTL/Z.
cata2924_02(config)#spanning-tree forward-time 18
cata2924_02(config)#end
cata2924_02#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0003.fxxx.8580
Configured hello time 2, max age 20, forward delay 18
We are the root of the spanning tree
Topology change flag not set, detected flag not set, changes 20
Times: hold 1, topology change 38, notification 2
hello 2, max age 20, forward delay 18
Timers: hello 0, topology change 0, notification 0

forward delayの変更が反映された。 他のスイッチでもConfiguredのところは各自のconfigのままで、 下のほうにある値に反映されている。
cata2924_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.2xxx.0ec0
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address 0003.fxxx.8580
Root port is 14, cost of root path is 19
Topology change flag not set, detected flag not set, changes 22
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 18
Timers: hello 0, topology change 0, notification 0





cata2912_01#sho spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address 0004.9xxx.23c0
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address 0003.fe67.8580
Root port is 18, cost of root path is 19
Topology change flag not set, detected flag not set, changes 20
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 18
Timers: hello 0, topology change 0, notification 0

もう一度ケーブルの抜き差しをしてみると
cata2924_01#

03:05:10: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to down
03:05:10: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
03:05:10: ST: FastEthernet0/10 vlan 1 -> blocking
03:05:11: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to down
03:05:14: %LINK-3-UPDOWN: Interface FastEthernet0/10, changed state to up
03:05:14: ST: FastEthernet0/10 vlan 1 -> listening
03:05:15: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to up
03:05:32: ST: FastEthernet0/10 vlan 1 -> learning
03:05:51: ST: sent Topology Change Notice on FastEthernet0/2 vlan 1
03:05:51: ST: FastEthernet0/10 vlan 1 -> forwarding

各stateの間隔が18秒になった。 timer値を変える場合はrootで変えなければならない。 ただし、むやみに変えるのはよくないそうです。