Switching

How to Copy an IOS Image to a Cisco Switch or Router

G Gurpreet Singh • April 25, 2024 • 7 min read
Animated diagram for How to Copy an IOS Image to a Cisco Switch or Router, showing four routers in a line with a packet travelling hop by hop and a route table lookup highlighting each column in turn
📖 7 min read · 1,434 words

Loading a new IOS image onto a Cisco device is a four-step job: get the file onto flash, verify it, set the boot variable, and reload. Skipping the verification step is how devices end up in ROMMON.

Before You Start

Switch# show version
Switch# show flash:
Switch# dir flash:

Check three things:

  1. Free space. The image is typically 30–150 MB. If flash is nearly full you will need to delete the old image first, which means you have no fallback, so make sure you can recover.
  2. The correct image for this model. The exact platform and feature set matter. Loading the wrong one produces a device that boots into ROMMON.
  3. A current configuration backup. Always, before any upgrade.
Switch# copy running-config tftp:

Method 1, TFTP

The traditional method. It needs a TFTP server reachable from the device.

Switch# copy tftp: flash:
Address or name of remote host []? 10.10.10.50
Source filename []? c2960-lanbasek9-mz.152-7.E3.bin
Destination filename [c2960-lanbasek9-mz.152-7.E3.bin]?

Accessing tftp://10.10.10.50/c2960-lanbasek9-mz.152-7.E3.bin...
Loading c2960-lanbasek9-mz.152-7.E3.bin from 10.10.10.50 (via Vlan1): !!!!!!!!
[OK - 17530368 bytes]

If it fails, work through these in order:

SymptomCause
Timeout, no exclamation marksNo IP connectivity, ping the server first
“Permission denied”TFTP server’s directory permissions, or the file is outside its root
Transfer starts then stallsUDP 69 blocked partway, or an MTU problem
Very slowNormal, TFTP has no windowing. Use SCP for large images.
“Not enough space”Delete the old image, or use a different filesystem

Method 2, USB (fastest, when the device has a port)

Switch# dir usbflash0:
Switch# copy usbflash0:c2960-lanbasek9-mz.152-7.E3.bin flash:

The USB stick must be FAT16 or FAT32, NTFS and exFAT are not recognised. This is the quickest method for a large image and needs no network at all.

Method 3, SCP (the right choice in production)

Encrypted, authenticated, and considerably faster than TFTP.

! Enable the SCP server on the device
Switch(config)# ip scp server enable
Switch(config)# aaa new-model
Switch(config)# aaa authentication login default local
Switch(config)# aaa authorization exec default local
Switch(config)# username admin privilege 15 secret StrongPassword

Then push from your workstation:

scp c2960-lanbasek9-mz.152-7.E3.bin admin@10.10.10.1:flash:/

Or pull from the device:

Switch# copy scp: flash:

Verify the Image, Do Not Skip This

A truncated or corrupted image will not boot, and you will discover that after the reload, remotely, with no working device.

Switch# verify /md5 flash:c2960-lanbasek9-mz.152-7.E3.bin
........................Done!
verify /md5 (flash:c2960-lanbasek9-mz.152-7.E3.bin) = 8f14e45fceea167a5a36dedd4bea2543

Compare that against the MD5 hash published on Cisco’s download page. If it does not match exactly, delete the file and transfer again, do not reload.

Switch# verify flash:c2960-lanbasek9-mz.152-7.E3.bin

This also checks the embedded image signature on platforms that support it.

Set the Boot Variable and Reload

Switch(config)# boot system flash:c2960-lanbasek9-mz.152-7.E3.bin
Switch(config)# end
Switch# show boot
Switch# write memory
Switch# reload

Two points here:

  • Boot statements are tried in order. Leaving the old image as a second boot system line gives you an automatic fallback if the new one fails, worth doing if you have the flash space.
  • Save before reloading. The boot variable is configuration; unsaved, the device comes back on the old image.

After the reload:

Switch# show version | include image|System image
Switch# show flash:

Recovering a Device With No Usable Image

If the device drops to rommon 1>, it could not load an image. You have two options.

ROMMON with TFTP (fast, use this if the device has an Ethernet management port that works in ROMMON)

rommon 1 > set IP_ADDRESS=10.10.10.1
rommon 2 > set IP_SUBNET_MASK=255.255.255.0
rommon 3 > set DEFAULT_GATEWAY=10.10.10.254
rommon 4 > set TFTP_SERVER=10.10.10.50
rommon 5 > set TFTP_FILE=c2960-lanbasek9-mz.152-7.E3.bin
rommon 6 > sync
rommon 7 > tftpdnld

