386.243.9001 or toll-free 844-CTS-KITS (844-287-5487)

Loading the switch’s IOS from a TFTP Server

Cisco Upgrade Switch IOS – IOS Labs

by Michael T. Durham

When you purchase a Cisco device such as a router or a switch it comes with an operating system installed most of the times.  However, the version installed may not have the features that you want or need to study.  If your device does not have an operating system currently installed, you will need to load one via the console port which we cover in a different lab.  Please note that using a console (serial) cable to upload an operating system to a device can take a very long time depending on its side and the baud rate that you set.  This lab covers the upgrading of a Cisco switch’s operating system on a switch that is currently bootable.

Please note that to be legal, Cisco requires that you pay them a fee for the upgraded IOS file and for the use of it and its features.  

Once you have obtained the operating system (IOS) version with the feature set that you want/need you can begin the process of upgrading your switch.  The instructions below are for the Cisco 2960-24-S switch but will also work for many other models with little to no modifications.

Before you begin you will need the following items:

  • PC computer with a network card
  • A TFTP program such as the one from SolarWinds http://www.solarwinds.com/free-tools/free-tftp-server
  • A terminal program such as Absolute Telnet: https://www.celestialsoftware.net/downloadselection.html?catid=0
  • A Cisco switch
  • A cross-over Ethernet cable (some switches auto-sense and can use a straight-through cable) •   A Cisco console cable

Let’s get started and Good Learning!

Loading the switch’s IOS from a TFTP Server

Below is the network diagram for the network that we will be setting up in the CME (Call Manager Express) VoIP lab series.  

The very first thing we need to do is configure our PC’s network card’s address and install the TFTP software if it is not already installed.  Your network card configuration will differ depending on which version of Windows you are running or if you are running a MAC.  The instructions below are for Windows 7.

Configuring your PC’s network card

Click the Windows Start button and click the Network menu option.  From the Network window select the Network and Sharing Center option.  Then select the Change adapter settings option.

Now click on your network adapter and then click on the properties button.

Now click on the Internet Protocol Version 4 option and then click the Properties button.  Then enter/change your IP address and default gateway to 192.168.0.1 and 192.168.0.2 respectively.  Click Ok on each window until all network windows are closed.

Before we can start the updating of our Cisco switch, we need to connect the Ethernet crossover cable to the PC’s network adapter port and the first port on the upper left of the switch.  We also need to connect the console cable between our PC’s serial (COM) port and the Console port on the rear of the switch.  Some computers will need an USB to Serial adapter if you do not have a serial port on it.

Configuring the TFTP server on your PC

We need to load a TFTP server software program on to your PC so that we can update Cisco IOS’ on routers and switches as well as update the firmware on IP phones.  Solar Winds has a good free TFTP server application and it can be download from their site at http://www.solarwinds.com/free-tools/free-tftp-server

Download and install the TFTP application by following the installation prompts.

Launch the Solar Winds TFTP Server application and click on File and then Configure menu options.

Set the directory that the TFTP server will using as its root.  This directory is where you put the files that will be uploaded to the Cisco device.  On our system, the TFTP default directory in D:\FTP Files\Cisco Files.  Next click the Start button to start the TFTP server application.

We now have a running TFTP server that is ready to upload and download files between our tftp client and the PC.

You may also need to install a terminal program on your PC so that you can communicate with the Cisco switch.  There are many good free and pay programs on the market.  Some versions of Windows come with HyperTerm which will work just fine.  Other programs include Putty, TerraTerm, Absolute Telnet, and Secure CRT. Download one and install it and then configure it to use the serial/COM port of your PC.  Many PC’s use port COM1 and the settings are 9600, 8, N, 1 to be able to communicate with the switch.  The example below is for Putty which is already installed:

Open Absolute Telnet and click the New Tab button then click the Options menu option and select the Properties menu choice. 

An option box will pop up where you can set your COM port’s configuration. Click the Direct to COM tab and click the Configure Port button and another window will pop up allowing you to set the COM port’s parameters.

Now set The Bits per second to 9600 and change the Flow control to None, Click OK and then click OK again.

You are now all set to start the upgrading process.

Updating the IOS on the Cisco Device

Now that you have a COM session open in your terminal program, be sure that the console cable is connected to your PC’s serial port or an USB to Serial adapter and the other end in plugged into the switch or other device.

