Auto DHCP renew when tracking change state

Answered Question

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.

Correct Answer by Joe Clarke about 7 years 4 months ago

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Joe Clarke Mon, 03/22/2010 - 13:33
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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.

Correct Answer
Joe Clarke Mon, 03/22/2010 - 14:17
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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.

Actions

This Discussion

Related Content