06-22-2011 11:28 AM
I am looking for a script or applet that will dis/enable an ethernet interface on Cat 6500
based on reachablity to an external destination. Reachability should be verified either directly by sending ICMP packets, or based on IPSLA status.
Thank you,
Jarek
Solved! Go to Solution.
06-22-2011 09:13 PM
"This will ping every 5 seconds for reachability."
ip sla 1
type icmp-echo 10.1.1.1
timeout 1000
threshold 1000
frequency 5
ip sla schedule 1 life forever start-time now
"Creates object tracking with IP SLA operation from above."
track 1 rtr 1 reachability
"EEM will shutdown the interface if its unreachable."
event manager applet interface-shut
event track 1 state down
action 0.0 cli command "enable"
action 0.1 cli command "conf t"
action 1.0 cli command "interface fa0"
action 2.0 cli command "shut"
action 3.0 syslog msg "interface-shut EEM shut down interface fa0"
"EEM will bring the interface up when its reachable."
event manager applet interface-noshut
event track 1 state up
action 0.0 cli command "enable"
action 0.1 cli command "conf t"
action 1.0 cli command "interface fa0"
action 2.0 cli command "no shut"
action 3.0 syslog msg "interface EEM brought up interface fa0"
06-22-2011 09:13 PM
"This will ping every 5 seconds for reachability."
ip sla 1
type icmp-echo 10.1.1.1
timeout 1000
threshold 1000
frequency 5
ip sla schedule 1 life forever start-time now
"Creates object tracking with IP SLA operation from above."
track 1 rtr 1 reachability
"EEM will shutdown the interface if its unreachable."
event manager applet interface-shut
event track 1 state down
action 0.0 cli command "enable"
action 0.1 cli command "conf t"
action 1.0 cli command "interface fa0"
action 2.0 cli command "shut"
action 3.0 syslog msg "interface-shut EEM shut down interface fa0"
"EEM will bring the interface up when its reachable."
event manager applet interface-noshut
event track 1 state up
action 0.0 cli command "enable"
action 0.1 cli command "conf t"
action 1.0 cli command "interface fa0"
action 2.0 cli command "no shut"
action 3.0 syslog msg "interface EEM brought up interface fa0"
06-23-2011 08:04 AM
This is exactly what I need. Two questions, after "shut/no shut" command is executed, shouldn't script exit the config mode?
How do I make the script active, i.e. ready to take action based on track event?
Thanks a lot.
06-23-2011 02:13 PM
The exit for the script is not needed. To make the script active, just follow the above steps for creating the EEM application which will trigger based on the IP SLA and object tracking actions.
12-11-2012 03:47 AM
THANX Nael! This is great, man!
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: