3g failover EEM scripting

cpartincpartin Posts: 84Member ■■□□□□□□□□
So I've been working on a project to implement 3g failover in case of a downed T1. I have code that works but the solution just seems horribly overcomplicated. I'm honestly a little embarrassed to post this as it just looks ugly, but it does appear to be working as intended. Am I on the right track here or is there an easier and/or more reliable way to do this? Comments and explanation are in the code.
ip route <Backup DMVPN hub> 255.255.255.255 Cellular0/0/0
ip route <Primary DMVPN hub> 255.255.255.255 <T1 gateway>


ip sla 1  // Ping primary DMVPN hub out T1 interface every 2 seconds, timeout ping after 1 sec
 icmp-echo <Primary DMVPN hub> source-interface GigabitEthernet0/0
 threshold 1000
 timeout 1000
 frequency 2
ip sla schedule 1 life forever start-time now


track 1 ip sla 1 reachability   // Wait for 4 consecutive failed or successful pings to mitigate unnecessary flapping
 delay down 9 up 9
track 2 interface Cellular0/0/0 line-protocol
track 3 interface Cellular0/0/0 ip routing
track 4 list boolean and    //  If I can't ping primary hub, cell does not have an IP address, and cell is ready to dial.
 object 1 not               //  Had to add this track since failover would not work from cold boot if T1 was down, because 
 object 2                   //  tracking relies on a state change.
 object 3 not
 delay down 5 up 5


event manager applet SHUTS_TUNNEL1    // Closes tunnel to backup DMVPN and reset cell to kill call
 event track 1 state up
 action 10 cli command "enable"
 action 20 cli command "config t"
 action 30 cli command "interface Tunnel1"
 action 40 cli command "shut"
 action 5  syslog msg "SHUTS_TUNNEL1"
 action 50 cli command "clear interface Cellular0/0/0"
 action 70 cli command "end"

event manager applet NO_SHUTS_TUNNEL1   // Opens tunnel to backup DMVPN hub and creates interesting traffic to kick off dial
 event track 1 state down
 action 10 cli command "enable"
 action 20 cli command "config t"
 action 30 cli command "interface Tunnel1"
 action 40 cli command "no shut"
 action 5  syslog msg "NO_SHUTS_TUNNEL1"
 action 50 cli command "clear interface Cellular0/0/0"
 action 70 cli command "end"
 action 80 cli command "ping <DMVPN backup hub> repeat 20"

event manager applet INIT_CELL    //  Duplicate of above code because applets apparently can't follow more than 1 track (AFAIK)
 event track 4 state up
 action 10 cli command "enable"
 action 20 cli command "config t"
 action 30 cli command "interface Tunnel1"
 action 40 cli command "no shut"
 action 5  syslog msg "INIT_CELL"
 action 50 cli command "clear interface Cellular0/0/0"
 action 70 cli command "end"
 action 80 cli command "ping <DMVPN backup hub> repeat 20"

Comments

  • Danielh22185Danielh22185 Posts: 1,195Member
    You might benefit from posting this in the IE forum as EEM scripting is a bit beyond the NP level. However I do see this type of implementation a lot at work. I normally don't have to troubleshoot the script itself but I'll review the configurations and give ya some feed back when I get a chance to.
    Currently Studying: IE Stuff...kinda...for now...
    My ultimate career goal: To climb to the top of the computer network industry food chain.
    "Winning means you're willing to go longer, work harder, and give more than anyone else." - Vince Lombardi
  • JoshyJJoshyJ Posts: 32Member ■■□□□□□□□□
    This is way more complicated then the 3g failover solutions I have setup. But then again I am not using a DMVPN.
Sign In or Register to comment.