Cisco交换机升级IOS的具体方法
Cisco交换机的IOS升级,其实挺简单的,但是需要注意的是,不能让交换机flash存储为空,一定要有一个IOS在,否则没有IOS在flash里面,等着用xmodem上传IOS吧,那样你的时间可以是废了很多啊。因为对于Cisco Catalyst 2950、2960、3550交换机丢失IOS或IOS故障时,是无法使用rommon模式的,因为压根儿就没有,只有Cisco Catalyst 4006、4506才有rommon模式,本篇文章以Cisco Catalyst 2950为例。
1、首先下载TFTP Server,如何使用这里就不多说了,不明白的可以看这里,进入特权模式,配置端口ip,以便交换机与tftp服务器相连接。
- Switch>en ——进入特权模式
 - Switch#conf t ——进入全局配置模式
 - Enter configuration commands, one per line. End with CNTL/Z.
 - Switch(config)#int vlan 1 ——进入端口vlan 1
 - Switch(config-if)#ip add 10.0.23.112 255.255.255.0 ——-配置vlan 1的ip地址为10.0.23.112
 
2、测试一下tftp服务器与交换机之间的网络连接是否畅通,畅通后,我们在交换机下查看flash情况。
- Switch#show flash: ——-显示flash下的信息
 - Directory of flash:/
 - 2 -rwx 3122176 Mar 01 1993 00:34:02 +00:00c2950-i6q4l2-mz.121-22.EA9 ——–现在所使用的IOS文件
 - .bin
 - 3 -rwx 5 Mar 01 1993 00:01:17 +00:00 private-config.text
 - 5 -rwx 1148 Mar 01 1993 00:01:17 +00:00 config.text
 - 7741440 bytes total (4616192 bytes free)
 
3、上传新的IOS文件到交换机的flash存储中。将新的交换机IOS文件放入tftp服务器的根目录下。如果复制过程中出现not enough spaces提示,请先删除原来的IOS文件,如何删除IOS文件这里就不再提了,请访问这里参阅。
- Switch#copy tftp flash: ——-从tftp拷贝文件到flash存储中
 - Address or name of remote host []? 10.0.23.4 ——tftp服务器ip地址
 - Source filename []? c2950-i6k2l2q4-mz.121-22.EA14.bin ——–要从tftp服务器中拷贝的文件名称
 - Destination filename [c2950-i6k2l2q4-mz.121-22.EA14.bin]? ——–保存到flash中的文件名称,可以直接回车
 - Accessing tftp://10.0.23.4/c2950-i6k2l2q4-mz.121-22.EA14.bin…
 - Loading c2950-i6k2l2q4-mz.121-22.EA14.bin from 10.0.23.4 (via Vlan1):!!!!!!!!!!
 - 3722814 bytes copied in 87.708 secs (42446bytes/sec)
 
4、此时在我的交换机flash存储中就有了两个IOS文件,如果由于flash空间造成的只有一个新的IOS文件,默认重启是会自动加载新的IOS文件,直至正常启动,配置不会丢失,如果有两个IOS文件,此时我们就需要进行手动加载新的IOS设置。先把交换机断电,按住交换机的“mode”按钮,通常在交换机的正面,加电,此时不要松开“mode”按钮,会进入以下模式。
- C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1)
 - Compiled Mon 22-Jul-02 18:57 by antonino
 - WS-C2950-24 starting…
 - Base ethernet MAC Address: 00:07:eb:85:0a:40
 - Xmodem file system is available.
 - The system has been interrupted prior toinitializing the
 - flash filesystem. The following commands will initialize
 - the flash filesystem, and finish loading the operating
 - system software:
 - flash_init
 - load_helper
 - boot
 - switch:
 
