Cisco IOS (SLA / Track / event manager). Restarting Interface on fail.
Recently it appeared that one of the branches I'm responsible for loses link on one of interfaces. I don't know why but when interface is `shutdown-noshutdown`-ed everything becomes OK. So I looked for a way to `restart` interface automatically:#First we'll create SLA (Service Level Agreement)
#sla number is `1`
#it will ping `172.16.0.70` from `172.16.0.77` IP source address
#ping will be issued every 3sec
#threshold must be < timeout
#threshold is RTT (Round Trip Time - time needed to reach the other side and to return) in msec - needed for SLA Statistics and Monitoring
#timeout - if no answer in 1.5sec - consider it as failed attempt
ip sla 1
icmp-echo 172.16.0.70 source-ip 172.16.0.77
threshold 1000
timeout 1500
frequency 3
exit
#Then we'll make it endless and start it right now:
ip sla schedule 1 life forever start-time now
#show commands fro SLA:
sh ip sla configuration 1
sh ip sla statistics 1
#Now we'll configure tracker of the SLA
# track number 10
#uses SLA number 1
#consider down if down for 10sec
#consider up if up for 60sec
track 10 ip sla 1 reachability
delay down 10 up 60
#to view:
sh track brief
sh track 10
#Configure event manager (response on event)
#event manager named restart_interface
#will use track number 10
#restart_interface will be executed if track 10 state is down
event manager applet restart_interface
event track 10 state down
action 0 cli command "enable"
action 1 cli command "conf t"
action 2 cli command "int fa0/1"
action 2.5 cli command "shut"
action 3 cli command "no shut"
action 4 cli command "end"
#to view:
sh even manager policy registered
sh event manager history events
No comments:
Post a Comment