Cisco IOS Backup and Restore Process Step By Step Guide

An IOS is a Cisco-proprietary operating system for Cisco devices, such as routers and switches. Cisco provides and distributes it as an image file. When you start a router or switch, it extracts the IOS image file, loads it in RAM, and runs it from there until the device is up. If this file is corrupt, the device will not boot. Since this file is critical, you should always keep a backup of it on an external device. This tutorial explains how to back up an IOS image file from a running device and restore it when required.

Setting up a lab

This practice lab requires a PC, a Server, and a Router. You will copy the IOS image file from the Router to the Server. You can use any network simulator software or the real devices in this lab. This tutorial uses Packet Tracer.

Open the Packet Tracer and click the 'End Devices' icon. Drag a Server and a PC from the end devices into the workspace.

Practice Lab Step 1

Click the 'Routers' icon. Drag an '1841 series' router from the available routers and drop it in the workspace.

Practice Lab Step 2

Click the 'Connections' icon. Connect the FastEthernet0/0 interface of the Router to the FastEthernet0 interface of the Server and the console port of the Router to the RS232 port of the PC-PT via a cross cable and a console cable, respectively.

Practice Lab Step 3

Access the Router's CLI prompt and assign an IP address to FastEthernet0/0.

Assigning an IP address to the PC

Assign an IP address from the same subnet to the Server's FastEthernet0 interface.

Assigning an IP address to the Server

Click PC, open the Desktop menu, click the Terminal icon, and click OK to accept the default settings.

Terminal setting

That's all the setup you need. You can either create this LAB on your own or download this pre-created LAB from the following link and open it in Packet Tracer.

Pre-built Packet Tracer LAB for the practice

Managing IOS image files

Routers use the flash memory to store the IOS image files. During the boot process, a router loads the IOS image file from flash memory into RAM. If more than one IOS image file is available, it loads the first accessible one. If no IOS image file is available, it enters ROMMON mode. ROMMON mode allows you to download a new IOS image or restore an IOS image from backup.

TFTP Protocol

TFTP is a lightweight, authentication-less protocol. It transfers files between two supporting LAN devices. It is available in two variants: TFTP server and TFTP client. You need to install the TFTP server on the device that contains the file, and a TFTP client on the device that receives the file.

A TFTP protocol supports only read and write operations. A TFTP client can only read files from the root directory of the TFTP server. A TFTP client can only write files to the root directory of the TFTP server. The TFTP client cannot list, delete, or rename files or directories available on the TFTP server.

Cisco IOS includes the TFTP client. You can connect a Cisco router to a TFTP server and transfer any file from the TFTP server to the router. You can install the TFTP server on any standard PC and operating system. The Server available in Packet Tracer includes the TFTP server. If you are using other simulator software or real devices, install the TFTP server on the Server or on the system where you want to save the IOS image file.

Creating a backup of the existing IOS image file

A router/switch uses flash memory to store the IOS image and other configuration files. Flash memory may contain multiple IOS image files. To find the name of the IOS image file the router/switch used to boot, use the show version command in Privilege EXEC mode.

Show flash command

Verify connectivity between the router and the TFTP server.

Router#ping 10.0.0.2

Testing connectivity with the TFTP server

To back up the current IOS image file, use the following command.

Router#copy flash tftp

This command needs three arguments.

Source filename: - Specify the name of the IOS image file that you want to back up from flash memory to the TFTP server.

Address or name of remote host: - Type the IP address of the TFTP Server.

Destination filename: - To store the IOS image file with a different name on the TFTP server, specify the new name. To use the same name, press the Enter key.

The TFTP protocol copies the specified IOS image file to the TFTP server's root directory. It also prints the real-time progress of the copy operation.

Copy flash tftp

To verify the backup operation, click Server, click the config tab, and expand the Services tab from the left menu. The File section of the right pane shows the copied IOS image file.

Restoring an IOS image file