Now that we are all connected up let’s power up the switch and make sure it is communicating with the terminal program properly.  The switch will begin to write to the screen.  Some devices may take 15 to 30 seconds before the display anything to the screen.  If you do not see anything after a minute or so, please go back and check your settings for your COM port.  One other possibility that could cause a problem, if you received your Cisco device from someone else, they may have changed the baud rate the port communicates at.  Try different baud rates until you see normal text.  If you need to reset the device to factory default, that is covered in another lab.

        — System Configuration Dialog —

Would you like to enter the initial configuration dialog? [yes/no]: 

% Please answer ‘yes’ or ‘no’.

Would you like to enter the initial configuration dialog? [yes/no]: n Switch>

As you can see from the output above, our switch is communicating properly and that there is no configuration currently configured on the device.  If your device comes up and asks for a password, enter the password to proceed.  If you do not know the password, you will need to do a password-recover procedure which is covered in another lab.

First, we need to put the switch in the enable mode and we need to put it in the configurator global mode.   Enter the following commands on the switch:

     switch>en

Switch#

Before we begin configuring the switch or router, let’s see which version of the IOS is currently installed.  We do this with the show version command and press enter.

Switch#show version

Cisco IOS Software, C2960 Software (C2960-LANLITE-M), Version 12.2(44)SE1, RELEASE SOFTWARE (fc1)

Copyright (c) 1986-2008 by Cisco Systems, Inc.

Compiled Thu 06-Mar-08 21:10 by weiliu

Image text-base: 0x00003000, data-base: 0x00E00000

ROM: Bootstrap program is C2960 boot loader

BOOTLDR: C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(44r)SE1, RELEASE SOFTWARE

(fc2)

Switch uptime is 3 minutes

System returned to ROM by power-on

System image file is “flash:c2960-lanlite-mz.122-44.SE1/c2960-lanlite-mz.122-

44.SE1.bin”  cisco WS-C2960-24-S (PowerPC405) processor (revision C0) with 61440K/4088K bytes of memory.

Processor board ID FOC1316Y2JU

Last reset from power-on

1 Virtual Ethernet interface

24 FastEthernet interfaces

The password-recovery mechanism is enabled.

 –More– 

*Mar  1 00:03:03.165: %LINK-5-CHANGED: Interface Vlan1, changed state to administrat64K bytes of flash-simulated non-volatile configuration memory.

Base ethernet MAC Address       : 00:25:83:99:7A:80

Motherboard assembly number     : 73-11471-05

Power supply part number        : 341-0097-02

Motherboard serial number       : FOC13163KXX

Power supply serial number      : AZS13131216

Model revision number           : C0

Motherboard revision number     : A0

Model number                    : WS-C2960-24-S

System serial number            : FOC1316Y2JU

Top Assembly Part Number        : 800-29858-02

Top Assembly Revision Number    : B0

Version ID                      : V03

CLEI Code Number                : COMSJ00ARC

Hardware Board Revision Number  : 0x01

Switch Ports Model              SW Version            SW Image                 

—— —– —–              ———-            ———-                *    1 24    WS-C2960-24-S      12.2(44)SE1           C2960-LANLITE-M           

Configuration register is 0xF

From the output above we can see that this switch is currently running IOS version 12.2(44) LanLite. 

Another command we can run to see which versions of the IOS are loaded onto the device is the good ole dir command.

Switch#dir

Directory of flash:/

    2  drwx         512   Mar 1 1993 00:05:28 +00:00  c2960-lanlite-mz.122-44.SE1 

27998208 bytes total (18804736 bytes free)

Now that we know the current IOS version, we may want to upgrade/update it.  To find out what IOS versions are available for our device, we can go to Cisco’s website and see all the different versions.  The website is called Cisco Feature Navigator and can be found at http://cfn.cloudapps.cisco.com/ITDIT/CFN/jsp/index.jsp

From this website, we can learn a lot about the different versions of the IOS and other things.  Select the Research Software  button. 

On this page, we select the Software Type which for us is IOS.  Next select the Platform radio button in the Search By box then click in the Platform dropdown box and find your device.  There may be more than one option for your device.  In our example, we are looking up which IOS files are available for the Cisco C2960-24-S switch. 

There are several options with 2960.  The first one lists mostly Lan Base versions.  You can try different versions of the IOS but please note that not all versions will run on a device even though you would think it would.  For instance, the Lan Base version will not run on the C2960-24-S switches while it will run on the C2960-24-TT-L switch.  We need to run the LanLite version on the C2960-24-S switch if we want IOS version 15.

