Friday, June 26, 2015

Switch IOS update using .bin file via TFTP

An alternative option of updating my lab switches using a .bin IOS image.
I prefer this method as using the tar via archive download-sw  takes time.


(connect any port on the switch to my home router)
Switch(config)#int vlan 1
Switch(config-if)#ip address dhcp
Switch(config-if)#no shut
Switch(config-if)#

*Mar  1 00:02:51.370: %LINK-3-UPDOWN: Interface Vlan1, changed state to up
*Mar  1 00:02:51.379: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
Switch(config-if)#
*Mar  1 00:02:57.511: %DHCP-6-ADDRESS_ASSIGN: Interface Vlan1 assigned DHCP address 192.168.254.14, mask 255.255.255.0, hostname Switch

Old IOS backup (optional)
The .bin file i have to backup is in a directory

Switch#dir flash:
Directory of flash:/

    2  drwx        3072  Apr 10 1993 18:14:10 +00:00  crashinfo_ext
   41  -rwx        1920   Mar 1 1993 00:01:22 +00:00  private-config.text
   42  drwx         512   Mar 1 1993 00:08:39 +00:00  c2960-lanlitek9-mz.122-50.SE2
  597  -rwx        2072   Mar 1 1993 00:01:22 +00:00  multiple-fs
  598  drwx       18432   Mar 1 1993 00:00:09 +00:00  crashinfo

To get the complete path of the image file:

Switch#dir flash://c2960-lanlitek9-mz.122-50.SE2
Directory of flash:/c2960-lanlitek9-mz.122-50.SE2/

   43  drwx        5632   Mar 1 1993 00:04:39 +00:00  html
  595  -rwx     7353624   Mar 1 1993 00:06:09 +00:00  c2960-lanlitek9-mz.122-50.SE2.bin
  596  -rwx         426   Mar 1 1993 00:08:39 +00:00  info

 This is the complete command:
Switch#copy flash:/c2960-lanlitek9-mz.122-50.SE2/c2960-lanlitek9-mz.122-50.SE2.bin tftp:

Address or name of remote host []? 192.168.254.5
Destination filename [c2960-lanlitek9-mz.122-50.SE2.bin]?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7353624 bytes copied in 19.738 secs (372562 bytes/sec)

Then delete the directory containing the old image to free some space:
Switch#delete /force /recursive flash:/c2960-lanlitek9-mz.122-50.SE2

Download the recommended update from TFTP server:

Switch#copy tftp:/c2960-lanlitek9-mz.122-55.SE10.bin flash:
Address or name of remote host []? 192.168.254.5
Destination filename [c2960-lanlitek9-mz.122-55.SE10.bin]?
Accessing tftp://192.168.254.5//c2960-lanlitek9-mz.122-55.SE10.bin...
 Loading /c2960-lanlitek9-mz.122-55.SE10.bin from 192.168.254.5 (via Vlan1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 8107679 bytes]

8107679 bytes copied in 119.412 secs (67897 bytes/sec)

Note: Adjust the TFTP server timeout to avoid timeout errors and out of sequence packets.

Loading /c2960-lanlitek9-mz.122-55.SE10.bin from 192.168.254.5 (via Vlan1): !OOO!OOOO!OOOO!OOOO!OOOO!OOOO!OOOO!OOOO!OOOO!OOOO!OOO!OOOO!OOOO!OOOO!OOOO!OOOO!OOOO!OOOOOO!OOOOOOOO!OOOOOOOOOOOO!OOOOOOOOOOOOOOOO... [timed out]



And last step, modify the boot parameters as i have deleted the old IOS:
 Note that the current boot path is still pointing to the deleted image.
 Switch#show boot
BOOT path-list      : flash:/c2960-lanlitek9-mz.122-50.SE2/c2960-lanlitek9-mz.122-50.SE2.bin
Config file         : flash:/config.text
Private Config file : flash:/private-config.text
Enable Break        : no
Manual Boot         : no
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 new Image, recently loaded.
Switch#dir flash:
Directory of flash:/

   42  -rwx     8107679   Mar 1 1993 00:49:32 +00:00  c2960-lanlitek9-mz.122-55.SE10.bin
    2  drwx        3072  Apr 10 1993 18:14:10 +00:00  crashinfo_ext
   41  -rwx        1920   Mar 1 1993 00:01:22 +00:00  private-config.text
  597  -rwx        2072   Mar 1 1993 00:01:22 +00:00  multiple-fs
  598  drwx       18432   Mar 1 1993 00:00:09 +00:00  crashinfo

Switch(config)#boot system flash:/c2960-lanlitek9-mz.122-55.SE10.bin
Switch(config)#^Z
Switch#wr mem
*Mar  1 01:20:31.024: %SYS-5-CONFIG_I: Configured from console by console
Building configuration...
[OK]
Switch#show boot
BOOT path-list      : flash:/c2960-lanlitek9-mz.122-55.SE10.bin
Config file         : flash:/config.text
Private Config file : flash:/private-config.text


Reload to boot the new IOS:

Switch#reload
Proceed with reload? [confirm]

*Mar  1 01:21:20.139: %SYS-5-RELOAD: Reload requested by console. Reload reason: Reload command
Using driver version 1 for media type 1
Base ethernet MAC Address: 3c:df:1e:08:af:00
Xmodem file system is available.
The password-recovery mechanism is enabled.
Initializing Flash...

Switch Ports Model              SW Version            SW Image
------ ----- -----              ----------            ----------
*    1 26    WS-C2960-24LC-S    12.2(55)SE10          C2960-LANLITEK9-M

Done, this procedures works for 3750 and 3560 switches too.


No comments:

Post a Comment