Object trackingを利用する
- カテゴリ:
- Cisco
Object trackingを利用することで特定のルート情報があるかどうかにより、ルーティングを変更することが可能です。R1, R2, R4はそれぞれF0/0で124.124.124.0/24のネットワークで接続されています。R1はR3にシリアルケーブルで直結(13.13.13.0/24)、R2もR3にシリアルケーブルで直結(23.23.23.0/24)しています。
R1(config-if)#do sh ip int b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 124.124.124.1 YES manual up up Loopback0 17.17.1.1 YES NVRAM up up R2(config-if)#do sh ip int b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 124.124.124.2 YES manual up up Serial1/2 23.23.23.2 YES manual up up Loopback0 17.17.2.2 YES NVRAM up up R4(config-if)#do sh ip int b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 124.124.124.4 YES manual up up Loopback0 17.17.4.4 YES NVRAM up up |
R1, R2, R4でEIGRPを有効にします。
R1(config)#router eigrp 100 R1(config-router)#no auto-summary R1(config-router)#network 0.0.0.0 |
R1とR2にHSRPを設定します。R1を優先的に利用するため、プライオリティを110としました。
R1(config-if)#int f0/0 R1(config-if)#standby 124 ip 124.124.124.254 R1(config-if)#standby 124 priority 110 R2(config-if)#int f0/0 R2(config-if)#standby 124 ip 124.124.124.254 |
今回はR1が13.13.13.0/24のネットワークを持っているかどうかにより、HSRPのプライオリティを変更します。trackコマンドに続いて、オブジェクト番号を指定します。ここでは1としました。
R1(config)#track ? <1-500> Tracked object resolution Tracking resolution parameters timer Polling interval timers R1(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 stub-object Stub tracking object R1(config)#track 1 ip ? route IP route R1(config)#track 1 ip route ? A.B.C.D {/nn || A.B.C.D} Prefix and mask R1(config)#track 1 ip route 13.13.13.0/24 ? metric Route metric reachability Route reachability state R1(config)#track 1 ip route 13.13.13.0/24 reachability ? <cr> R1(config)#track 1 ip route 13.13.13.0/24 reachability |
track 1がダウンした場合、プライオリティ値を20減らす設定(110-20=90)をstandby 124に設定します。
R1(config-if)#standby 124 track 1 ? decrement Priority decrement shutdown Shutdown group <cr> R1(config-if)#standby 124 track 1 decrement ? <1-255> Decrement value R1(config-if)#standby 124 track 1 decrement 20 R1(config-if)#do sh track Track 1 IP route 13.13.13.0 255.255.255.0 reachability Reachability is Up (connected) 5 changes, last change 00:00:06 First-hop interface is Serial1/2 Tracked by: HSRP FastEthernet0/0 124 |
プライオリティ値が高いものが常にActiveになるためにはpreemptの設定が併せて必要です。
R1(config-if)#standby 124 preempt R2(config-if)#standby 124 preempt |
ここで現在の設定を確認するとR1がActiveとなっていることが分かります。
R1(config)#do sh stan bri P indicates configured to preempt. | Interface Grp Pri P State Active Standby Virtual IP Fa0/0 124 110 P Active local 124.124.124.2 124.124.124.254 R1(config-if)#do sh standb FastEthernet0/0 - Group 124 State is Active 5 state changes, last state change 00:06:30 Virtual IP address is 124.124.124.254 Active virtual MAC address is 0000.0c07.ac7c Local virtual MAC address is 0000.0c07.ac7c (v1 default) Hello time 3 sec, hold time 10 sec Next hello sent in 2.712 secs Preemption enabled Active router is local Standby router is 124.124.124.2, priority 100 (expires in 7.728 sec) Priority 110 (configured 110) Track object 1 state Up decrement 20 Group name is "hsrp-Fa0/0-124" (default) |
R1でデバグを有効にし、s0/2をシャットします。
R1(config)#do deb standb HSRP debugging is on R1(config)#int s1/2 R1(config-if)#sh Dec 26 03:52:48.779: HSRP: Fa0/0 Grp 124 Hello out 124.124.124.1 Active pri 110 vIP 124.124.124.254 Dec 26 03:52:49.795: HSRP: Fa0/0 Grp 124 Hello in 124.124.124.2 Standby pri 100 vIP 124.124.124.254 Dec 26 03:53:35.347: %LINK-5-CHANGED: Interface Serial1/2, changed state to administratively down Dec 26 03:53:36.235: %TRACKING-5-STATE: 1 ip route 13.13.13.0/24 reachability Up->Down Dec 26 03:53:36.239: HSRP: Fa0/0 Grp 124 Track 1 object changed, state Up -> Down Dec 26 03:53:36.239: HSRP: Fa0/0 Grp 124 Priority 110 -> 90 Dec 26 03:53:36.347: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to down Dec 26 03:53:36.831: HSRP: Fa0/0 Grp 124 Hello out 124.124.124.1 Active pri 90 vIP 124.124.124.254 Dec 26 03:53:36.851: HSRP: Fa0/0 Interface adv in, Active, active 1, passive 1, from 124.124.124.2 Dec 26 03:53:36.855: HSRP: Fa0/0 Grp 124 Coup in 124.124.124.2 Standby pri 100 vIP 124.124.124.254 Dec 26 03:53:36.855: HSRP: Fa0/0 Grp 124 Active: j/Coup rcvd from higher pri router (100/124.124.124.2) Dec 26 03:53:36.855: HSRP: Fa0/0 Grp 124 Active router is 124.124.124.2, was local Dec 26 03:53:36.855: HSRP: Fa0/0 Nbr 124.124.124.2 active for group 124 Dec 26 03:53:36.855: HSRP: Fa0/0 Grp 124 Standby router is unknown, was 124.124.124.2 Dec 26 03:53:36.855: HSRP: Fa0/0 Nbr 124.124.124.2 no longer standby for group 124 (Active) Dec 26 03:53:36.855: HSRP: Fa0/0 Grp 124 Active -> Speak Dec 26 03:53:36.855: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 124 state Active -> Speak Dec 26 03:53:36.855: HSRP: Fa0/0 Interface adv out, Passive, active 0 passive 1 Dec 26 03:53:36.855: HSRP: Fa0/0 Grp 124 Redundancy "hsrp-Fa0/0-124" state Active -> Speak Dec 26 03:53:36.859: HSRP: Fa0/0 Removed 124.124.124.254 from ARP Dec 26 03:53:36.859: HSRP: Fa0/0 Grp 124 Deactivating MAC 0000.0c07.ac7c Dec 26 03:53:36.859: HSRP: Fa0/0 Grp 124 Removing 0000.0c07.ac7c from MAC address filter Dec 26 03:53:36.863: HSRP: Fa0/0 Grp 124 MAC addr update Delete from SMF 0000.0c07.ac7c Dec 26 03:53:36.867: HSRP: Fa0/0 Grp 124 Hello out 124.124.124.1 Speak pri 90 vIP 124.124.124.254 Dec 26 03:53:36.875: HSRP: Fa0/0 IP Redundancy "hsrp-Fa0/0-124" update, Active -> Speak Dec 26 03:53:36.879: HSRP: Fa0/0 Interface adv in, Active, active 1, passive 0, from 124.124.124.2 Dec 26 03:53:39.835: HSRP: Fa0/0 Grp 124 Hello in 124.124.124.2 Active pri 100 vIP 124.124.124.254 Dec 26 03:53:39.871: HSRP: Fa0/0 Grp 124 Hello out 124.124.124.1 Speak pri 90 vIP 124.124.124.254 |
ActiveがR2となることが分かります。
R1(config-if)#do sh stan br P indicates configured to preempt. | Interface Grp Pri P State Active Standby Virtual IP Fa0/0 124 90 P Standby 124.124.124.2 local 124.124.124.254 R1(config-if)#do sh track Track 1 IP route 13.13.13.0 255.255.255.0 reachability Reachability is Down (no route) 6 changes, last change 00:03:38 First-hop interface is unknown Tracked by: HSRP FastEthernet0/0 124 |
コメント