ネットワーク備忘録

アラフォーエンジニアのネットワーク系の備忘録。twitter:@deigo25374582

JUNOS_ip monitoring

CiscoでいうところのIP SLAでのオブジェクトトラッキング

まぁ、ダイナミック使えば終わるんだけど、案件によって使えなかったりする際には重宝する機能。

以下で検証

f:id:klock_3rd:20180713222931p:plain

 R1とR4でそれぞれ設定入れてみる。

まずはCisco

track 1 ip sla 1 reachability

ip route 0.0.0.0 0.0.0.0 172.16.4.1 track 1
ip route 0.0.0.0 0.0.0.0 172.16.3.254 100
!
ip sla 1
 icmp-echo 1.1.1.1
 frequency 5
ip sla schedule 1 life forever start-time now
!

 通常時はR3経由で、1.1.1.1への到達性がなければR2経由に切り替え

通常時のshow ip route

 R4#sho ip route static 

S*     0.0.0.0/0 [1/0] via 172.16.4.1

 R1の1.1.1.1を消す

R4#sho ip route static

S*  0.0.0.0/0 [100/0] via 172.16.3.254

 

これと同じ挙動をJUNOSで再現。

set services rpm probe MONITOR test ICMP-Check target address 1.1.1.5
set services rpm probe MONITOR test ICMP-Check probe-count 3
set services rpm probe MONITOR test ICMP-Check probe-interval 3
set services rpm probe MONITOR test ICMP-Check test-interval 3
set services rpm probe MONITOR test ICMP-Check thresholds successive-loss 3
set services rpm probe MONITOR test ICMP-Check thresholds total-loss 3
set services rpm probe MONITOR test ICMP-Check next-hop 172.16.2.254
set services ip-monitoring policy MON-policy match rpm-probe MONITOR
set services ip-monitoring policy MON-policy then preferred-route route 0.0.0.0/0 next-hop 172.16.1.254
set routing-options static route 0.0.0.0/0 next-hop 172.16.2.254

 

通常時はR3をnext-hopにし、1.1.1.5と疎通が取れない場合に、R2経由に切り替え。

 

通常時のshow route

 admin@R1# run show route protocol static

0.0.0.0/0    *[Static/5] 00:50:02
      > to 172.16.2.254 via ge-0/0/1.0

 R4の1.1.1.5をDownさせる

 admin@R1# run show route protocol static

0.0.0.0/0   *[Static/1] 00:00:46, metric2 0
      > to 172.16.1.254 via ge-0/0/0.0
       [Static/5] 00:51:55
      > to 172.16.2.254 via ge-0/0/1.0