You can click on an IOS version and then click the View Image Details button to see which features that version supports.

Now here is the bad news:  You cannot just download the version of the IOS that you want from Cisco’s website unless you have a Cisco support contract. UGGGG.  Sorry, but there is no legal way around this.  The good news for you is that you may already know a source for many IOS files as they are out there on the web.  

Now that you have located the new version of the IOS that you want to install and have placed a copy on your PC where the TFTP server program is running, we can begin the upgrade process.

From your terminal program, we need set an IP address on the Ethernet port that is connected to your PC.  For a switch the port is VLAN 1 and for a router it may be Ethernet port fa0/0 or gi0/0.  You can use the show run command to see a list of ports on your device.

Configure the Device’s IP Address and testing:

To configure the IP address on the switch’s VLAN 1, enter the following commands:

Switch#conf t

Switch(config)#int vlan 1

Switch(config-if)#

Switch(config-if)#ip add 192.168.0.2 255.255.255.0 Switch(config-if)#no shut

Router#conf t   router(config)#int fa0/0

     router(config-if)#ip address 192.168.0.2 255.255.255.0 router(config-if)#no shut

 Be sure to use a crossover Ethernet cable when connecting a PC directly to a router.

The first command, conf t, placed the device in the global configuration mode and then we select the interface that we wish to configure with the int xxx command. The next command assigns an IP address to the port and then we follow that by turning on the port with the no shut command.

Before going any further, we need to test the connection to the PC by using the ping command and pinging the PC’s IP address.

router#ping 192.168.0.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

If you do not get a successful ping response, go back and check you PC’s IP address and subnet mast as well as the default gateway which should be the Cisco device’s IP address.  Also check your Ethernet cable to be sure that you are using the correct type, straight-through or crossover.  Try more than one cable as the cable itself may be defective.

There are two types of IOS files that can be uploaded to a Cisco device, a .bin file which is only the IOS file and a .tar file  which can contain from one to many files.  We will cover both types of files and their uploading in this lab.

The first method we will look at is working with .tar files and the archive command.

The archive command can compress the files into a single .tar file (not covered in this lab) and decompress the files and place them in their intended directories.  

In this example, we will be updating the IOS from version c2960-lanlite-mz.122-44.SE1 to c2960-lanlitek9-mz.150-2.SE4. 

When we did the dir command above we saw that we had 18804736 bytes free on the flash disk and the file size of the .tar file is 24,695,808 bytes, just not enough room for both.

You can have more than one version of an IOS loaded on a Cisco device and the device will select one automatically if you have not set the BOOT command to a specific version.  More on that later.

To clear all of the files and directories from the device’s flash drive easily, we use the delete command with a few switches set.  Enter the command below and change the filename to match the device’s current file.

Switch#delete /recursive /force flash:c2960-lanlite-mz.122-44.SE1

DO NOT TURN OFF THE DEVICE!!!!

If you accidently lose power to the device you will have to load the IOS via the console cable.  This is a MUCH slower process and is covered in another lab.

Once you do this, issue the dir command again to be sure that all files and directories have been deleted.  

Switch#dir

Directory of flash:/

  540  -rwx         616   Mar 1 1993 00:14:21 +00:00  vlan.dat

27998208 bytes total (27995648 bytes free)

Do not delete the vlan.dat file!  That file holds the device’s IP address configuration.

To upload the new IOS we use the archive command and set a few switches telling it where our IOS file is located and its name.

Uploading via the Archive Command:

Issue the archive command followed by telling it we are working with a tar file. Set the switch /xtract so archive knows that we are decompressing the file. Next, we tell the system we are going to be using the tftp protocol to download the file with and the tftp server’s IP address as well as the name of the file to download.  Lastly, we tell the archive command to place these files onto the flash: drive.   Once the file has been downloaded to the flash drive, it will automatically start decompressing.  This will take a few minutes.

Switch#archive tar /xtract tftp://192.168.0.1/c2960-lanlitek9-mz.150-2.SE4.tar flash:

Switch#archive tar /xtract tftp://192.168.0.1/c2960-lanlitek9-mz.150-2.SE4.tar flashL: Loading c2960-lanlitek9-mz.150-2.SE4.tar from 192.168.69.223 (via Vlan69): ! c2960-lanlitek9-mz.150-2.SE4/ (directory) — unable to create (No such device) extracting c2960-lanlitek9-mz.150-2.SE4.bin (10155308 bytes)

