cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7062
Views
5
Helpful
2
Replies

Interface shut/no shut using ip sla with EEM applet

KUNAL HANS
Level 1
Level 1

Hi,

I have to come up with a script to 'shut' a particular interface on a router (3945E running IOS 15.0) when a link goes down and also to 'no shut' it after the link comes back up. This is what I have so far.

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"

I have to go to a remote site and get this working within a short maintenance window but unfortunately I have no way of testing it out and I dont want to go in blind. So, if someone could verify that the script will work with my IOS version, that'll be great.

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

This will work, but your syslog message seems to indicate that the wrong interface is being shutdown.  You may also need "event manager session cli username USER" if your router uses AAA command authorization.

View solution in original post

2 Replies 2

Joe Clarke
Cisco Employee
Cisco Employee

This will work, but your syslog message seems to indicate that the wrong interface is being shutdown.  You may also need "event manager session cli username USER" if your router uses AAA command authorization.

Woops, yeah should be g0/0 in the syslog msg also. Thx Joseph!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: