Guide: Backup or Restore Configuration on Cisco Routers
Cisco devices, such as routers and switches, rely on configuration files to control their operation and behavior. The configuration files contain the settings and configurations applied to the device, including network parameters, security policies, and interface configurations. It is critical to maintain up-to-date and accurate configuration files to ensure that the network operates optimally and securely.
Hence, backing up the configuration files of Cisco devices is crucial for disaster recovery, version control, regulatory compliance, ease of deployment, and improved maintenance.
Benefits of Backing Up Configuration Files
Backing up the configuration files of Cisco devices provides several benefits.
- Disaster Recovery: In the event of a device failure, having a backup of the configuration file allows for quick recovery and minimizes downtime.
- Version Control: Keeping a backup of configuration files enables you to revert to a previous version in case of configuration changes that lead to unexpected behavior.
- Compliance: Some industries have regulations that require organizations to keep backups of critical systems and configuration files.
- Ease of Deployment: When deploying multiple similar devices, having a backup of the configuration file can save time and effort in configuring each device individually.
- Improved Maintenance: Backing up the configuration files of a device allows for efficient maintenance and upgrade activities, as the configuration can be easily restored after an upgrade or maintenance.
Types of Configuration Files in Cisco Devices
There are two types of configuration files in Cisco devices, the running configuration file and the startup configuration file.
The running configuration file is the configuration file that is currently in use by the device. It is stored in the device’s RAM and is lost when the device is restarted or powered off.
The startup configuration file is the configuration file that is loaded when the device is started. It is stored in non-volatile memory, such as NVRAM or flash memory, and is persistent across reboots and power cycles.
Steps to backup the configuration files from a Cisco device
In this demo, let’s backup the configuration file from a router using Cisco Packet Tracer.
- Add a router and a server from the device list.
- Since it’s a demo, we have directly connected the server with the router, in real-time, there might be several devices between the router and the backup server.
- We have configured 10.0.0.2 on the router and 10.0.0.3 on the server.
- Follow the below commands to configure the router.
Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface gigabitEthernet 0/0/0 Router(config-if)#ip address 10.0.0.2 255.0.0.0 Router(config-if)#no shutdown
- To configure the IP address on the server, click on the server and then click on Desktop.
- Click on IP configuration.
- Configure the IP address of the server.
- Before backup the router, let’s do some basic configuration on the router, follow the below commands to configure the router.
Router#configure terminal Router(config)#interface gigabitEthernet 0/0/1 Router(config-if)#ip address 192.168.1.1 255.255.255.0 Router(config-if)#no shutdown Router(config-if)#exit Router(config)#router ospf 1 Router(config-router)#network 10.0.0.0 0.0.0.255 area 0 Router(config-router)#network 192.168.1.0 0.255.255.255 area 0 Router(config-router)#exit Router(config)#exit
- To save the configuration to the startup file enter the below command in privileged mode. Once hit enter you will get a message as ‘Building configuration.. [OK]’, that means the configuration is saved in the startup file successfully.
Router#write Building configuration... [OK]
- Now, configure the TFTP service in the server. To do that click on the server and click on Services. In real-time, this will be taken care by the server team.
- Click on TFTP and select ‘On‘.
- Now the server is ready, let’s see how to backup the startup and running config files to the server using TFTP.
- Go to the router’s CLI page and enter privileged mode and then enter the below commands to backup the startup-config file.
Router#copy startup-config tftp
To copy the running config use the below command.
Router#copy running-config tftp
- To download the startup or running configuration, use the appropriate commands and press enter.
- Once hit enter, the router will ask for the server’s IP or hostname, provide the IP or hostname of the TFTP server.
Address or name of remote host []? 10.0.0.3
- Now router will ask for a filename for the backup file, you can provide any name or leave it blank and hit enter. If you didn’t provide any name, the router will use a default name for the config file and store it on the TFTP server.
Destination filename [Router-confg]? router startup backup demo Writing startup-config....!! [OK - 779 bytes] 779 bytes copied in 3.005 secs (259 bytes/sec)
For your reference, find the complete snippet from the router below.
- To validate whether the backup is copied to the server, go to the server and click on services and then go to TFTP.
- If you scroll down, you can find the backup file on the server.
- To copy the configuration file to an FTP server, a username, and password with sufficient privileges to access and store the file on the FTP server is required. The FTP username and password can be obtained from the server team in real-time and configured in the router.
- For the demo, let’s configure the FTP username and password on the server and then apply the same to the router.
- To configure FTP, click on the server and go to services then click on FTP.
- Enter the username and password and select the necessary privileges then click on add.
- To configure the username and password on the router, follow these commands.
Router#configure terminal Router(config)#ip ftp username demo Router(config)#ip ftp password demo123
- Once configured, use the below commands in privileged mode to copy the config file to the FTP server.
Router#copy startup-config ftp Address or name of remote host []? 10.0.0.3 Destination filename [Router-confg]? backup startup config demo Writing startup-config... [OK - 779 bytes] 779 bytes copied in 0.1 secs (7000 bytes/sec)
As we mentioned earlier we need to provide the destination server IP or name and name for the config file.
For your reference, find the complete snippet from the router below.
- Also, the backup destination can be a USB drive or NVRAM, you need to change the destination in the command depending on the destination. Here are the sample commands for reference.
USB Drive: to copy the config file to a USB drive, you need physical access to the Cisco device.
copy running-config usbflash0
NVRAM:
copy running-config startup-config
Steps to restore the configuration files to a Cisco device
- On the router enter the privileged mode.
- Use the “copy [source] running-config” command to restore the configuration file. The source can be a TFTP server, a USB drive, an FTP server, or NVRAM, depending on where the backup is stored.
- Use the below command to restore the configuration file from a TFTP server.
Router#copy tftp running-config
- Now, the router will ask for the source IP or hostname, provide the TFTP server’s details.
Router#copy tftp running-config Address or name of remote host []? 10.0.0.3
- Now we need to provide the name of the config file which we would like to restore on the device. We can leave the destination filename blank and hit enter. Once hit enter, the config file will be restored on the router.
Source filename []? router startup backup demo Destination filename [running-config]? Accessing tftp://10.0.0.3/router startup backup demo... Loading router startup backup demo from 10.0.0.3: ! [OK - 779 bytes] 779 bytes copied in 0 secs
For your reference, find the complete snippet from the router below.
In conclusion, backing up the configuration files of Cisco devices is an essential practice for ensuring the stability, security, and availability of your network. By understanding the types of configuration files, the benefits of backing up configuration files, and the process of backing up and restoring configuration files, network administrators can ensure that their network operates optimally and can quickly recover in case of a failure.
Automating config backups can be easily accomplished through the use of network management systems. One highly recommended option is SolarWinds NCM. This NMS allows for the scheduling of config backups, with the downloaded configs being stored in the desired location. To get started with using Solarwinds NCM for automated backups, simply follow the instructions provided in this link.