Date created: Tuesday, February 24, 2015 6:35:45 PM. Last modified: Thursday, July 12, 2018 11:49:32 AM

EEM to repeatedly watch tracker state

In this example 3 CPEs have L2TPv3 tunnels between them forming a layer 2 trianlge and thus a layer 2 loop.

On one CPE the below config is applied to only activate the L2TPv3 xconnect's on this CPE if it can't reach any of ther others ensuring there is no loop. If the other CPEs are reachable the SVI (where the xconnects termiante) are shutdown to prevent a loop.

ip sla 41
 icmp-echo 10.20.41.3 source-interface GigabitEthernet0/0.3200
 frequency 5
 exit
ip sla schedule 41 life forever start-time now

ip sla 210
 icmp-echo 10.20.210.9 source-interface GigabitEthernet0/0.3200
 frequency 5
 exit
ip sla schedule 210 life forever start-time now

ip sla 232
 icmp-echo 10.20.232.2 source-interface GigabitEthernet0/0.3200
 frequency 5
 exit
ip sla schedule 232 life forever start-time now

ip sla 233
 icmp-echo 10.20.233.2 source-interface GigabitEthernet0/0.3200
 frequency 5
 exit
ip sla schedule 233 life forever start-time now

track 41 ip sla 41 reachability
 delay down 1 up 1
 exit

track 210 ip sla 210 reachability
 delay down 1 up 1
 exit

track 232 ip sla 232 reachability
 delay down 1 up 1
 exit

track 233 ip sla 233 reachability
 delay down 1 up 1
 exit

event manager applet watch-trackers
 event timer watchdog time 30

  action 101 track read 232
  action 102 if $_track_state eq "down" goto 601

  action 201 track read 233
  action 202 if $_track_state eq "down" goto 601

  action 301 track read 41
  action 302 if $_track_state eq "down" goto 601

  action 401 track read 210
  action 402 if $_track_state eq "down" goto 601

  action 501 syslog priority error msg "disabling SVIs (xconnects), all trackers up"
  action 502 cli command "en"
  action 503 cli command "conf t"
  action 504 cli command "interface vlan 260"
  action 505 cli command "shut"
  action 506 cli command "interface vlan 270"
  action 507 cli command "shut"
  action 508 cli command "end"
  action 509 exit

  action 601 syslog priority error msg "enabling SVIs (xconnects), one tracker is down"
  action 602 cli command "en"
  action 603 cli command "conf t"
  action 604 cli command "interface vlan 260"
  action 605 cli command "no shut"
  action 606 cli command "interface vlan 270"
  action 607 cli command "no shut"
  action 608 cli command "end"
  action 609 exit

  exit

To play nice with AAA: event manager session cli username USER