cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3116
Views
5
Helpful
4
Replies

TCL script or applet to disable port based on reachability

jsluzewski
Level 1
Level 1

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

1 Accepted Solution

Accepted Solutions

Nael Mohammad
Level 5
Level 5

"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"

View solution in original post

4 Replies 4

Nael Mohammad
Level 5
Level 5

"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"

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.

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.

THANX Nael! This is great, man!

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: