現在位置: ホーム / みらくるブログ / GNS3 活用 - Cisco スイッチFHRP 編 その3(HSRP の Object Tracking 機能を使って、GWの冗長性を確実にする)

GNS3 活用 - Cisco スイッチFHRP 編 その3(HSRP の Object Tracking 機能を使って、GWの冗長性を確実にする)

HSRP の Object Tracking 機能を使って、GW ポート以外のポートが停止した場合にもGWの冗長性が生きるようにします。

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

前回は、HSRP の第2回でした。

今日は、HSRP のObject Tracking についてやってみます。

前回作成した GNS3 のプロジェクトを停止して、再び立ち上げてみたのですが、GW の standby とActive が入れ替わりました。
本来、IP アドレスが大きな R2 が Active になるべきだったので、納得しました。

ということで、この図の様になっています。
前回との違いは、ACTIVE と STANDBY が入れ替わった形になったところです。

では、HSRP の設定を確認します。

R1#sh standby bri
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Fa1/0.10    1    100   Standby 192.168.1.60    local           192.168.1.254
Fa1/0.20    2    100   Standby 192.168.2.60    local           192.168.2.254

R2#sh standby bri
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Fa1/0.10    1    100   Active  local           192.168.1.50    192.168.1.254
Fa1/0.20    2    100   Active  local           192.168.2.50    192.168.2.254

さて、PC1 から PC6 に ping を打ちながら、Active GW である、R2 の fa1/0 をシャットダウンしてみます。

PC1> ping 192.168.2.3 -c 1000
192.168.2.3 icmp_seq=1 timeout
192.168.2.3 icmp_seq=2 timeout
192.168.2.3 icmp_seq=3 timeout
84 bytes from 192.168.2.3 icmp_seq=4 ttl=63 time=13.800 ms
84 bytes from 192.168.2.3 icmp_seq=5 ttl=63 time=15.825 ms
84 bytes from 192.168.2.3 icmp_seq=6 ttl=63 time=15.678 ms
84 bytes from 192.168.2.3 icmp_seq=17 ttl=63 time=15.207 ms
84 bytes from 192.168.2.3 icmp_seq=18 ttl=63 time=15.815 ms
84 bytes from 192.168.2.3 icmp_seq=19 ttl=63 time=15.320 ms
84 bytes from 192.168.2.3 icmp_seq=20 ttl=63 time=16.027 ms
192.168.2.3 icmp_seq=21 timeout
192.168.2.3 icmp_seq=22 timeout
192.168.2.3 icmp_seq=23 timeout
192.168.2.3 icmp_seq=24 timeout
192.168.2.3 icmp_seq=25 timeout
192.168.2.3 icmp_seq=26 timeout
84 bytes from 192.168.2.3 icmp_seq=27 ttl=63 time=13.006 ms
84 bytes from 192.168.2.3 icmp_seq=28 ttl=63 time=15.776 ms
84 bytes from 192.168.2.3 icmp_seq=29 ttl=63 time=15.390 ms
84 bytes from 192.168.2.3 icmp_seq=30 ttl=63 time=16.201 ms
84 bytes from 192.168.2.3 icmp_seq=31 ttl=63 time=16.071 ms

途中で、timeout となっているところで、R2 の fa1/0 を shutdown しました。

R2 を確認します。fa2/0 は、結線はされていますが、上がってないために、R2 の状態は Init のままとなっています。

R2#sh standby bri
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Fa1/0.10    1    100   Init    unknown         unknown         192.168.1.254
Fa1/0.20    2    100   Init    unknown         unknown         192.168.2.254
R2#sh ip int bri
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES NVRAM  administratively down down    
FastEthernet0/1            unassigned      YES NVRAM  administratively down down    
FastEthernet1/0            unassigned      YES NVRAM  administratively down down    
FastEthernet1/0.10         192.168.1.60    YES NVRAM  administratively down down    
FastEthernet1/0.20         192.168.2.60    YES NVRAM  administratively down down    
FastEthernet2/0            unassigned      YES NVRAM  administratively down down    

R1 を確認します。

R1#sh standby bri
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Fa1/0.10    1    100   Active  local           unknown         192.168.1.254
Fa1/0.20    2    100   Active  local           unknown         192.168.2.254

R2 の fa1/0 を no shut したところ、通信が途切れる事はありませんでした。
ところで、もう一度 HSRP の状態を確認したところ、R1 が Active で、 R2 が Standby になっていました。
一度 Active になると、マシンを再起動しない限り、その状態が変わることはないようです。

HSRP では、preemption が無効になっていることからこうなるようです。
また、HSRP は ロードバランス機能はないということです。

さて、今日は、Object Tracking についてやってみるのでした。
Core Router と Distribution Router の接続が切れた時に、priority を 10 下げるという機能です。

このような図になります。

 


では、さっそくやってみます。
現在、GW として Active になっている R2 で、track object を作成します。

