cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
921
Views
0
Helpful
4
Replies
slauzon
Beginner

Auto DHCP renew when tracking change state

I looking to find a way to do a shut and no shut until the tracking change state. For spoke router using a DHCP connection to the Internet. When there is a problem with the connection, the modem will give a private ip adresse and by just doing a shut and then a no shut it fix the issue but I would like to do it automaticaly. I have already tried with a event manager applet but when the tracking change state it will execute only the commands only once but I would like it to do it every 10 minutes until the tracking change state again. Maybe with tcl script but don't realy know where to start.

1 ACCEPTED SOLUTION

Accepted Solutions
Joe Clarke
Hall of Fame Cisco Employee

You can do what you want using three applets (two top-level applets, and one nested applet).

event manager environment quote "

event manager applet track-down

event track 1 state down

action 001 cli command "enable"

action 002 cli command "config t"

action 003 cli command "event manager applet track-timer"

action 004 cli command "event timer watchdog time 180 name track_timer"

action 005 cli command "action 1.0 cli command enable"

action 006 cli command "action 2.0 cli command $quote config t$quote"

action 007 cli command "action 3.0 cli command $quote interface Fa0/0$quote"

action 008 cli command "action 4.0 cli command shut"

action 009 cli command "action 5.0 cli command $quote no shut$quote"

action 010 cli command "action 6.0 cli command end"

event manager applet track-up

event track 1 state up

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager applet track-timer"

action 4.0 cli command "end"

The above config will periodically shut/no shut interface Fa0/0 every three minutes until the tracked object comes back up.

View solution in original post

4 REPLIES 4
Joe Clarke
Hall of Fame Cisco Employee

This may be doable with applets.  What version of IOS do you have?

We use mostly c181x-advipservicesk9-mz.124-15

The only problem I am facing at the moment is that when the tracking state change, it only execute the shut and no shut once but it should do it every X minutes until the tracking state change back. I have tried to change the event with crontab but it doesn't seem to work.

Joe Clarke
Hall of Fame Cisco Employee

You can do what you want using three applets (two top-level applets, and one nested applet).

event manager environment quote "

event manager applet track-down

event track 1 state down

action 001 cli command "enable"

action 002 cli command "config t"

action 003 cli command "event manager applet track-timer"

action 004 cli command "event timer watchdog time 180 name track_timer"

action 005 cli command "action 1.0 cli command enable"

action 006 cli command "action 2.0 cli command $quote config t$quote"

action 007 cli command "action 3.0 cli command $quote interface Fa0/0$quote"

action 008 cli command "action 4.0 cli command shut"

action 009 cli command "action 5.0 cli command $quote no shut$quote"

action 010 cli command "action 6.0 cli command end"

event manager applet track-up

event track 1 state up

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager applet track-timer"

action 4.0 cli command "end"

The above config will periodically shut/no shut interface Fa0/0 every three minutes until the tracked object comes back up.

View solution in original post

This is exacly what I was trying to do but I didn't know I could use environnement variables. Thank you so much, it will solve me alot of headache.