This tutorial explains Cisco IOS backup and restore process step by step including how to upgrade Cisco IOS and how to restore IOS from ROMMON mode.
IOS is the most critical part of any cisco device. We should always keep a backup copy of IOS to deal with any unwanted situation. We can use any supporting file transfer protocol for backup such as FTP, TFTP or RCP. In this article I will use TFTP for this process.
This tutorial is last part of our article “Cisco Internetworking Operating System (IOS) Explained with Examples”. Other parts of this article are available here.
This tutorial is first part of this article. In this part, I explained naming convention used in Cisco IOS. Cisco IOS name contains a lot of information about IOS such as features, type, version, platform, compression and location.
This tutorial is second part of this article. In this part, I explained Cisco IOS mode in detail with example. Different modes are used for different purpose. This tutorial will help you in choosing correct mode for assigned task.
This tutorial is third part of this article. In this part, I explained How to get help in Cisco IOS in detail with examples. Knowing how get help will make your job easier as Cisco IOS includes thousands of commands with numbers of switches and parameters.
- TFTP is the most lightweight authentication less protocol.
- It does not implement any security measurements such as login or access control mechanism.
- TFTP can only read and write files from TFTP server. It cannot list, delete or rename files or directories.
- TFTP is originally designed for LAN ( Local Area Network). It is virtually unused on Internet.
- It is used for initial stages of any network booting approach such as PXE, BSDP, BOOTP.
- It is also used for firmware images and configuration file transfer to network appliances like router, switch, IP phone, firewall etc.
- TFTP use UDP as transport protocol.
- Transfer request is always initiated on port 69.
For demonstration purpose I will use Packet Tracer network simulator software.
Open Packet Tracer and click End devices. From End devices drag and drop Server and PC-PT in workspace.
Click Router. From available Routers drag and drop a 1841 series router in workspace.
Click Connections. Connect Server's FastEthernet 0 with Router's FastEthernet0/0 via cross cable and Router's console with PC-PT's RS232 via console cable.
Configure Router's interface FastEthernet0/0 with IP address 10.0.0.1. (In real life we never use /8 subnet for end to end connection, but in lab environment we can go with it to the process simple.)
Configure IP address on Server
Packet Tracer is developed for Cisco Exam Practice. It has all that we need to do the practice for any cisco associate level exam. Sever has multiple IOS images for practice. By default TFTP service is running on Server. To verify it click on Config menu tab and expend the Services left menu item.
That all we need to do the practice of backup and restore process. Before we move forward, make sure you have this topology. Alternatively you can download pre-configured topology from our site. By now I assume that you have this topology in packet tracer.
By now I assume that you have this topology in packet tracer.
Click PC-PT and click Desktop menu and click Terminal and accept default Settings. Now we are connected with Router.
How to take backup of Cisco IOS
Run show flash command from privilege exec mode and note down the name of IOS file.
copy flash tftp command is used to copy IOS from Flash to TFTP server. It takes three parameters.
Source filename :- Name of IOS file that need to be copied.
Address or name of remote host :- IP address of TFTP Server. ( To use name we need to configure DNS service on router. )
Destination filename :- Name of file used at destination to store the source file.
We have successfully taken the backup of IOS on TFTP Server. In next step we would delete the current IOS.
Next command will delete IOS from flash. If you are following this practice on real device skip this stage, unless you are doing it under the supervision of an expert. If you are following this practice on packet tracer, go ahead.
From privileged mode use delete command to delete IOS file from flash.
Router#delete:[IOS File Name]
Press Enter when asked to confirm the delete operation.
During the boot process router copy and decompress the IOS file in RAM. Router will work as it is until we reload it. Enter reload command in privileged mode to reload the router.
As expected Router entered in ROMMON mode. ROMMON mode is used for disaster recovery. See our previous article to learn more about Router booting process.
How to restore IOS from ROMMON mode
ROMMON Mode allows us to restore IOS from TFTP Server in Flash. We can use this feature to install new IOS or upload another copy of IOS in Flash.
ROMMON mode has only couple of commands to work with. You can list all available commands by entering ? [Question mark key] .
tftpdnld command is used to download the IOS from TFTP Server.
tftpdnld command needs following variable to be set, before it can download the file.
- IP_ADDRESS :- Temporary IP address assigned to the router.
- IP_SUBNET_MASK :- Must match with the subnet of TFTP Server.
- DEFAULT_GATEWAY :- For this process it would be IP Address of TFTP Server.
- TFTP_SERVER :- IP address of TFTP Server.
- TFTP_FILE :- Exact name of IOS file. Name is case sensitive.
- TFTP_CHECKSUM :- This prevents checksum errors with earlier version of boot ROMs.
Set above variables and enter tftpdnld command. Command will list all variables for your confirmation. If any variable need to be correct type N and reset that variable before executing this command again. If all variables are correct, type Y to confirm the download operation.
Before you confirm the downloading process make sure:-
- TFTP Server is running.
- IOS file is located in the root directory of TFTP Server.
- IOS file being downloaded is compatible with hardware.
- Use first built in interface of router to connect with TFTP Server. Command will not work with modular card interface.
- Server and device are connected with supporting cable. If directly connected use cross cable. If connected via switch use straight through cable.
- All variable commands are case sensitive and must be entered in upper case.
- Entered IOS file name must match exactly with the file name stored in TFTP Server.
- IP_ADDRESS is a temporary address of router. It must be different from DEFAULT_GATEWAY. You can pick any unused IP address for router, from the subnet of DEFAULT_GATEWAY.
- For this process DEFAULT_GATEWAY and TFTP_SERVER are the same. Use TFTP Server's IP address for both.
In few minutes IOS would be download in flash. Once this process is completed use reset command to reload the system.
We have successfully restored the IOS. Router does not store any running configuration automatically. Running configuration is remain in RAM. When we reload the system any running configuration stored in RAM get erased Unless we saved it manually. In above example we did not store running configuration so we need to configure it again for next practice. Assign IP address to router's FastEthernet 0/0. If you have downloaded pre-configured topology from our site reopen it for next practice.
How to upgrade Cisco IOS
Cisco continuously updates IOS to meet new requirements. With updating existing one, Cisco also release features specific IOS. Whether you are upgrading existing one or installing new Cisco IOS, method is same.
Connect device with TFTP Server. I already explained this process earlier in this article. By now I assume that your device has proper connectivity with TFTP Server and TFTP Server contains the IOS, which you are looking for.
Following command is used to download new IOS from TFTP Server in Flash memory.
Router#copy tftp flash
This command requires three parameters.
Address or name of remote host :- IP Address of TFTP Server.
Source filename :- Exact file name of IOS stored in TFTP Server.
Destination filename :- Name of IOS file that you want use in flash.
In following example we would download another IOS.
Use show flash command to list all files stored in flash.
We have successfully downloaded another IOS. Now you can safely delete the old IOS or can keep both. If you delete old IOS, new IOS will be load automatically during the next boot process.
Couples of old series routers do not have sufficient memory for another IOS. In such a case you could delete current IOS from flash before downloading another IOS. As I have already mentioned earlier in this article, during the boot process router copy and decompressed ( if file is compressed) the IOS in RAM. So you are safe until router is running.
If you keep both IOS, you need to adjust the config register value. Router uses config register value to select the boot option.