自宅ルータのWANポートのアドレスがDHCP取得のためIPの切り替わりの時などに通信断が続くことがあるため、IP SLA/EEMの機能により監視と自動設定変更を実施させる。
8.8.8.8へのPING監視を実施してダウンの発生から継続時間により任意のポートを再起動させている。以下のコマンドにより設定が実施できた。
※%TRACK-6-STATE: 200 ip sla 1 reachability Up -> Downのログが出力されるとtrack 200が実施 される。
※%TRACK-6-STATE: 200 ip sla 1 reachability Down -> Upのログが出力されるとtrack 200が再開される
ip sla 1
icmp-echo x.x.x.x
timeout 1000
frequency 720
!
ip sla 2
icmp-echo x.x.x.x
timeout 1000
frequency 300
!
ip sla schedule 1 life forever start-time after 00:10:00
ip sla schedule 2 life forever start-time after 00:05:00
!
track 100 ip sla 1 reachability
track 200 ip sla 2 reachability
!
event manager applet RELOAD
event track 100 state down
action 1.0 reload
!
event manager applet LINK-UP-DOWN
event track 200 state down
action 1.0 cli command “enable”
action 2.0 cli command “config t”
action 3.0 cli command “interface xxxxx”
action 4.0 cli command “shutdown”
action 5.0 cli command “no shutdown”
action 6.0 cli command “end”
※x.x.x.xは監視先のIPを設定
◇ icmp-echo 200.1.1.1 source-interface GigabitEthernet0/1
⇒ ICMP Echoリクエストを送信する宛先IPアドレスと送信元インターフェースの指定
◇ timeout 5000
⇒ ICMP Echoリクエストに対する応答時間をミリ秒で指定。5000 = 5秒。
◇ frequency 10
⇒ ICMP Echoリクエストを送信する間隔を秒で指定。10 = 10秒。
◇ ip sla schedule 1 life forever start-time now
⇒ 指定したIP SLA番号に、実行スケジュールの開始時間と有効期限を指定。通常、上記のように設定する。
◇ track 101 ip sla 1 reachability
⇒ 監視するオブジェクトの指定と定義されたIP SLA番号を割り当てる。