Cisco Nexus 9K NX-OS - Automatic Scheduled Configuration Backup

In this article, we take a look at a short snippet of configuration to enable automatic scheduled backup of the running-configuration of Cisco Nexus switches and send the backup file to a remote repository or file server.

Introduction

While the well-known “archive” command does exist in NX-OS and has similar syntax as its IOS/IOS-XE equivalent, I have had problems with that command not working at all in NX-OS and judging from various threads on Cisco’s support forum, many seem to have similar experiences to mine.

However, a similar function can be configured using the native “scheduler” feature, which can automatically execute commands in different time intervals.

The following configuration is mostly useful if you do not have a more “proper” management system for your Nexus switches regularly taking configuration backups.

As a complete Nexus novice, I found it smart to write this configuration down in case I need it in the future.

There are several options in regard to repositories to put your backup of the running configuration file on an external file server. In this example, we are using FTP because it’s very straightforward, but you can also use SFTP, SCP, and others, as well.

Do note that you might not be able to include the Username and Password in the “copy…” command for SFTP and SCP like you can with FTP, so you might need to adjust the configuration job to deal with this (username and password have be entered per file transfer).

Also, for SFTP/SCP, you need to perform a manual backup to the file server once to be presented with the file server’s certificate and accept it.

Configuration

! Enable the Scheduler feature:
feature scheduler

! Set logfile size (default = 16 kilobytes):
scheduler logfile size 1024

! Create Backup Job, adjust VRF as needed:
schedular job name FTP-BACKUP
! Configure copy command, all in one line:
copy running-config ftp://backupuser:backuppass@10.10.10.20/$(SWITCHNAME)_$(TIMESTAMP).txt vrf default
exit

! Configure Schedule for Job to execute daily at 03:00:
scheduler schedule name DAILY
    job name FTP-BACKUP
    time daily 03:00

Verification

Use the “show scheduler logfile” command to show the logfile of executed jobs, including the output of said executed jobs, for example:

——————————— Job Output ————————————
copy running-config ftp://backupuser:backuppass@10.10.10.20/$(SWITCHNAME)_$(TIMESTAMP).txt vrf default
***** Transfer of file Completed Successfully *****
Copy complete, now saving to disk (please wait)…
Copy complete.

Use the “show scheduler config” command to simply display the scheduler config from "show running-config".

Use the “show scheduler schedule” command to display the name of schedules, when they were last run, when the next run is, how many times it has run, and more.