Quick Reusable Config Patches

From Baranoski.ca
Jump to: navigation, search

Let's say you have one config element that you frequently change to a particular value, then change back shortly after. For example, I have a time of day rule that I use to limit bandwidth during the day and open up the bandwidth at night.

time-range ISP-UNLIMITED
 periodic daily 2:00 to 8:00
 periodic Monday 8:00 to 12:00

Frequently, I need to open up the limiter during the day for brief periods. To make this easier, I created the text file "open_time_acl.cfg" on my server with the following content:

time-range ISP-UNLIMITED
periodic daily 00:01 to 23:59

I then copied the file to my router's flash.

Then I created an alias:

alias exec opentime copy flash:open_time_acl.cfg running-config

The router will merge the file into the running config whenever I execute the command 'opentime

Then I just use the rollback command I created here to quickly revert to the original configuration.