• IP static route with health check

 
 
Print Friendly, PDF & Email

Introduction

The purpose is to simplify ip static route with health check does_it_live.py script, it’s easy to enable this feature quickly without complicated programming.

This feature leverages the Reachability Health Checks document ( https://eos.arista.com/reachability-health-checks/ ) and does_it_live.py  ( https://github.com/alexisdacquay/does_it_live ) which was made by Alexis Dacquay.

Due to Reachability Health Checks(does_it_live.py) support rich parameters, there are mode(icmp/dns), interval, timeout, dampening, source. We just take it and use it.

Configuration

The following configuration commands have been added as part of this feature support:

1. Create ping check script on Daemon:

t3 – timeout 3 seconds, i3 – interval 3 seconds, 1.1.1.1 – ping check ip.

configuration:
==============

daemon ping-check-1_1_1_1
   action bash sudo /mnt/flash/does_it_live.py -t3 -i3 1.1.1.1
   no shutdown

Parameter  

Command

Default Value

mode 

  -m (–mode)

  icmp

interval 

 –i (–interval)

  3

timeout 

 -t (–timeout)

  3

dampening 

 -d (–dampening)

  3

source 

 -s (–source)

  none

verbose 

 -v (–verbose)

  none

When ping check unreachable, it generate “Target 1.1.1.1 is dead” syslog. that will be trigger on-logging event-handler to delete ip static route.

When ping check reachable, it generate “Target 1.1.1.1 is back” syslog. that will be trigger on-logging event-handler to add ip static route.

2. Create trigger on-logging to add/delete ip static route:

1) Create event-handler route-add-back with trigger on-logging, when syslog appear “1.1.1.1 is back” that trigger to add static routes for :

– 10.255.1.0/24

– 10.255.2.0/24

– 10.255.3.0/24

– 10.255.4.0/24

– 10.255.5.0/24 

configuration:
==============

event-handler route-add-back
   action bash
      if [ $EVENT_COUNT -gt 0 ] ;then FastCli -p15 -c $'enable\n configure\n
      ip route 10.255.1.0/24 1.1.1.1 \n
      ip route 10.255.2.0/24 1.1.1.1\n
      ip route 10.255.3.0/24 1.1.1.1\n
      ip route 10.255.4.0/24 1.1.1.1\n
      ip route 10.255.5.0/24 1.1.1.1\n
      end\n'
      fi
      EOF
   delay 0
   asynchronous
   !
   trigger on-logging
      regex 1.1.1.1 is back

2) Create event-handler route-del-dead with trigger on-logging, when syslog appear “1.1.1.1 is dead” that trigger to delete static route previously installed.

configuration:
==============

event-handler route-del-dead
   action bash
      if [ $EVENT_COUNT -gt 0 ] ;then FastCli -p15 -c $'enable\n configure\n
      no ip route 10.255.1.0/24 1.1.1.1\n
      no ip route 10.255.2.0/24 1.1.1.1\n
      no ip route 10.255.3.0/24 1.1.1.1\n
      no ip route 10.255.4.0/24 1.1.1.1\n
      no ip route 10.255.5.0/24 1.1.1.1\n
      end\n'
      fi
      EOF
   delay 0
   asynchronous
   !
   trigger on-logging
      regex 1.1.1.1 is dead

Log on Arista switch: 

Nov  8 15:32:23 DUT2 does_it_live: %DOES_IT_LIVE-5-LOG: Log msg: Target 1.1.1.1 is dead - icmp check
Nov  8 15:32:23 DUT2 EventMgr: %SYS-6-EVENT_TRIGGERED: Event handler route-del-dead was activated
Nov  8 15:32:23 DUT2 ConfigAgent: %SYS-5-CONFIG_E: Enter configuration mode from console by root on UnknownTty (UnknownIpAddr)
Nov  8 15:32:23 DUT2 ConfigAgent: %SYS-5-CONFIG_I: Configured from console by root on UnknownTty (UnknownIpAddr)

Nov  8 15:32:53 DUT2 does_it_live: %DOES_IT_LIVE-5-LOG: Log msg: Target 1.1.1.1 is back to life – icmp check
Nov  8 15:32:53 DUT2 EventMgr: %SYS-6-EVENT_TRIGGERED: Event handler route-add-back was activated
Nov  8 15:32:53 DUT2 ConfigAgent: %SYS-5-CONFIG_E: Enter configuration mode from console by root on UnknownTty (UnknownIpAddr)
Nov  8 15:32:53 DUT2 ConfigAgent: %SYS-5-CONFIG_I: Configured from console by root on UnknownTty (UnknownIpAddr)

Note

– does_it_live.py download here ( https://github.com/alexisdacquay/does_it_live)

– If you don’t need dns check capability, just edit does_it_live.py and comment out import dns.resovler.

# import dns.resovler

References

  1. Reachability health checks (https://eos.arista.com/reachability-health-checks/)

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: