« Home | Jimi Hendrix - Voodoo Child Videoyo » | Creating a new OSI to use on Big Biz's New Internet. » | Identity Through Writing » | The Dollar is Intellectual Property of the USA » | The Last Butterfly and Domino Effect, Ever. » | Kegeraters 101 » | Apply Supply and Demand » | Smoking Stats » | Bubbles, Buddies and Business » | Brief Background About Myself » 

Thursday, August 20, 2009 

Shutting Interfaces from Kron using Macros in Cisco IOS

You should be able to use kron and macros to be able to shut interfaces on a scheduled basis in Cisco IOS.

1. Make a macro to shut the interfaces (or perform other nested tasks)
Router(config)# macro name macro_name1
Router(config)# interface Vlan1
Router(config-if)# shutdown
Router(config-if)# no shutdown @

2. Make a kron job to call the Cisco IOS macro.
Router(config)# kron policy-list policy_name1
Router(config-kron-policy)# cli macro_name1
Router(config-kron-policy)# exit

3. Next, create a kron occurrence, in which you tell the router when and how often you want to run this policy list (i.e., group of commands). Here's an example:

Router(config)# kron occurrence policy_name1 at 22:00 Mon recurring
Router(config-kron-occurrence)# policy-list policy_name1
Router(config-kron-occurrence)# exit


References
Using macros with IOS
Schedule Kron with IOS


Labels: , ,

This does not work.
I have a Cisco 851W and the command "cli macro_name1" could not be executed.
Try in enable mode the command "macro_name1"

Does it work?

No, so this tutorial is useless

It can be done by EEM.

Router(config)#event manager applet shutdown-vlan1
Router(config-applet)#event timer cron name shutdown-vlan1-schedule cron-entry "0 22 * * *"
Router(config-applet)#action 01.0 cli command "enable"
Router(config-applet)#action 02.0 cli command "config t"
Router(config-applet)#action 03.0 cli command "interface vlan1"
Router(config-applet)#action 04.0 cli command "shutdown"
Router(config-applet)#action 05.0 cli command "no shutdown"
Router(config-applet)#action 06.0 syslog msg "vlan1 interface has been bounced"
Router(config-applet)#end
Router#
Router#sh even manager policy registered
No. Class Type Event Type Trap Time Registered Name
1 applet user timer cron Off Sat Oct 15 17:22:03 2011 shutdown-vlan1
name {shutdown-vlan1-schedule} cron entry {0 22 * * *}
maxrun 20.000
action 01.0 cli command "enable"
action 02.0 cli command "config t"
action 03.0 cli command "interface vlan1"
action 04.0 cli command "shutdown"
action 05.0 cli command "no shutdown"
action 06.0 syslog msg "vlan1 interface has been bounced"

This post is useless since you can not run macros using Kron..

Post a Comment