I’ve recently been setting up a new customer network and they had some fairly strange requirements, where most of our customers are fairly adverse to any kind of downtime this customer required a weekly reboot of their equipment out of hours, even on the Core networking equipment.
For the Cisco routers this was fairly easy to setup, first you need to create a kron (basically like a Linux Cron) job, this just defines what you want to do, the when is configured later on.
So we’re going to create a policy called ‘reloadrouter’ and it’s going to run the ‘cli’ based command ‘reload’, nice and simple:
kron policy-list reloadrouter cli reload !
Now that we have a policy we need to set this to run, basically we define an occurrence for the policy, then a time and how often we want this to reoccur in the future.
kron occurrence reloadrouter at 4:00 recurring policy-list reloadrouter !
You can do a load of other cool things with kron for example here are some other policies.
Auto Save Config
Forgetting to save the configuration, save an embarrassing reload!
kron policy-list daily-save-config cli write ! kron occurrence daily-save-config at 4:00 recurring policy-list daily-save-config !
People keep leaving debug running on the routers, auto turn it off!
kron policy-list daily-un-debug cli undeb all ! kron occurrence daily-un-debug at 1:00 recurring policy-list daily-un-debug !
Want to do a quick backup of the startup configuration to a TFTP server?
kron policy-list config-backup cli show startup-config | redirect tftp://10.1.1.1/bkup.cfg ! kron occurrence config-backup at 1:00 recurring policy-list config-backup !
One thing; please don’t forget the command is only as good as your time keeping, so NTP is always wise with this kind of automation 🙂
Leave a Reply