Xmodem over console (slow, hours for a large image)

rommon 1 > xmodem -c c2960-lanbasek9-mz.152-7.E3.bin

Then send the file from your terminal program using Xmodem. Raising the console speed to 115200 first makes a substantial difference, at 9600 baud a 50 MB image is not a realistic transfer.

rommon 1 > confreg 0x2101
rommon 2 > set BAUD=115200

Remember to set the console speed back afterwards.

Switch Stacks

Every member must run the same image or it will not join the stack. On a stack, copy to all members:

Switch# copy tftp: flash1:
Switch# copy tftp: flash2:

! Or use the archive command, which handles distribution
Switch# archive download-sw /overwrite /reload tftp://10.10.10.50/image.tar

Newer platforms use the install model instead:

Switch# install add file flash:image.bin activate commit

Sensible Practice

  • Back up the configuration first. Every time.
  • Verify the MD5 hash before setting the boot variable.
  • Keep the previous image on flash as a fallback boot statement where space allows.
  • Have console access available, if the upgrade goes wrong, the network path is gone. Dedicated out-of-band management exists precisely for this.
  • Read the release notes. Some upgrades change default behaviour or deprecate commands you rely on.
  • Upgrade one device at a time in a redundant pair, and confirm the first is healthy before touching the second.
  • Do it in a maintenance window. Boot times of five minutes or more are normal on larger platforms.

Frequently Asked Questions

Why does my TFTP transfer fail partway through?

Usually insufficient flash space, a UDP 69 block partway along the path, or an MTU problem. Check free space with show flash: and confirm you can ping the server from the device first.

How do I check an IOS image is not corrupted?

verify /md5 flash:<filename> and compare the result against the hash published on Cisco’s download page. Do this before reloading, not after.

Can I delete the old image?

Yes, once the new one is verified and confirmed working after a reload. Keeping it until then gives you a fallback, so delete it only if flash space forces the issue.

What is the boot variable?

The boot system configuration telling the device which image to load. Multiple statements are tried in order, which is how you configure a fallback.

My device booted into ROMMON, what now?

It could not load a valid image. Recover by transferring one with tftpdnld if the ROMMON Ethernet port works, or with Xmodem over console if not. Then set the boot variable and reload.

Does the device need to reload to use the new image?

Yes on classic IOS. Platforms supporting ISSU or Cisco StackWise can upgrade with minimal disruption, but a standard switch or router requires a reload. See running vs startup configuration for what survives it.

Where this shows up in real life

Copy an IOS Image to a Cisco Switch or Router sounds abstract until you meet it in a normal setup. Take the sections above on Before You Start and Method 1, TFTP: every one of them maps to a device or a setting you can point at. Once you can point at it, the idea stops being theory.

The test is simple. Can you explain it to someone in two sentences, using your own network as the example? If yes, you understand it. If not, re-read the part where you got stuck, not the whole article.

The parts people mix up

  • Names that sound alike. Networking is full of terms that differ by one word and mean different things. When two ideas blur together, write both definitions side by side. The difference is usually one sentence.
  • What it does versus what it is called. Product names and protocol names get used loosely. Trust the function, not the label.
  • Old rules that no longer apply. Advice from ten years ago still circulates. Check whether it matches current hardware before you follow it.

When does this actually matter?

Not every day. Copy an IOS Image to a Cisco Switch or Router matters on three occasions: when something breaks, when you buy equipment, and when you plan a change. Knowing it before those moments is what turns a two-hour problem into a ten-minute fix.

What to learn next

Pick the topic that connects directly to this one, not a random next article. Knowledge in networking compounds: each idea makes the next one easier, but only if the two are actually connected. The related articles at the end of this page are the right place to look.

🧠 Quick Check — Test Yourself

Can you explain this topic to someone else in 30 seconds? If not, re-read the key takeaways above.

What should you remember most?

The core concepts in the takeaways box above. Bookmark this page and come back when you need a refresher.

GU
Written by

Gurpreet Singh

Hey! I"m Gurpreet Singh and I Have 7+ Years of experience in the Network & Security Domain as well as the Cloud Infra Domain. I am Certified with Cisco ( CCNA ), CheckPoint ( CCSA ), 1xAWS, 3xAZURE, and 3xNSE. So I love to share my tech knowledge with you.

One response to “How to Copy an IOS Image to a Cisco Switch or Router”

Leave a Reply

Your email address will not be published. Required fields are marked *