R2(config)#track ?
  <1-500>     Tracked object
  resolution  Tracking resolution parameters
  timer       Polling interval timers

R2(config)#track 1 ?
  application  Application
  interface    Select an interface to track
  ip           IP protocol
  list         Group objects in a list
  rtr          Response Time Reporter (RTR) entry

Core Layer との接続インタフェースである、fa0/0 を登録します。

R2(config)#track 1 interface fa0/0 line-protocol

ちなみに、ip でやるなら、このような設定もできます。

R2(config)#track 1 ip route 10.10.11.254 255.255.255.252 reachability

Track Object を確認します。

R2#sh track
Track 1
  Interface FastEthernet0/0 line-protocol
  Line protocol is Up
    1 change, last change 00:00:03
  Tracked by:
    HSRP FastEthernet1/0.10 1
    HSRP FastEthernet1/0.20 2

さて、この Tracking Object を、standby interface に登録します。

R2(config)#int fa1/0.10
R2(config-subif)#standby 1 track 1 decrement 10
R2(config-subif)#standby 1 priority 101

上記2つの設定順序を逆にすると、priority がいきなり 91になってしまうので注意します。

R2(config-subif)#exit
R2(config)#int fa1/0.20
R2(config-subif)#standby 2 track 1 decrement 10
R2(config-subif)#standby 2 priority 101

上記2つの設定順序を逆にすると、priority が設定した値より10減った値になってしまうので注意します。

R2#wri memR2#sh stand
FastEthernet1/0.10 - Group 1
  State is Active
    10 state changes, last state change 00:16:48
  Virtual IP address is 192.168.1.254
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.672 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.1.50, priority 100 (expires in 7.816 sec)
  Priority 101 (configured 101)
    Track object 1 state Up decrement 10
  Group name is "hsrp-Fa1/0.10-1" (default)
FastEthernet1/0.20 - Group 2
  State is Active
    10 state changes, last state change 00:16:36
  Virtual IP address is 192.168.2.254
  Active virtual MAC address is 0000.0c07.ac02
    Local virtual MAC address is 0000.0c07.ac02 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.816 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.2.50, priority 100 (expires in 8.320 sec)
  Priority 101 (configured 101)
    Track object 1 state Up decrement 10
  Group name is "hsrp-Fa1/0.20-2" (default)

Building configuration...
[OK]

また、現在STANDBY 側では、preempt を設定する必要があります。

R1#conf t
R1(config)#int fa1/0.10
R1(config-subif)#standby 1 preempt
R1(config-subif)#exit
R1(config)#int fa1/0.20
R1(config-subif)#standby 2 preempt
R1(config-subif)#end

