×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

Interface shut/no shut using ip sla with EEM applet

Answered Question
Jul 20th, 2012
User Badges:

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.

Correct Answer by Joe Clarke about 5 years 4 weeks ago

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Joe Clarke Fri, 07/20/2012 - 11:54
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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.

KUNAL HANS Fri, 07/20/2012 - 13:10
User Badges:

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

Actions

This Discussion