This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Cisco IOS Upgrade Config Change Template - recent switches, no reload

All -

As suggested by Jiri, here is my NCM Config Change Template for upgrading Cisco Catalyst switch IOS versions.

Note that this script was written to upgrade switches by type; i.e. run once to upgrade a batch of 2960 switches, run a second time to upgrade a batch of 3750 switches. Mixing switch types in the same iteration will make your network VERY unhappy.........

The following caveats apply:

Switch must be a relatively recent Catalyst model. I've tested it successfully on the following models:

  • 2950
  • 2960
  • 3560
  • 3750
  • 3750-E
  • 3750-X

The template is dependent on the relevant *.tar image file being available in the \TFTP-Root directory of your Core Server, and the script will ask you for the full filename of the *tar file as a variable (please note you don't need the full pathname, just make sure you include the extension). Please note that the older *.bin type IOS files will not work with this template: it uses the archive download-sw command which expects the *.tar filetype so that it can upgrade the web-based management tool etc.)

The template will NOT reload the switch. It's a personal preference, but I like to ensure that the IOS has been upgrade successfully before I issue the reload command. If you do want to do this, edit the script and change the line:

string @CommandLine = 'archive download-sw /overwrite tftp://${StorageAddress}/' + @IOS_FILENAME

to read:

string @CommandLine = 'archive download-sw /overwrite /reload tftp://${StorageAddress}/' + @IOS_FILENAME


Alternatively, if you wish to schedule a reload of the switch as part of the script check out Cicsco IOS Upgrade Change Template: with scheduled reload

Note that the IOS filenames listed under the .PARAMETER_DESCRIPTION @IOS_FILENAME section of the script are just the versions we use on site. You can edit these accordingly, they are just there as a reminder when you are running the script.

This config does NOT work on NX-OS or IOS-XE switches!!!

Feel free to suggest amendments, or take it and improve it!!

Regards,

John

  • Hello I am new to NCM and was wondering how can i find the .tar files.  I have downloaded my .bin files but would like to run a script from NCM to upload the new IOS to the switches.  But not sure how I come about the .tar files.

  • You need to go to the Cisco website and download the .tar file for the product that you have.  The .tar files are there too.  If there is no .tar file for the IOS you want, you cannot use this script.  This ios upgrade procedure only works with .tar files.  You will need the serial number of the device or a support contract to get most of them.  Here is the link.  Just put in your model number and pick the IOS that is right for your environment.  Make sure you have enough DRAM and flash to support the IOS that you pick.  To check that, type dir at the command prompt in your device.

  • how does the script react to bin files rather than tar? Would I need to do anything to the script?

  • Hi -

    As stated in the description,  the archive download-sw command doesn't work with the BIN files, so you'd have to use the older method of copy tftp: flash: etc. However, this is complicated on the more recent switches by the fact the the actual IOS file is normally stored in a subdirectory:

    Directory of flash:/

        2  -rwx       12496   Aug 9 2012 13:20:29 +01:00  vlan.dat

        8  drwx         192  Feb 29 2012 15:12:28 +00:00  c3750-ipbasek9-mz.122-55.SE4

        5  -rwx       18376   Aug 3 2012 11:46:47 +01:00  config.text

        7  -rwx        3096   Aug 3 2012 11:46:47 +01:00  multiple-fs

       87  -rwx        3441   Aug 3 2012 11:46:47 +01:00  private-config.text

    15998976 bytes total (3343360 bytes free)

    3750-12G-Stack_**********#cd c3750-ipbasek9-mz.122-55.SE4

    3750-12G-Stack_**********#sho flash:

    Directory of flash:/c3750-ipbasek9-mz.122-55.SE4/

        4  drwx        1792  Feb 29 2012 15:07:35 +00:00  html

       85  -rwx    12067601  Feb 29 2012 15:12:28 +00:00  c3750-ipbasek9-mz.122-55.SE4.bin

       86  -rwx         681  Feb 29 2012 15:12:28 +00:00  info

    15998976 bytes total (3343360 bytes free)

    So, depending on how much space you have, you'll need to delete the existing BIN file (making sure that you are in the correct directory) and then make sure you upload the new BIN file to the relevant place.

    The other major reason for using archive download-sw is that it also auto-upgrades the rest of the member switches in a stack - if you use copy tftp: flash: you'll have to issue the command to every member switch (copy tftp: flash1:, copy tftp flash2: etc). You'd also need to edit the boot system value to make sure the switch actually uses the correct image when it reloads (the method in the script covers this automatically).

    In short, there's a reason that Cisco recommend using the archive download-sw command - it's a much cleaner and a lot less intensive way of doing things emoticons_wink.png

    Regards,

    John

  • This script worked downloaded the new firmware -- it also wiped out everything on the flash. I'm not sure why it did that.

  • Hi Scott -

    What model switch were you running it on? the script definitely should not delete files such as vlan.dat or the config files, however the /overwrite switch does mean that the previous version of IOS (plus the various web files for the http device manager) will be overwritten with the new versions. Can you clarify what the script "wiped out"?

    Regards,

    John

  • It appears that the script wiped out all files with the exception of the TFTP file. This was on a cisco 2960S. Firmware version 15.0.1 SE2 to 15.0.2 SE6.

    The script did only run the archive-sw /overwrite command, but it looks like it deleted the files before download. The switch then completed the download in parts, installed the OS and then extracted the default profile.

    The switch's flash now appears to be locked and I can't write anything, config or firmware, to it. I've never seen a switch do this before.

  • Will this script work on 2960X also?

  • Yes, it should do (although I haven't got one to test with).

    Regards,

    John