5、配置初始化flash
- switch: flash_init ——初始化flash
 - Initializing Flash…
 - flashfs[0]: 4 files, 1 directories
 - flashfs[0]: 0 orphaned files, 0 orphaned directories
 - flashfs[0]: Total bytes: 7741440
 - flashfs[0]: Bytes used: 6848512
 - flashfs[0]: Bytes available: 892928
 - flashfs[0]: flashfs fsck took 8 seconds.
 - …done initializing flash.
 - Boot Sector Filesystem (bs:) installed, fsid: 3
 - Parameter Block Filesystem (pb:) installed, fsid: 4
 - switch: dir flash: ——-显示flash下的文件
 - Directory of flash:/
 - 2 -rwx3122176 c2950-i6q4l2-mz.121-22.EA9.bin
 - 3 -rwx 5 private-config.text
 - 4 -rwx 3722814 c2950-i6k2l2q4-mz.121-22.EA14.bin
 - 5 -rwx 1148 config.text
 - 892928 bytes available (6848512 bytes used)
 - switch: boot flash:c2950-i6k2l2q4-mz.121-22.EA14.bin ———指定新的IOS文件启动。
 
6、回车后加载新的IOS文件,直至进入系统。
- Loading “flash:c2950-i6k2l2q4-mz.121-22.EA14.bin”…############################
 - File“flash:c2950-i6k2l2q4-mz.121-22.EA14.bin” uncompressed and installed, entry
 - point: 0x80010000
 - executing…
 - Restricted Rights Legend
 - Use, duplication, or disclosure by theGovernment is
 - subject to restrictions as set forth in subparagraph
 - (c) of the Commercial Computer Software – Restricted
 - Rights clause at FAR sec. 52.227-19 and subparagraph
 - (c) (1) (ii) of the Rights in Technical Data and Computer
 - Software clause at DFARS sec. 252.227-7013.
 - cisco Systems, Inc.
 - 170 West Tasman Drive
 - San Jose, California 95134-1706
 - Cisco Internetwork Operating SystemSoftware
 - IOS C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA14, RELEASE SOFTWA
 - RE (fc1)
 - Technical Support: http://www.cisco.com/techsupport
 - Copyright (c) 1986-2010 by cisco Systems, Inc.
 - Compiled Tue 26-Oct-10 10:35 by nburra
 - Image text-base: 0x80010000, data-base: 0x80680000
 - Initializing flashfs…
 - flashfs[1]: 4 files, 1 directories
 - flashfs[1]: 0 orphaned files, 0 orphaned directories
 - flashfs[1]: Total bytes: 7741440
 - flashfs[1]: Bytes used: 6848512
 - flashfs[1]: Bytes available: 892928
 - flashfs[1]: flashfs fsck took 8 seconds.
 - flashfs[1]: Initialization complete.
 - Done initializing flashfs.
 - POST: System Board Test : Passed
 - POST: Ethernet Controller Test : Passed
 - ASIC Initialization Passed
 - POST: FRONT-END LOOPBACK TEST : Passed
 - 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 Ciscocryptographic products may be found at:
 - http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
 - If you require further assistance pleasecontact us by sending email to
 - export@cisco.com.
 - cisco WS-C2950-24 (RC32300) processor(revision B0) with 19911K bytes of memory.
 - Processor board ID FOC0545X02G
 - Last reset from system-reset
 - Running Standard Image
 - 24 FastEthernet/IEEE 802.3 interface(s)
 - 32K bytes of flash-simulated non-volatileconfiguration memory.
 - Base ethernet MAC Address: 00:07:EB:85:0A:40
 - Motherboard assembly number: 73-5781-08
 - Power supply part number: 34-0965-01
 - Motherboard serial number: FOC0545034T
 - Power supply serial number: PHI054201CT
 - Model revision number: B0
 - Model number: WS-C2950-24
 - System serial number: FOC0545X02G
 - PressRETURN to get started!
 
7、安装成功后,查看配置,一般都不会丢失,如果没有什么问题,就可以删除之前的IOS文件了。
- Switch#delete flash:
 - Delete filename []? c2950-i6q4l2-mz.121-22.EA9.bin
 - Delete flash:c2950-i6q4l2-mz.121-22.EA9.bin? [confirm]
 
大功告成,切记在没有IOS的情况下不要重启交换机,那样就只能用xmodem上传IOS了,很是费时间的差事。