%Error opening flashL:/c2960-lanlitek9-mz.150-2.SE4.bin (No such device) Switch#$ftp://192.168.69.223/c2960-lanlitek9-mz.150-2.SE4.tar flash:  Loading c2960-lanlitek9-mz.150-2.SE4.tar from 192.168.69.223 (via Vlan69): ! c2960-lanlitek9-mz.150-2.SE4/ (directory) extracting c2960-lanlitek9-mz.150-2.SE4.bin (10155308 bytes)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

extracting c2960-lanlitek9-mz.150-2.SE4/c2960-lanlitek9-mz.150-2.SE4.bin (10155308 bytes)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! c2960-lanlitek9-mz.150-2.SE4/html/ (directory) extracting c2960-lanlitek9-mz.150-2.SE4/html/ajax.js (28354 bytes) extracting c2960-lanlitek9-mz.150-2.SE4/html/appsui.js (1749 bytes)

…..

extracting c2960-lanlitek9-mz.150-2.SE4/html/zh/troubleshooting_OS.htm (3090 bytes) extracting c2960-lanlitek9-mz.150-2.SE4/html/zh/xhome_new.htm (5360 bytes) [OK – 24695808 bytes]

Verifying the upload:

Now that the files have been downloaded and decompressed onto the flash drive, issue the dir command to verify that the files were correctly installed.

Switch#dir

Directory of flash:/

  540  -rwx         616   Mar 1 1993 00:14:21 +00:00  vlan.dat

    2  drwx         512   Mar 1 1993 02:50:18 +00:00  c2960-lanlitek9-mz.150-2.SE4     3  -rwx    10155308   Mar 1 1993 02:50:18 +00:00  c2960-lanlitek9-mz.150-2.SE4.bin 

27998208 bytes total (3096576 bytes free) Switch#

At this time, we can now delete the vlan.dat file.

Switch#delete vlan.dat

Setting the Default IOS BOOT File:

Before we reboot the device with its new IOS, we should, but do not have to, set the BOOT variable to the new IOS.  This will vary from device to device.  In our example we’ll issue the following command to see the current BOOT configuration:

Switch#show boot

BOOT path-list      : flash:c2960-lanlite-mz.122-44.SE1/c2960-lanlite-mz.12244.SE1.bin

Config file         : flash:/config.text

Private Config file : flash:/private-config.text

Enable Break        : no

Manual Boot         : no Allow Dev Key         : yes

HELPER path-list    : 

Auto upgrade        : yes

Auto upgrade path   :  NVRAM/Config file       buffer size:   65536

Timeout for Config

          Download:    0 seconds Config Download         via DHCP:       disabled (next boot: disabled)

The only variable above we want to change is the IOS file.  To do that enter the following commands:

Switch#

Switch (config)#boot system flash: c2960-lanlitek9-mz.150-2.SE4/ c2960-lanlitek9mz.150-2.SE4.bin

Now let’s verify that the change has been made with another show boot command.

Switch#show boot

BOOT path-list      : flash: c2960-lanlitek9-mz.150-2.SE4/ c2960-lanlitek9-mz.1502.SE4.bin

Config file         : flash:/config.text

Private Config file : flash:/private-config.text

Enable Break        : no

Manual Boot         : no Allow Dev Key         : yes

HELPER path-list    : 

Auto upgrade        : yes

Auto upgrade path   :  NVRAM/Config file       buffer size:   65536

Timeout for Config

          Download:    0 seconds

Config Download 

       via DHCP:       disabled (next boot: disabled)

Rebooting the Cisco Device and Final Verification:

We are now ready to reboot the switch and verify that it is working properly.  Issue the reload command.  The device will tell you that the configuration has change and if you want to save the changed.  Just say no and continue with the reboot process.

When the switch or other Cisco device boots up, it will ask you if you would like to enter the configuration mode, answer no and press enter.

        — System Configuration Dialog —

Would you like to enter the initial configuration dialog? [yes/no]: 

% Please answer ‘yes’ or ‘no’.

Would you like to enter the initial configuration dialog? [yes/no]: n Switch>

From the device’s prompt enter the show version command to be sure that it booted the new IOS we loaded.

Switch#sh ver

Cisco IOS Software, C2960 Software (C2960-LANLITEK9-M), Version 15.0(2)SE4, RELEASE SOFTWARE (fc1)

