In this tutorial, you will learn how to upgrade the IOS image on a Cisco switch. I’ll show you two methods, the 1st is upgrading IOS using FTP and the 2nd is using a USB drive.
In this tutorial, I’ll be upgrading a Cisco 2960cx switch, the steps should be the same for other IOS models including routers.
Cisco releases new IOS images to fix bugs, security issues and to add new features. It is recommended to keep your equipment updated, it can be risky to run an IOS image that is 2 years old. I strongly recommend testing any new images before rolling them out into production.
Upgrade Cisco IOS Using FTP
Here are the steps for upgrading the IOS using FTP.
Step 1: Check Current IOS Version
To check your current switch version and model run this command.
Below you can see the output from my switch, it shows the current IOS version is 15.2(4)E6.
You can also check what IOS images are loaded to the file system of your equipment by running the show flash command.
If this command does not work run show file system to list the available file systems. This command needs to be run from exec mode.
Switch#show file system
Below is a screenshot of the show flash command from my switch
These commands are useful during an upgrade to check what version you are currently running and to verify new IOS images are loaded.
Step 2: Download IOS Image from Cisco
You will need to log into the Cisco website to download an IOS image. If you don’t have an account you will need to create one, the account is free.
Not all IOS images can be downloaded for free. You may need a Cisco smartnet contract for your equipment to download an image. With that said some images can be downloaded for free, I was able to download the images for the 2960cx for free.
To download click on support then click software downloads, browse or search your model.
When you get to the download page you will have multiple options, Cisco will put a star next to the image they suggest, this is typically a stable release. I still recommend you test the image before rolling it out into production. Have a spare device or a non critical switch to test it on.
Click the download button next to the image you want to download. I’m downloading 15.2.7E.
Step 3: Configure FTP Server
I typically run an FTP program on my laptop when upgrading or configuring new switches. You can use an existing FTP server if you have one, if not here are the steps to configure a lightweight FTP server on your computer.
1. I’ll be using the Tftpd64 FTP program. Download Here. I downloaded the non service-edition.
2. Install the program, I used the defaults.
3. Create a directory on your computer to store the IOS images and copy the downloaded image from step 2 to this directory. I’m using c:\it\ios.
4. Change the Tftp64 program to use the new directory.
Now when you click “show Dir” it should show your IOS image.
This completes the FTP setup. Anytime you want to upgrade a switch just open this program. If you want something permanent than you will want to setup an FTP service on a server so it is running all the time.
Step 4: Copy the IOS image to the Cisco Switch
If you are running the tftp program from your computer you need to make sure it has connectivity to the switch over the network. On new switch builds I just give the switch a temporary IP address and give my computer an IP on the same subnet.
For this example, my switch is 10.100.0.1 and my computer is 10.100.0.2. I verify I have connectivity by pinging the switch from my computer.
From the switch run the command copy tftp flash, enter the IP of the computer running tftp, then the source and destination file name.
Switch#copy tftp flash Address or name of remote host ? 10.100.0.2 Source filename ? c2960cx-universalk9-mz.152-7.E.bin Destination filename [c2960cx-universalk9-mz.152-7.E.bin]?
You can check the progress in the tftp program.
Once the copy is complete, check the file system to verify it is has been copied.
This is optional but you can also verify the copy by checking the MD5 checksum on the file. Some organizations have a requirement to verify files downloaded from the internet. I’ve never had any issues downloading from Cisco so I usually skip this step. To very MD5 checksum run this command.
verify /md5 flash:c2960cx-universalk9-mz.152-7.E.bin
Then compare this MD5 with the MD5 Cisco provided on their website. These two numbers should match, here is my output.
verify /md5 (flash:c2960cx-universalk9-mz.152-7.E.bin) = 4f066afdaefb3186fa3f56ab41114ea4
I check the Cisco website for the image I downloaded and the numbers match. This confirms the image was not damaged or modified.
Step 5: Modify Cisco Boot Configuration
Now that the image is uploaded to the Switch the next step is to modify the boot configuration. You can check the current boot image with the show boot command.
Switch#show boot BOOT path-list: flash:/c2960cx-universalk9-mz.152-4.E6/c2960cx-universalk9-mz.152-4.E6.bin
Above you can see the current boot file is c2960cx-universalk9-mz.152-4.E6.bin.
To change the boot image use the boot system command followed by the path to the IOS image.
Switch#boot system switch all flash: c2960cx-universalk9-mz.152-7.E.bin
Now run the show boot command again to verify the booth path has changed.
Switch#show boot BOOT path-list: flash:c2960cx-universalk9-mz.152-7.E.bin
You can see my boot path has changed to the new image.
Step 6: Save Configuration and Reboot the Switch
Save the configuration with the “write mem” command.
To load the new image you will need to reboot the switch.
Below is a screenshot during the switch reboot, you can see the new IOS image being loaded.
Step 7: Verify image after reboot
The last step is to verify your switch loaded the new ios image after a reboot. This can be done with the show version command.
That completes the tutorial for upgrading using FTP. The next section I’ll go over upgrading using a USB drive.
Upgrade Cisco IOS Using USB
If your device has a USB port and you have physical access you can upgrade the IOS via a USB drive.
The first step is to ensure the USB works and is formatted correctly.
Console into your switch and plug in your USB drive. If you see a message like below then your drive is not formatted correctly. You would also get an error if you tried to view the files on the USB drive.
%USBFLASH-4-FORMAT: usbflash0 contains unexpected values in partition table or boot sector. Device needs formatting before use!
Some tutorials show you how to format the drive using Windows but I’ve not had any luck with that. The only way I can get the USB drive to work is to format it from the switch.
Run the format command from the switch and specify the USB port. Here is the output from my switch.
Switch#format usbflash0: Format operation may take a while. Continue? [confirm] Format operation will destroy all data in "usbflash0:". Continue? [confirm] Primary Partition created...Size 1328 MB Drive communication & 1st Sector Write OK... Format: All system sectors written. OK... Format: Total sectors in formatted partition: 2719712 Format: Total bytes in formatted partition: 1392492544 Format: Operation completed successfully. Format of usbflash0 complete
Now I don’t get an error when plugging in the USB drive to the switch. Next, copy the IOS image to the USB drive.
Run the command dir usbflash0: to verify the image is on the USB drive. Here is the output from my switch.
Switch#dir usbflash0: Directory of usbflash0:/ 4 -rw- 19016704 Feb 2 2022 07:40:38 +00:00 c2960cx-universalk9-mz.152-7.E.bin
Your USB drive number might be different than mine, run show file system to check.
Run this command to copy the image from USB to the switch.
copy usbflash0: flash
Here is the output from my switch.
Switch#copy usbflash0: flash Source filename [c2960cx-universalk9-mz.152-7.E5.bin]? Destination filename [c2960cx-universalk9-mz.152-7.E5.bin]?
Once the image is copied the remaining steps are the same as 5-7 from the FTP section.