Port Security on a Cisco Switch — Configuration, Violation Modes and Recovery
Port security limits which and how many MAC addresses a switch port accepts. Real Cisco commands, sticky learning,…

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.
Switch# show version
Switch# show flash:
Switch# dir flash:Check three things:
Switch# copy running-config 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:
| Symptom | Cause |
|---|---|
| Timeout, no exclamation marks | No IP connectivity — ping the server first |
| “Permission denied” | TFTP server’s directory permissions, or the file is outside its root |
| Transfer starts then stalls | UDP 69 blocked partway, or an MTU problem |
| Very slow | Normal — TFTP has no windowing. Use SCP for large images. |
| “Not enough space” | Delete the old image, or use a different filesystem |
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.
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 StrongPasswordThen push from your workstation:
scp c2960-lanbasek9-mz.152-7.E3.bin [email protected]:flash:/Or pull from the device:
Switch# copy scp: flash: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) = 8f14e45fceea167a5a36dedd4bea2543Compare 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.binThis also checks the embedded image signature on platforms that support it.
Switch(config)# boot system flash:c2960-lanbasek9-mz.152-7.E3.bin
Switch(config)# end
Switch# show boot
Switch# write memory
Switch# reloadTwo points here:
boot system line gives you an automatic fallback if the new one fails — worth doing if you have the flash space.After the reload:
Switch# show version | include image|System image
Switch# show flash:If the device drops to rommon 1>, it could not load an image. You have two options.
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 > tftpdnldrommon 1 > xmodem -c c2960-lanbasek9-mz.152-7.E3.binThen 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=115200Remember to set the console speed back afterwards.
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.tarNewer platforms use the install model instead:
Switch# install add file flash:image.bin activate commitUsually 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.
verify /md5 flash:<filename> and compare the result against the hash published on Cisco’s download page. Do this before reloading, not after.
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.
The boot system configuration telling the device which image to load. Multiple statements are tried in order, which is how you configure a fallback.
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.
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.
One response to “How to Copy an IOS Image to a Cisco Switch or Router”
[…] Also Read: How To Move IOS Image In Cisco 2900 Series Switch […]