So far, we’ve discussed backing up configuration files, restoring them, and backing up the Cisco IOS software itself. This time, we’ll upgrade the Cisco IOS software on a router by building on what you’ve already learned.
NOTE: If you’d rather watch than read, check out the video at the bottom of this article.
Ways to Upgrade
In the good ol’ days, the only way to upgrade the IOS software was by using the Xmodem protocol — which is extremely slow — or TFTP. Newer versions of IOS now support upgrading using FTP, HTTP, and SCP, in addition to TFTP and Xmodem. Due to its simplicity, however, TFTP remains one of the most popular ways to perform IOS upgrades.
NOTE: Because it can sometimes take several hours to complete, upgrades using Xmodem are typically performed only as a last resort, such as when Bad Things™ happen.
In addition, since we’re talking about it here, you might assume that you could be asked about TFTP on the CCNA test.
Acquire the Cisco IOS Image
The first thing that we’ll need to do, obviously, is obtain the new Cisco IOS image that you wish to install on our device. You can download these images from the Cisco web site, assuming you have a valid service contract.
The Cisco 2610XM router that I’ll be upgrading today is currently running version 12.4(25b) of the IP Base featureset. I’m going to stick with the same version but upgrade to the Advanced Enterprise Services featureset. I’ve already downloaded the file and placed it in the correct directory on my TFTP server.
Check for Available Space
If you have existing IOS images currently stored in flash memory (and you should have at least one), you’ll want to make sure that you have enough free space for the image you plan to copy. The show flash command shows us how much total space is available and breaks it down into used and free space:
LASVEGAS# show flash System flash directory: File Length Name/status 1 13660800 c2600-ipbasek9-mz.124-25b.bin [13660864 bytes used, 36146492 available, 49807356 total] 49152K bytes of processor board System flash (Read/Write) LASVEGAS#
As you can see here, we have one IOS image saved in flash and it is 13,660,800 bytes in size. We’re using a total of 13,660,800 out of 49,807,356 total bytes of available space in flash, leaving 36,146,492 bytes currently free.
The software image that I’m going to upgrade to, c2600-adventerprisek9-mz.124-25b.bin, is 29,957,284 bytes in size and, thus, will fit into the free space. IOS will ask if you’d like to erase the existing contents of flash during the upgrade process and, if you don’t have the required free space, you’ll need to do this.
I recommend keeping images in flash as long as you have the available space and, since the new one will fit, I’ll tell IOS not to delete the flash memory.
copy tftp flash
Now that we know we have adequate free space for the new image, we can begin the upgrade process. Once again, we’ll use the copy command to do this. This time, however, we’ll use “tftp” as the source and “flash” as the destination.
LASVEGAS# copy tftp flash Address or name of remote host ? 192.0.2.235 Source filename ? c2600-adventerprisek9-mz.124-25b.bin Destination filename [c2600-adventerprisek9-mz.124-25b.bin]? Accessing tftp://192.0.2.235/c2600-adventerprisek9-mz.124-25b.bin... Erase flash: before copying? [confirm] n Loading c2600-adventerprisek9-mz.124-25b.bin from 192.0.2.235 (via FastEthernet0/0): !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [OK - 29957824 bytes] Verifying checksum... CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC OK (0x3C42) 29957824 bytes copied in 725.577 secs (41288 bytes/sec)
NOTE: Flash memory is sloooooooow. Even on a 100 Mbps Ethernet network, it still took just over 12 minutes for the 30 MB transfer to complete. This is because the image is written to flash memory in “chunks” as it is downloaded, which slows the whole process down tremendously.
Let’s quickly cover the various parameters seen above, in case they’re not intuitive:
- Remote host – Hostname of IP address of the TFTP server
- Source filename – The name of the IOS image on the TFTP server
- Destination filename – What the IOS image will be saved as in flash
The transfer was successful and we can see that both IOS images are now saved in the router’s flash memory:
LASVEGAS# show flash System flash directory: File Length Name/status 1 13660800 c2600-ipbasek9-mz.124-25b.bin 2 29957284 c2600-adventerprisek9-mz.124-25b.bin [43618212 bytes used, 6189144 available, 49807356 total] 49152K bytes of processor board System flash (Read/Write) LASVEGAS#
Select a Boot Image
When only one Cisco IOS software is present in a device’s flash memory, it will automatically be booted by default (and, thus, the following step isn’t necessary). When we have more than one, however, we should explicitly tell the router which image we want it to boot. This isn’t absolutely necessary, as the router will boot the first image that it finds but, unfortunately, that isn’t always the one that we want.
For this reason, it’s a good idea to let the router know which image we would like it to boot into the next time it reloads. We can do this by issuing the boot system command in global configuration mode. We can instruct the router to boot into the new image by passing two parameters to this command, “flash” (the location of the IOS image) and “c2600-adventerprisek9-mz.124-25b.bin” (the filename of the IOS image itself).
LASVEGAS# conf t LASVEGAS(config)# boot system flash c2600-adventerprisek9-mz.124-25b.bin LASVEGAS(config)#
NOTE: View your running configuration and make sure there aren’t any similar lines pointing at other IOS images. If there are, you’ll want to remove them using no boot system flash ....
Save and Reload
Save your configuration and let’s reload the router:
LASVEGAS(config)# end LASVEGAS# copy run start Destination filename [startup-config]? Building configuration... [OK] LASVEGAS# reload Proceed with reload? [confirm]
Verify New Image is Running
After the router has reloaded, we can verify that we are running the new IOS image by using one of the basic Cisco IOS commands you’ve already learned, show version:
LASVEGAS> enable LASVEGAS# show version Cisco IOS Software, C2600 Software (C2600-ADVENTERPRISEK9-M), Version 12.4(25b), RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2009 by Cisco Systems, Inc. Compiled Wed 12-Aug-09 10:59 by prod_rel_team ROM: System Bootstrap, Version 12.2(7r) [cmong 7r], RELEASE SOFTWARE (fc1) LASVEGAS uptime is 1 minute System returned to ROM by reload System image file is "flash:c2600-adventerprisek9-mz.124-25b.bin" ...
We can see from the output that the router has booted the new image. The full range of features present in the Advanced Enterprise Services featureset are now available to us.
Knowing how to properly and successfully upgrade the IOS image on Cisco routers and switches is a basic skill required of all network engineers. Upgrades often need to be performed for various reasons, such as bug fixes, security updates, or to enable new features.
The upgrade process is straightforward and simple but you must pay attention to detail and ensure all the necessary steps are completed in the proper order. Otherwise, you might have to perform a recovery from ROMMON mode (which we’ll cover later) which isn’t very fun to do.
The video below demonstrates the complete process of upgrading the Cisco IOS software, telling the router which IOS image you want to boot, and verifying that the upgrade was successful.