Technical Support: http://www.cisco.com/techsupport

Copyright (c) 1986-2013 by Cisco Systems, Inc. Compiled Wed 26-Jun-13 02:49 by prod_rel_team

ROM: Bootstrap program is C2960 boot loader

BOOTLDR: C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(44r)SE1, RELEASE SOFTWARE

(fc2)

Switch uptime is 1 minute

System returned to ROM by power-on

System image file is “flash:/c2960-lanlitek9-mz.150-2.SE4/c2960-lanlitek9-mz.150-

2.SE4.bin

This product contains cryptographic features and is subject to United States and local country laws governing import, export, transfer and use. Delivery of Cisco cryptographic products does not imply third-party authority to import, export, distribute or use encryption. Importers, exporters, distributors and users are responsible for compliance with U.S. and local country laws. By using this product you agree to comply with applicable laws and regulations. If you are unable to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:

http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to export@cisco.com.

 cisco WS-C2960-24-S (PowerPC405) processor (revision C0) with 65536K bytes of memory.

Processor board ID FOC1316Y2MR

Last reset from power-on

1 Virtual Ethernet interface

24 FastEthernet interfaces

The password-recovery mechanism is enabled.

64K bytes of flash-simulated non-volatile configuration memory.

Base ethernet MAC Address       : 00:25:83:9A:BB:00

Motherboard assembly number     : 73-11471-05

Power supply part number        : 341-0097-02

Motherboard serial number       : FOC13162S11

Power supply serial number      : AZS13131201

Model revision number           : C0

Motherboard revision number     : A0

Model number                    : WS-C2960-24-S

System serial number            : FOC1316Y2MR

Top Assembly Part Number        : 800-29858-02

Top Assembly Revision Number    : B0

Version ID                      : V03

CLEI Code Number                : COMSJ00ARC

Hardware Board Revision Number  : 0x01

Switch Ports Model              SW Version            SW Image                 

—— —– —–              ———-            ———-                *    1 24    WS-C2960-24-S      15.0(2)SE4            C2960-LANLITEK9-M        

Configuration register is 0xF

 As you can see from the output above, our switch was updated with the 15.0 LanLite IOS version as we wanted and it is ready to be configured for our lab kit and studies.

Uploading via the Copy Command:

In this section we will use the copy command to place the new IOS file onto the flash drive.  We still need to configure and IP address and remove the old IOS file.  Follow all the directions above except the archive command.  When you get to the archive step, drop down here to learn how to copy a single file to the flash drive.

The commands below will download the new IOS version we want on to the switch. Enter the copy command followed by where to get the file from (source) and then we tell the router where to save the file destination). The router will then prompt us for the IP address of the tftp server and we enter 192.168.0.1.  Next we are prompted for the source filename which is our new IOS.  Be careful to enter the filename exactly as it is in the tftp upload directory on the PC.  When you are prompted for the destination filename, just press the enter key. The final step is to confirm the erasing of the system flash: before copying by pressing enter.  You will be asked to confirm erasing the flash a second time, again, just press the enter key.

     Switch#copy tftp: flash:

     Address or name of the remote host[]? 192.168.0.1

     Source filename[]? c2960-lanlitek9-mz.150-2.SE4.bin

     Destination filename [c2960-lanlitek9-mz.150-2.SE4.bin enter

     Accessing tftp://192.168.0.1/c2960-lanlitek9-mz.150-2.SE4.bin

     Erase flash: before copying [confirm] enter

   Erasing the flash filesystem will remove aal files! Continue? [confirm] enter

At this point the router or switch will begin erasing current filesystem for the device. If for some reason your device seems stuck at the Accessing tftp://192.168.0.1/c2960-lanlitek9-mz.150-2.SE4.bin process, bring up your tftp application and stop the server then re-start the tftp server.  

Erasing device… eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Erase of flash: complete

Loading c2960-lanlitek9-mz.150-2.SE4.bin from 192.168.0.1 (via 

     FastEthernet0/0): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[OK – 10155308 bytes]

Verifying checksum…. OK

The output above from the switch and the screenshot from the PC confirm that an upload to the router has taken place. Depending on the file size and your Ethernet connection speed, this process may take a little while. Once the checksum completes you are returned to the Switch# prompt.

Now go back to the section just after the archive command to verify that the new IOS is loaded and update the BOOT variable.

Please post your comments about this lab below.

Thank You,

Leave a Reply

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