Copy flash tftp

A router does not start if a functional IOS image file is unavailable. To simulate this situation, you can delete the IOS image file from the flash memory. To delete the IOS image file from the flash memory, use the following command from Privilege EXEC mode.

Router#delete:[IOS File Name]

Do not run this command on a router in a production environment. It makes the router unbootable.

To confirm the delete operation, press the Enter key when it prompts. To verify the delete operation, use the 'show flash' command again.

delete flash

When a router starts, it copies the IOS image file from flash memory into RAM and uses it from RAM as long as the device is on. Because of this, the router will keep functioning till the next boot. However, at the next boot, if the router fails to find a valid IOS image file in flash memory, it will not start. By default, if a router does not find a valid IOS image at startup, it enters a special rescue mode called ROMMON mode. The ROMMON mode allows you to install a new IOS image or restore the IOS image file from a file server. To restart the router, run the 'reload' command from Privilege EXEC mode.

The reload command

To download a new iOS image file from the TFTP server, use the 'tftdnld' command. To use this command, you need to set a few essential variables. These variables are the following.

  • IP_ADDRESS:- Temporary IP address of the router.
  • IP_SUBNET_MASK:- Subnet mask of the assigned IP address.
  • DEFAULT_GATEWAY:- IP address of the TFTP Server.
  • TFTP_SERVER:- IP address of the TFTP Server.
  • TFTP_FILE:- Exact name of the IOS image file. The name is case sensitive.
  • TFTP_CHECKSUM:- Prevent checksum errors.

To list all these variables along with a short description, type a question mark after this command and press the Enter key.

rommon > tftpdnld ?

tfpdnld? command

Set the required variables and run the 'tftpdnld' command. This command lists all variables and their values. If a variable is incorrect, type 'N' and correct that variable, and execute this command again. If all the variables are correct, type 'Y' to confirm the download operation.

Restoring the iOS image from the TFTP server

If all variables are correct, this command downloads the IOS image file from the TFTP server to flash memory. After downloading the IOS image file, use the 'reset' command to restart the router.

Restart the router

After the restart, if the router boots typically with the new IOS image, it verifies that the restore operation was successful.

Troubleshooting tips

Instead of starting, usually, if the router reenters ROMMON mode, check the following.

Is the TFTP server running?
The TFTP server must be running and up.

Is the IOS file available in the root directory of the TFTP server?
The TFTP protocol can download files only from the root directory.

Is the downloaded IOS file compatible with the hardware?
If you download an incompatible IOS image, the router will not boot.

Is a modular interface used to connect to the TFTP server?
This command does not work with modular interfaces. You must use an on-board interface.

Are the Server and device connected via a supporting cable?
Use a cross cable if both have a direct connection. Use a straight-through cable if both have connections through a switch.

Have you entered all variables in the proper case?
All command variables are case-sensitive. You must enter them in uppercase.

Does the specified IOS image file name match the file stored in the TFTP server?
The entered IOS file name must exactly match the file name stored in the TFTP server.

Is the IP configuration correct?
IP_ADDRESS is a temporary address of a router. It must be different from DEFAULT_GATEWAY. You can choose any unused IP address for the router from the subnet of the DEFAULT_GATEWAY. DEFAULT_GATEWAY and TFTP_SERVER are the same for this process. Use the TFTP server's IP address for both.

Conclusion

Backing up and restoring an IOS image file on Cisco devices is a crucial process to ensure the reliability and functionality of your network equipment. By utilizing the TFTP protocol, you can easily create secure backups of IOS images and restore them as needed. This tutorial provided a step-by-step guide to setting up a lab environment with Packet Tracer, managing IOS image files, and performing adequate backup and restore operations.

ComputerNetworkingNotes CCNA Study Guide Cisco IOS Backup and Restore Process Step By Step Guide

We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, error reporting and technical issue) or simply just say to hello mail us ComputerNetworkingNotes@gmail.com