R1#sh standby
FastEthernet1/0.10 - Group 1
  State is Standby
    12 state changes, last state change 00:03:11
  Virtual IP address is 192.168.1.254
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.272 secs
  Preemption enabled
  Active router is 192.168.1.60, priority 101 (expires in 9.208 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Fa1/0.10-1" (default)
FastEthernet1/0.20 - Group 2
  State is Standby
    13 state changes, last state change 00:02:59
  Virtual IP address is 192.168.2.254
  Active virtual MAC address is 0000.0c07.ac02
    Local virtual MAC address is 0000.0c07.ac02 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.332 secs
  Preemption enabled
  Active router is 192.168.2.60, priority 101 (expires in 9.320 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Fa1/0.20-2" (default)

さて、各 Router でルーティングの設定をして、PC が R3 にアクセスできるようにしておきます。

PC1 から Core Layer のルータに ping を打ってみます。

PC1> ping 10.10.10.254

84 bytes from 10.10.10.254 icmp_seq=1 ttl=254 time=23.703 ms
84 bytes from 10.10.10.254 icmp_seq=2 ttl=254 time=18.656 ms
84 bytes from 10.10.10.254 icmp_seq=3 ttl=254 time=16.938 ms
84 bytes from 10.10.10.254 icmp_seq=4 ttl=254 time=17.566 ms
84 bytes from 10.10.10.254 icmp_seq=5 ttl=254 time=17.887 ms

PC6> ping 10.10.11.254

84 bytes from 10.10.11.254 icmp_seq=1 ttl=254 time=21.660 ms
84 bytes from 10.10.11.254 icmp_seq=2 ttl=254 time=17.203 ms
84 bytes from 10.10.11.254 icmp_seq=3 ttl=254 time=18.016 ms
84 bytes from 10.10.11.254 icmp_seq=4 ttl=254 time=16.934 ms
84 bytes from 10.10.11.254 icmp_seq=5 ttl=254 time=16.962 ms

PC6> trace 10.10.11.254
trace to 10.10.11.254, 8 hops max, press Ctrl+C to stop
 1   192.168.2.60   9.297 ms  9.740 ms  10.053 ms
 2   *10.10.11.254   28.761 ms (ICMP type:3, code:3, Destination port unreachable)

R2 経由で、R3 の fa0/1 にリーチしていることがわかります。

さて、ここで、R2 の fa0/0 をシャットダウンします。
R1 に preempt を設定しているので、R2 のサブインタフェースの priority が 10 下げられるので、現在 R1 が 100、 R2 が priority が 101 ですから、priority が  R1 が 100 、R2 が 91 となって、 R1 のサブインタフェース経由で R3 にリーチするようになるはずです。

手順:
1.PC1 から 10.10.10.254 に ping を打ちっ放しにしておきます。
2.R2 の fa0/0 をシャットダウンします。
3. 1. の状態を目視で観察します。
4.PC1で 10.10.11.254 を trace します。
5.R1 と R2 の HSRP の状態を確認します。

では、やってみます。

1. 及び 2. (表示省略)

R2(config-if)#
*Mar  1 00:50:31.191: %TRACKING-5-STATE: 1 interface Fa0/0 line-protocol Up->Down
R2(config-if)#
*Mar  1 00:50:32.243: %HSRP-5-STATECHANGE: FastEthernet1/0.10 Grp 1 state Active -> Speak
*Mar  1 00:50:33.187: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
R2(config-if)#
*Mar  1 00:50:34.027: %HSRP-5-STATECHANGE: FastEthernet1/0.20 Grp 2 state Active -> Speak
*Mar  1 00:50:34.187: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
R2(config-if)#
*Mar  1 00:50:42.243: %HSRP-5-STATECHANGE: FastEthernet1/0.10 Grp 1 state Speak -> Standby
R2(config-if)#
*Mar  1 00:50:44.027: %HSRP-5-STATECHANGE: FastEthernet1/0.20 Grp 2 state Speak -> Standby

R1#
*Mar  1 01:06:13.239: %HSRP-5-STATECHANGE: FastEthernet1/0.10 Grp 1 state Standby -> Active
R1#
*Mar  1 01:06:15.011: %HSRP-5-STATECHANGE: FastEthernet1/0.20 Grp 2 state Standby -> Active

PC1> trace 10.10.10.254
trace to 10.10.10.254, 8 hops max, press Ctrl+C to stop
 1   192.168.1.50   7.096 ms  9.706 ms  10.068 ms
 2   *10.10.10.254   19.269 ms (ICMP type:3, code:3, Destination port unreachable)

うまくいきました。

R2#sh stand  
FastEthernet1/0.10 - Group 1
  State is Standby
    15 state changes, last state change 00:06:32
  Virtual IP address is 192.168.1.254
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.440 secs
  Preemption enabled
  Active router is 192.168.1.50, priority 100 (expires in 9.412 sec)
  Standby router is local
  Priority 91 (configured 101)
    Track object 1 state Down decrement 10
  Group name is "hsrp-Fa1/0.10-1" (default)
FastEthernet1/0.20 - Group 2
  State is Standby
    15 state changes, last state change 00:06:30
  Virtual IP address is 192.168.2.254
  Active virtual MAC address is 0000.0c07.ac02
    Local virtual MAC address is 0000.0c07.ac02 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.220 secs
  Preemption enabled
  Active router is 192.168.2.50, priority 100 (expires in 7.888 sec)
  Standby router is local
  Priority 91 (configured 101)
    Track object 1 state Down decrement 10
  Group name is "hsrp-Fa1/0.20-2" (default)

R1#sh stan
FastEthernet1/0.10 - Group 1
  State is Active
    16 state changes, last state change 00:07:07
  Virtual IP address is 192.168.1.254
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.752 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.1.60, priority 91 (expires in 9.796 sec)
  Priority 100 (default 100)
  Group name is "hsrp-Fa1/0.10-1" (default)
FastEthernet1/0.20 - Group 2
  State is Active
    17 state changes, last state change 00:07:05
  Virtual IP address is 192.168.2.254
  Active virtual MAC address is 0000.0c07.ac02
    Local virtual MAC address is 0000.0c07.ac02 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.524 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.2.60, priority 91 (expires in 9.528 sec)
  Priority 100 (default 100)
  Group name is "hsrp-Fa1/0.20-2" (default)

ちなみに、R2 の fa0/0 を no shut したら、ACTIVE - STANDBY は、元に戻りました。

なお、Standby Group は、ブロードキャスト・ドメインが異なれば、同じ番号を使うことができます。

今日試したトポロジをもう一度確認します。

 


さて、HSRP には、ロードバランス機能はないのですが、2つの VLAN を同じR2 を経由させているので、
片方は R1を経由させることはできそうです。また、DHCP サーバを用意して、GW を端末毎に設定すること
により、ロードバランスをすることはできるようです。次回はそのようなことをやってみたいです。

お疲れさまでした。第3日目の終了です。ニックネーム たいちょう でした。
次回をお楽しみに。

 

タグ: