Most people are good about making backup copies of their configuration before changes, but everyone makes mistakes eventually. To me the risk is not worth it, so this will be dedicated to automating Cisco TFTP backups of configurations. Most server administrators have automated tasks using either Cron (Linux/Unix) or Windows Scheduler. Cisco IOS also has the ability to schedule tasks.
I am very picky when it comes to my Cisco devices. A lot of information I read on this had the schedule execute “copy running-config startup” and would only backup one configuration. This is not a good thing, especially when there are multiple device managers. Below will go through setting up two jobs that backup both the running and saved configurations to different files daily.
Note: This assumes that you already have a TFTP server running on the network.
After logging into the switch, move into configuration mode
FiberSw01# config terminal Enter configuration commands, one per line. End with CNTL/Z.
Enable the scheduler
FiberSw01(config)# scheduler enable
Crate a job named “backup_running”
FiberSw01(config)# scheduler job name backup_running
Enter the syntax used to copy the running configuration to your TFTP server
FiberSw01(config-job)# copy running-config tftp://172.0.0.22:69/config/FiberSw01_running
Exit configuration mode
FiberSw01(config-job)# end
Now that we have a job defined, make sure it is listed with the scheduler
FiberSw01# show scheduler job Job Name: backup_running ------------------------ copy running-config tftp://172.0.0.22:69/config/FiberSw01_running ==============================================================================
With the job defined, we can go back in and set when we want it executed
FiberSw01# config terminal Enter configuration commands, one per line. End with CNTL/Z.
Define a new schedule name and set execution time(s)
FiberSw01(config)# scheduler schedule name Backup_Running FiberSw01(config-schedule)# time daily 23:00 FiberSw01(config-schedule)# job name backup_running FiberSw01(config-schedule)# end
Now the schedule(s) can be listed with names, execution times, and status
FiberSw01# show scheduler schedule
Schedule Name : Backup_Running
------------------------------------
User Name : user
Schedule Type : Run every day at 23 Hrs 0 Mins
Last Execution Time : Yet to be executed
-----------------------------------------------
Job Name Last Execution Status
-----------------------------------------------
backup_running -NA-
==============================================================================
Since the running configuration was backed up previously, we can go in configure the startup configuration backup. All commands are close to above except the tftp file name
FiberSw01# config terminal Enter configuration commands, one per line. End with CNTL/Z. FiberSw01(config)# scheduler job name backup_startup FiberSw01(config-job)# copy startup-config tftp://172.0.0.22:69/config/FiberSw01_startup FiberSw01(config-job)# end FiberSw01# config t Enter configuration commands, one per line. End with CNTL/Z. FiberSw01(config)# scheduler schedule name Backup_Startup FiberSw01(config-schedule)# time daily 23:05 FiberSw01(config-schedule)# job name backup_startup FiberSw01(config-schedule)# end
Check the schedule once more and both jobs show up
FiberSw01# show scheduler schedule
Schedule Name : Backup_Running
------------------------------------
User Name : user
Schedule Type : Run every day at 23 Hrs 0 Mins
Last Execution Time : Yet to be executed
-----------------------------------------------
Job Name Last Execution Status
-----------------------------------------------
backup_running -NA-
==============================================================================
Schedule Name : Backup_Startup
------------------------------------
User Name : user
Schedule Type : Run every day at 23 Hrs 5 Mins
Last Execution Time : Yet to be executed
-----------------------------------------------
Job Name Last Execution Status
-----------------------------------------------
backup_startup -NA-
==============================================================================
Now that the configuration is done, save the current (running) configuration so the schedules will not be lost on reboot
FiberSw01# copy running-config startup-config
[########################################] 100%
Notes: The above was done on Cisco MDS Switches but should work on most other Ciso IOS versions. Also, the Execution Status will change after the job is executed.
