cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1999
Views
0
Helpful
6
Replies

EEM script to poll next hop interface

mmoraba
Cisco Employee
Cisco Employee

Hi All

I am new to EEM scripting and would like some help. Please refer to the attached diagram and the scenario below :

 

CPE has 2 up links as shown on the diagram connecting to the ME3400 (layer 2 path) devices on each link and then the 3400s connects to the PE devices as depicted on the diagram.

So i want to do is the following:

I need a script on the CPE that will ping the PE(R2)'s interface gigabitEthernet0/1 frequently and when the ping fails, i want the CPE to send traffic to the other link via PE(R3). This needs to be done in such a way that when the ping is successful on the 1st path, traffic needs to go back to that path via PE(R2).

Is this even possible, if it is, can someone please help me with this. Thanks!

6 Replies 6

mmoraba
Cisco Employee
Cisco Employee

Hi All

After sometime on the CLI, i came up with the following:

 

track 1 ip sla 10 reachability

delay down 0 up 0

!

ip sla 10

icmp-echo 10.0.12.2 source-interface GigabitEthernet 0/1

frequency 5

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 "no ip route 0.0.0.0 0.0.0.0 10.0.12.2"

action 1.4 cli command "ip route 0.0.0.0 0.0.0.0 10.0.13.3"

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 "no ip route 0.0.0.0 0.0.0.0 10.0.13.3"

action 1.3 cli command "ip route 0.0.0.0 0.0.0.0 10.0.12.2"

action 1.5 cli command "end"

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

 

and it seems to be serving the purpose, is this a better solution to the scenario above or is there a better way? i also notice that i lost about 6 packets during the failover (6 seconds) which is not bad but if there is a way of decreasing this i would also appreciate the help. Thanks!

You could reduce the frequency to shrink the potential downtime window.  You could also add "auth bypass" to the event manager applet line to avoid AAA interactions, which could add some performance.

Thanks Joe. Is there any possible way of achieving the same results without using EEM?

You could associate one route directly to the tracked object using the track keyword at the end of the ip route command.  The other can have a higher admin distance.

Thanks once again Joe. one last thing, what is the impact of this script on the CPU of the device?

The EEM applets here?  Very little if any.  It would be slightly less than you SSHing to the device and typing those commands manually.  No recurring CPU toll is taken.