07-20-2012 11:51 AM
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.
Solved! Go to Solution.
07-20-2012 11:54 AM
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.
07-20-2012 11:54 AM
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.
07-20-2012 01:10 PM
Woops, yeah should be g0/0 in the syslog msg also. Thx Joseph!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide