cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Community Live
6954
Views
0
Helpful
5
Replies

IP SLA with EEM !!!

Hello,

Greetings,

I am facing some problem with WAN interface. Our peer WAN down for while and when PEER LINK is UP our WAN interface doesn't auto UPLINK for some reason. I do know that if i apply "shut" and "no shut" command on our WAN interface link is UP /or Reload Router/. Since, i cannot be there all the time i have wrote IP SLA and EEM policy BELOW. i have tested it and it is working. Problem is it is looping for only ONCE.

Generally, i just want to make sure if PING fails,

1. Every 1 minute "shut" and "no shut" command will give on the PING failed interface

2.If still don't have up link reload the router every 1 hour

3.If the network is become alive every thing stops !

ip sla 11
icmp-echo 192.168.1.1 source-interface FastEthernet4
ip sla schedule 11 life forever start-time now

track 1 ip sla 11 reachability
delay down 8 up 10

event manager applet PING_FAILED
event track 1 state down

action 1.0 cli "enable"
action 2.0 cli "conf t"
action 3.0 cli "int fa 4"
action 4.0 cli "shut"
action 5.0 cli "no shut"
action 6.0 cli "end"



5 REPLIES 5
anishlekshman
Beginner

Make 2 applet. FIrst applet is during the link is coming down. so it will shut the port. so the traffic will go through the secondary link. Second applet is during the link back to normal. You can perfrom this after some more time (this time you can mention in delay up time. ).

track 1 ip sla 10 reachability

delay down 10 up 10

!

ip sla 10

icmp-echo 192.168.0.1 source-interface GigabitEthernet 0/1

frequency 30

ip sla schedule 10 life forever start-time now

!

event manager applet Link-Down

event track 1 state down

action 1.0 syslog msg "Reply timed out; Link is down"

action 1.1 cli command "enable"

action 1.2 cli command "conf t"

action 1.3 cli command "interface g0/0"

action 1.4 cli command "shut"

action 1.5 cli command "end"

action 1.6 syslog msg "Interface GigabitEthernet 0/1 shutdown"

!!

event manager applet Link-Up

event track 1 state up

action 1.0 syslog msg "Ping received; Link is up"

action 1.1 cli command "enable"

action 1.2 cli command "conf t"

action 1.3 cli command "interface g0/0"

action 1.4 cli command "no shut"

action 1.5 cli command "end"

action 1.6 syslog msg "Interface GigabitEthernet 0/1 up"

mustafahanci
Beginner

I recommend you to make a snmp WR variable (i.e. a description of an unused interface, 1 for normal situation 0 for faulty) and run the script every 15 or 20 seconds. According to the value of the variable AND ip sla status (1 for normal situation 0 for faulty) you can decide what to do.

for example:

if variable 0 and ip sla 0: reset interface and change variable from 0 to 1

if variable 0 and ip sla 1: ---can't happen--

if variable 1 and ip sla 0: wait for 10 seconds (wait for ip sla to be UP) and if ip sla doesn't became UP change variable from 1 to 0

if variable 1 and ip sla 1: do nothing

Mustafa..

Hello Guys...

I was looking for the same script but with a little change.

I have two routers with a WAN link on each of them.

I want Primary router to be up and working all the time, if that fails then secondary router with secondary WAN link should come back up (using EEM script).

Thanks...


Wassmullah,

I know you said "using EEM" but what about using HSRP or similar router redundancy protocol? it is very efficient and a lot less admin overhead.

example:

R1

interface Ethernet0/0.1

description ** Primary LAN Interface**

encapsulation dot1Q 1

ip address 192.168.1.2 255.255.255.0

standby 0 ip 192.168.1.1 ••ßset as your devices default-gateway

standby 0 priority 255

standby 0 preempt

standby 0 track serial0/0 10 ••ßTrack the WAN interface and decrement the priority so when it fails the standby on R2 becomes active

standby 0 time 2 6

no ip redirects

no ip directed broadcasts

no shut

!

*******************************

R2

!

interface Ethernet0/0.1

description **Secondary LAN Interface**

encapsulation dot1Q 1

ip address 192.168.1.3 255.255.255.0

standby 0 ip 192.168.1.1••ßset as your devices default-gateway

standby 0 priority 254

standby 0 preempt

standby 0 time 2 6

no ip redirects

no ip directed broadcasts

no shut

!

Just me two cents worth

-Jake

veneet.thakur
Beginner

Hello

I believe, HSRP should be very straight forward solution for your requirement rather than using complex EEM Scripts.

Tnx

Sent from Cisco Technical Support Android App