Network infrastructure forms the backbone of modern enterprise operations, and switches are central to that stability. A sudden hardware failure, an erroneous command entered during maintenance, or a corrupted firmware update can take an entire segment of an organization offline in seconds. Having current, verified backups of your Cisco switch configurations is the primary safeguard against catastrophic downtime, enabling rapid disaster recovery and consistent compliance auditing.
Backing up a Cisco Catalyst or Nexus switch involves multiple methods suited to different operational needs—from standard network transfers and offline physical media to automated internal archiving, Python-driven orchestration, and enterprise-grade configuration platforms.
Table of Contents
Running-Config vs. Startup-Config: Backup Best Practices and Retention (FAQ)
What is the fundamental difference between running-config and startup-config?
The running-config resides entirely in volatile Random Access Memory (RAM). It reflects the switch’s immediate, active state, including any uncommitted interface modifications, VLAN changes, or routing updates. Because it exists in RAM, any power loss or reboot erases unsaved changes.
In contrast, the startup-config resides in non-volatile RAM (NVRAM). This file stores the configuration loaded by the switch during the boot sequence. Unless an administrator explicitly copies the running configuration to NVRAM using copy running-config startup-config (or the legacy shortcut write memory), any changes made in the active session remain absent from the startup file.
Which configuration file should you back up?
In virtually all production scenarios, back up the running-config, provided the device is currently operating as expected. Backing up the running configuration captures the real-world operational state of the switch.
However, before performing any scheduled backup, verify whether uncommitted or experimental changes exist by issuing show running-config and comparing it with show startup-config. If the running state is validated and stable, synchronize the two before backing up:
Switch# copy running-config startup-config
Backing up the startup-config is primarily reserved for baselining switches prior to maintenance windows or auditing what the switch will load after an unscheduled power event.
How frequently should switch configurations be backed up?
Backup cadences should align with operational change frequencies:
* Change-driven (On Commit): Trigger an immediate backup prior to and directly after any configuration change or firmware upgrade.
* Daily automated snapshots: Recommended for active production environments where dynamic protocols, automated scripts, or multiple administrators might introduce subtle state changes.
* Weekly or monthly archives: Acceptable for static access-layer switches with frozen change windows.
What is the recommended backup retention policy?
Enterprise retention standards typically enforce a Grandfather-Father-Son (GFS) strategy:
* Retain daily backups for 30 days.
* Retain monthly milestone backups for 12 months.
* Retain quarterly or annual baseline configurations for 3 to 7 years to satisfy regulatory standards (such as PCI-DSS, HIPAA, or ISO 27001).
* Store files using consistent naming conventions that embed the hostname, management IP address, and ISO timestamp (e.g., SW-CORE-01_192.168.10.2_2026-11-16.cfg).
Cisco IOS Command Reference: The copy Command
Before executing backup procedures across network boundaries, it is essential to understand the underlying mechanics of Cisco’s primary file transfer utility. The Cisco IOS copy command serves as the foundational mechanism for transferring files between internal memory filesystems and external network or physical storage destinations.
Command Syntax
copy [source-filesystem:source-filename] [destination-filesystem:destination-filename]
When entered in privileged EXEC mode (Switch#), the command initiates an interactive dialog confirming source, destination, target IP addresses, and filenames unless fully qualified parameters are supplied on the command line.
Parameter Definitions
| Parameter | Syntax Token | Description |
|---|---|---|
| Active Memory Source | system:running-config (or running-config) | Specifies the dynamic operational configuration currently loaded in RAM. |
| NVRAM Source | nvram:startup-config (or startup-config) | Specifies the persistent configuration stored in non-volatile storage. |
| TFTP Location | tftp:[[//location]/directory]/filename | Directs the stream to or from a Trivial File Transfer Protocol server. Uses UDP port 69. |
| SCP Location | scp:[[//username@location]/directory]/filename | Securely transmits files using Secure Copy Protocol via an established SSH tunnel (TCP port 22). |
| FTP Location | ftp:[[//username:password@location]/directory]/filename | Transfers files over File Transfer Protocol. Uses TCP control port 21 and data port 20. |
| Local Storage | flash:[filename] or usbflash0:[filename] | Refers to internal non-volatile flash memory or an external USB storage partition. |
Operational Behavior and Output Flags
When running copy, IOS checks network connectivity, resolves destination hosts if DNS is enabled, and begins transferring the file in data blocks. A series of exclamation points (!) indicates an ongoing, healthy data transfer, while periods (.) indicate network timeouts or packet retransmissions.
Common Error Messages and Root Causes
% Error opening tftp://<IP>/<file> (Timed out)
Root Cause: UDP port 69 is blocked by an intermediary firewall or access control list (ACL), the TFTP daemon is stopped on the host, or no routing path exists from the management VRF to the destination server.% Error opening scp:... (Host key verification failed or authentication failed)
Root Cause: The target SCP server does not trust the switch’s SSH key, the provided credentials are invalid, or AAA configuration on the switch restricts outbound shell initiation.% Error opening nvram:startup-config (Device or resource busy)
Root Cause: Another administrative process or background process (such as a concurrent configuration commit) is holding an exclusive lock on NVRAM.
Step-by-Step Network Backups: Transferring Configs via TFTP, SCP, and FTP
With the command syntax established, configurations can be transferred across the management network to an external server using standard network file protocols.
+------------------+ TFTP (UDP 69) +-------------------+
| |------------------------------->| TFTP Server |
| | SCP (TCP 22) +-------------------+
| Cisco Switch |------------------------------->| SCP Server |
| (running-config) | FTP (TCP 20/21) +-------------------+
| |------------------------------->| FTP Server |
+------------------+ +-------------------+
Step 1: Verify Network Reachability and Management VRF
Ensure the switch has clear Layer 3 connectivity to your destination server. If management traffic is isolated within a dedicated Virtual Routing and Forwarding (VRF) instance (such as Mgmt-vrf), verify reachability using that VRF:
Switch# ping vrf Mgmt-vrf 192.168.1.50
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.50, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/3 ms
Step 2: Backup to a TFTP Server
TFTP is lightweight and does not require pre-shared authentication, making it popular in lab environments and isolated out-of-band management segments.
- Execute the copy command pointing to TFTP:
text
Switch# copy running-config tftp: - Respond to the interactive prompts for remote host address and destination filename:
text
Address or name of remote host []? 192.168.1.50
Destination filename [switch-confg]? SW-CORE01-running.cfg
!!
10480 bytes copied in 0.214 secs (48971 bytes/sec)
Alternative non-interactive syntax:
Switch# copy running-config tftp://192.168.1.50/SW-CORE01-running.cfg
Step 3: Secure Transfer Using SCP
For enterprise environments transmitting across routed boundaries, SCP encrypts both the data payload and credentials over SSH.
- Verify that the switch has SSH enabled and an RSA/ECDSA key pair generated:
text
Switch# show ip ssh
SSH Enabled - version 2.0
Authentication timeout: 120 secs; Authentication retries: 3 - Execute the transfer specifying the remote username and server IP:
text
Switch# copy running-config scp://backupuser@192.168.1.50/SW-CORE01-running.cfg - Enter the SSH password when prompted:
text
Address or name of remote host [192.168.1.50]?
Destination filename [SW-CORE01-running.cfg]?
Password:
!
Sink: C0644 10480 SW-CORE01-running.cfg
10480 bytes copied in 0.812 secs (12906 bytes/sec)
Step 4: Transfer Over FTP
FTP allows username and password parameters to be configured permanently in the switch configuration or specified in-line during execution.
- (Optional) Pre-configure the global FTP credentials to prevent manual entry:
text
Switch(config)# ip ftp username ciscobackup
Switch(config)# ip ftp password SuperSecretFTPPassword!
Switch(config)# exit - Execute the backup command:
text
Switch# copy running-config ftp://192.168.1.50/backups/SW-CORE01-running.cfg
Writing backups/SW-CORE01-running.cfg !
10480 bytes copied in 0.420 secs (24952 bytes/sec)
Step 5: Verify the Transferred File
Always inspect the destination server to confirm that the file size matches the switch’s reported byte count and that the file is not truncated. On the server side, ensure the header ends cleanly with the standard Cisco end statement.
Offline and Air-Gapped Backups: Copying Configurations to a USB Flash Drive
When network connectivity is unavailable—such as during disaster recovery scenarios, initial staging, or within physically isolated air-gapped facilities—a direct hardware transfer provides an immediate alternative.
Modern Cisco Catalyst series (such as the 2960X, 3650, 3850, 9200, and 9300 series) feature external Type-A USB ports on the front or rear panels.
Step 1: Format and Insert a Compatible USB Drive
Cisco switches running standard IOS and IOS-XE require USB flash drives formatted with either FAT16 or FAT32 file systems. Drives formatted as exFAT, NTFS, or ext4 will fail to mount. Use a lower-capacity drive (under 32GB) for maximum compatibility with older bootloaders.
Insert the USB drive into the switch’s USB port. The console will display a system message confirming drive attachment:
%USBFLASH-5-CHANGE: usbflash0 has been inserted!
Step 2: Identify the USB Filesystem
Query the switch’s available file systems to determine whether the port is labeled usbflash0:, usbflash1:, or usb0::
Switch# show file systems
File Systems:
Size(b) Free(b) Type Flags Prefixes
- - opaque ro system:
1627348992 1204854784 disk rw flash:
15625326592 15601248256 disk rw usbflash0:
* 3907580 3901452 nvram rw nvram:
Inspect the drive’s contents to verify read operations:
Switch# dir usbflash0:
Directory of usbflash0:/
1 -rw- 512 Nov 10 2026 14:10:22 +00:00 baseline.cfg
15601248256 bytes total (15601248256 bytes free)
Step 3: Copy Configuration to the USB Storage
Execute the copy command directly targeting the USB device prefix:
Switch# copy running-config usbflash0:SW-CORE01-20261116-recovery.cfg
Destination filename [SW-CORE01-20261116-recovery.cfg]?
10480 bytes copied in 0.155 secs (67612 bytes/sec)
Step 4: Verify and Safely Remove
Verify that the file was written to disk and that its size matches the running configuration:
Switch# dir usbflash0:SW-CORE01-20261116-recovery.cfg
Directory of usbflash0:/SW-CORE01-20261116-recovery.cfg
2 -rw- 10480 Nov 16 2026 03:00:12 +00:00 SW-CORE01-20261116-recovery.cfg
Once confirmed, remove the drive. The switch will emit a corresponding syslog notification:
%USBFLASH-5-CHANGE: usbflash0 has been removed!
Configuring Automated Backups Using the Cisco IOS Archive Feature
While manual network and USB backups work well for ad-hoc tasks, relying solely on human intervention introduces operational risk. Cisco IOS provides native automation capabilities through the archive subsystem, allowing the switch to snapshot and export its configuration without external tooling.
The archive feature can generate automated backups based on two triggers:
1. Event-driven: Automatically backing up every time an administrator runs write memory or copy running-config startup-config.
2. Time-driven: Automatically saving at recurring time intervals.
+-----------------------+
| Cisco IOS Switch |
+-----------------------+
|
+------------------+------------------+
| |
[write-memory event] [time-period elapsed]
| |
+------------------+------------------+
|
v
[Archive Engine Generates Snapshot]
|
v
[Append Hostname & Timestamp ($h-$t)]
|
v
+---------------------------------------------+
| Transmit to TFTP/FTP/SCP/Flash Destination |
+---------------------------------------------+
Step 1: Enter Archive Configuration Mode
Access privileged configuration mode and open the archive sub-configuration context:
Switch# configure terminal
Switch(config)# archive
Step 2: Configure the Destination Path and System Variables
Define the destination URI. The string $h automatically expands to the switch’s configured hostname, and $t expands to an ISO-standard timestamp:
Switch(config-archive)# path tftp://192.168.1.50/cisco-archives/$h-$t
Note: If saving locally instead of over the network, use path flash:archive-$h-$t.
Set the maximum number of backup copies the switch should keep track of in its internal log (value range: 1 to 14):
Switch(config-archive)# maximum 14
Step 3: Configure Save-Triggered Backups (write-memory)
To generate a backup every time an administrator commits the configuration to NVRAM:
Switch(config-archive)# write-memory
Step 4: Configure Recurring Scheduled Backups
To schedule backups independently of manual saves, define a time-period in minutes. For example, to run an automated backup every 24 hours (1,440 minutes):
Switch(config-archive)# time-period 1440
Switch(config-archive)# end
Step 5: Test and Verify the Archive Configuration
Force a manual commit to verify that the automated workflow initiates:
Switch# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
Writing cisco-archives/SW-CORE01-Nov-16-03:15:00.123-0...
!
[OK]
Inspect the archive history and review the list of generated files:
Switch# show archive
The maximum archive configurations allowed is 14.
The next archive file will be named tftp://192.168.1.50/cisco-archives/SW-CORE01-<timestamp>-1
Archive # Name
1 tftp://192.168.1.50/cisco-archives/SW-CORE01-Nov-16-03:15:00.123-0 <- Most Recent
2
3
Automating Multi-Switch Backups: Python Netmiko Script Template
When managing dozens or hundreds of devices across multiple sites, configuring local archives on each switch can become cumbersome. Programmatic automation via Python allows centralized, agentless backups across your entire infrastructure.
The following production-ready Python template uses the netmiko library to connect to multiple Cisco IOS switches concurrently, retrieve their running configurations, and save them to local, timestamped files.
#!/usr/bin/env python3
"""
Automated Multi-Device Cisco Configuration Backup Tool
Requirements: pip install netmiko
"""
import os
from datetime import datetime
from netmiko import ConnectHandler
from netmiko.exceptions import (
NetmikoTimeoutException,
NetmikoAuthenticationException,
)
# ---------------------------------------------------------
# Inventory Configuration (Fill in device details)
# ---------------------------------------------------------
SWITCH_INVENTORY = [
{
"device_type": "cisco_ios",
"host": "192.168.10.11",
"username": "admin_svc",
"password": "SecretPassword123!",
"secret": "EnablePassword123!", # Optional: for privileged EXEC
},
{
"device_type": "cisco_ios",
"host": "192.168.10.12",
"username": "admin_svc",
"password": "SecretPassword123!",
"secret": "EnablePassword123!",
},
]
BACKUP_DIRECTORY = "./cisco_backups"
def execute_backup(device_params: dict, destination_dir: str):
"""Connects to a single switch, extracts running-config, and writes to disk."""
ip_addr = device_params["host"]
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
os.makedirs(destination_dir, exist_ok=True)
print(f"[*] Initiating backup for {ip_addr}...")
try:
with ConnectHandler(**device_params) as net_connect:
# Enter enable mode if secret is provided
if "secret" in device_params:
net_connect.enable()
# Retrieve clean hostname
raw_prompt = net_connect.find_prompt()
hostname = raw_prompt.replace("#", "").replace(">", "").strip()
# Send command without terminal pager interference
config_data = net_connect.send_command("show running-config")
# Write out file
filename = f"{hostname}_{ip_addr}_{timestamp}.cfg"
filepath = os.path.join(destination_dir, filename)
with open(filepath, "w", encoding="utf-8") as file:
file.write(config_data)
print(f"[+] Successfully backed up: {filepath}")
except NetmikoTimeoutException:
print(f"[!] ERROR: Connection timed out to {ip_addr}. Check routing/firewalls.")
except NetmikoAuthenticationException:
print(f"[!] ERROR: Authentication failed for {ip_addr}. Check credentials.")
except Exception as exc:
print(f"[!] ERROR: Unexpected failure for {ip_addr}: {str(exc)}")
def main():
start_time = datetime.now()
print(f"=== Starting Cisco Backup Task at {start_time} ===")
for switch in SWITCH_INVENTORY:
execute_backup(switch, BACKUP_DIRECTORY)
elapsed = datetime.now() - start_time
print(f"=== Completed in {elapsed.total_seconds():.2f} seconds ===")
if __name__ == "__main__":
main()
Enterprise Configuration Management Software Comparison
While custom Python scripts provide immense flexibility, enterprise environments with strict regulatory compliance, granular role-based access control (RBAC), and automated configuration drift alerting often benefit from dedicated network configuration management (NCM) platforms.
The following comparison table details the top commercial and open-source solutions for centralizing Cisco switch configuration backups:
| Solution | Platform Type | Discovery & Protocol Architecture | Version Tracking & Diff Engine | Built-in Compliance Auditing | Best Suited For |
|---|---|---|---|---|---|
| SolarWinds NCM | Commercial (On-premise / Windows) | SNMP, CLI (SSH/Telnet), API | Visual side-by-side color-coded diffs, rollbacks | Comprehensive (DISA STIG, NIST, HIPAA, PCI-DSS) | Large enterprises requiring turnkey compliance reporting and deep Windows integration. |
| ManageEngine NCM | Commercial (On-premise / Linux & Win) | SNMP, SSH, SCP, TFTP | Line-by-line comparison with author tracking | Robust (Cisco IOS baseline checks, SOX, PCI) | Mid-market enterprises seeking multi-vendor hardware support with balanced licensing costs. |
| Oxidized | Open-Source (Ruby / Linux container) | SSH, Telnet, HTTP, REST API | Native Git integration (commits diffs to GitHub/GitLab) | None (Requires external parsing or CI/CD pipelines) | Modern DevOps and NetDevOps environments standardizing on Infrastructure-as-Code (IaC). |
| RANCID | Open-Source (Perl/Expect / Linux) | Telnet, SSH, RSH, Expect scripts | External VCS (CVS, Subversion, Git) | None (Pure text capture and historical archiving) | Legacy Unix/Linux network engineering environments prioritizing zero software licensing costs. |
| Unimus | Commercial (Lightweight Linux/Win) | Agentless CLI (SSH/Telnet) | Visual diffs with instant one-click rollbacks | Moderate (Basic drift detection and rule auditing) | Fast-moving teams needing an intuitive UI deployed in minutes without steep setup curves. |
Selecting the Right Approach
Choosing between these solutions comes down to your operational model:
* If your engineering workflow already centers around Git and automated pipelines, Oxidized delivers a lightweight, reliable daemon that turns every configuration change into a timestamped Git commit.
* If you must pass rigorous security audits and demonstrate continuous compliance enforcement to external regulators, commercial platforms like SolarWinds NCM or ManageEngine NCM provide pre-built policy validation engines out of the box.
* If you want a lightweight, specialized solution that non-developers can operate effortlessly, Unimus offers the simplest onboarding experience without RANCID’s legacy setup requirements.
Conclusion
Maintaining a secure, reliable network infrastructure requires a systematic approach to configuration backups. By combining the proper techniques across the device lifecycle, network teams can avoid configuration drift and reduce downtime:
1. Ensure operational modifications are validated and synchronized to the startup-config before backups are taken.
2. Deploy routine command-line transfers via SCP or TFTP for localized switch maintenance.
3. Leverage direct USB storage as a dependable safeguard when recovering air-gapped systems or during hardware replacements.
4. Activate internal IOS archive automation to create version-controlled historical recovery points every time an engineer commits a save.
5. Scale fleet-wide operations using custom Python Netmiko automation for scriptable environments, or deploy an NCM platform like Oxidized or SolarWinds for enterprise-wide versioning and regulatory compliance.
Aligning your backup strategy with these methods ensures your team can recover from misconfigurations, hardware faults, and unexpected outages quickly and reliably.











Comments