※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

IPS SLAを使い、HSRPを切り替える。
対象 10.0.0.39 にPINGをWAN側インタフェースから打ち、
対象先にPINGが届かなくなったらHSRPを切り替える。
最近のCiscoIOSではないので注意「c3640-i-mz.124-21.bin」を使った。

###############################################################################
# IP SLAによるHSRP切替                                                        #
###############################################################################
ip sla monitor 2
type echo protocol ipIcmpEcho 10.0.0.39 source-interface FastEthernet0/0
ip sla monitor schedule 2 life forever start-time now
!
track 101 rtr 2 reachability

interface FastEthernet1/0
description ### LAN ###
ip address 192.168.0.3 255.255.255.0
ip broadcast-address 192.168.0.255
duplex auto
speed auto
no snmp trap link-status
standby 1 ip 192.168.0.1
standby 1 priority 110
standby 1 preempt
standby 1 track 101
!
###############################################################################



Router02(config)#track 101 rtr 2 reachability
Router02(config-track)#end
Router02#
*Mar  1 02:25:44.951: %SYS-5-CONFIG_I: Configured from console by console
Router02#
*Mar  1 02:25:45.967: %HSRP-5-STATECHANGE: FastEthernet1/0 Grp 1 state Active -> Speak
Router02#
*Mar  1 02:25:55.967: %HSRP-5-STATECHANGE: FastEthernet1/0 Grp 1 state Speak -> Standby
Router02#show standby
FastEthernet1/0 - Group 1
  State is Standby
    4 state changes, last state change 00:00:07
  Virtual IP address is 192.168.0.1
  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.648 secs
  Preemption enabled
  Active router is 192.168.0.2, priority 105 (expires in 7.632 sec)
  Standby router is local
  Priority 100 (configured 110)
    Track object 101 state Down decrement 10
  IP redundancy name is "hsrp-Fa1/0-1" (default)
Router02#
Router02#
Router02#
Router02#show ip sla moni statistics
Round trip time (RTT)   Index 2
        Latest RTT: NoConnection/Busy/Timeout
Latest operation start time: *02:25:59.779 UTC Fri Mar 1 2002
Latest operation return code: Timeout
Number of successes: 2
Number of failures: 10
Operation time to live: Forever

##対象をアップさせる。#

Router02#
*Mar  1 02:27:03.935: %TRACKING-5-STATE: 101 rtr 2 reachability Down->Up
*Mar  1 02:27:03.999: %HSRP-5-STATECHANGE: FastEthernet1/0 Grp 1 state Standby -> Active

Router02#show ip sla moni statistics
Round trip time (RTT)   Index 2
        Latest RTT: 28 ms
Latest operation start time: *02:26:59.779 UTC Fri Mar 1 2002
Latest operation return code: OK
Number of successes: 3
Number of failures: 10
Operation time to live: Forever


Router02#show standby
FastEthernet1/0 - Group 1
  State is Active
    5 state changes, last state change 00:00:12
  Virtual IP address is 192.168.0.1
  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.496 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.0.2, priority 105 (expires in 7.652 sec)
  Priority 110 (configured 110)
    Track object 101 state Up decrement 10
  IP redundancy name is "hsrp-Fa1/0-1" (default)
Router02#