Booting a Different IOS Image


You want to boot using an alternate IOS image.


To specify which IOS image the router should load next time it reboots, use the boot system command:

Router1#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#boot system flash:c3620-jk9o3s-mz.122-7a.bin
Router1(config)#boot system flash:c3620-jos56i-l.120-11.bin
Router1(config)#boot system slot0:c3620-ik9s-mz.122-13.bin
Router1(config)#boot system rom

The sequence of the boot system commands is extremely important, as the router will attempt to load the IOS images in the order that they appear in the configuration file.



The router can store as many IOS images in its flash memory as there is space to hold. If there is only one file, it can safely assume that this must be the IOS image to load. However, if the router has several images in its flash storage, you need to specify which one it should load, or the router will simply select one. This is particularly true on routers that have additional flash memory in the form of PCMCIA cards, which can hold many files, not all of which are even necessarily IOS images.

With the default configuration register settings, the router will attempt to load the first accessible IOS image it finds in its flash storage. However, loading the first available image might not be appropriate. For instance, in our last recipe we showed that, if you have space, you can download a new IOS image without erasing old images. In this case, you probably want the router to load the newer IOS image. And it would be better still if the router would try the new image first, and revert to the old image if the first one failed to load correctly for any reason. The boot system command allows you to specify not only which IOS images to boot from, but also the order to try them in if it has trouble booting.

In the example, this router will try a succession of three different IOS images. If they all fail, it will resort to using its boot ROM image.

As we noted earlier, the sequence of the boot system commands is important since the router will attempt to load the IOS images in order of entry. This means that the only way to add a new IOS image to load is to remove all of the old boot system commands and reenter them again in the order of preference. You can remove all of the boot system commands at once with the following command:

Router1#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#no boot system

Once the old boot system commands have been removed, you can configure a new set in whatever order you require.

In addition to allowing you to boot from IOS images in the router's flash storage, you can also use the the boot system to boot from the IOS image in its ROM storage, or even using the TFTP or Remote Copy (RCP) protocols across the network. Recipe 1.8 shows an example of booting across the network, using TFTP. Table 1-1 shows all of the different options for the boot system command.

Table 1-1. Boot system command target options

Keyword Description
flash: On-board flash
slot0: PCMCIA flash card in slot0
slot1: PCMCIA flash card in slot1
mop: Load an image using the MOP protocol
bootflash: Load bootflash image (not available on all systems)
rom: Load the image from ROM
rcp: Load an image using the remote copy protocol
tftp: Load an image using the TFTP protocol
ftp: Load an image using the FTP protocol

In addition to the boot system commands, you can change which image the router will boot from using the router's configuration register. The last octet in the configuration register must be set to 2, or the router will ignore the boot system commands completely. For instance, if the last octet of the configuration register is set to 1, the router will boot from ROM and ignore the boot system commands. In our example, the test router's configuration register was set to 0x2102. The config-register command allows you to set the appropriate configuration register values:

Router1#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#config-register 0x2102

It is important to remember that unlike any other configuration command, you don't need to save the running configuration to NVRAM when you change the configuration register setting. It will survive a reload without being saved. In fact, the new setting will not take effect until after the next reload:

Router1#show version
Cisco Internetwork Operating System Software
IOS (tm) 3000 Bootstrap Software (IGS-RXBOOT), Version 10.2(8a), RELEASE SOFTWAR
E (fc1)
Copyright (c) 1986-1995 by cisco Systems, Inc.
Compiled Tue 24-Oct-95 15:46 by mkamson
Image text-base: 0x01020000, data-base: 0x00001000

ROM: System Bootstrap, Version 5.2(8a), RELEASE SOFTWARE

Router1 uptime is 2 minutes
System restarted by reload
Running default software

cisco 2500 (68030) processor (revision D) with 16380K/2048K bytes of memory.
Processor board serial number 04915359 with hardware revision 00000000
X.25 software, Version 2.0, NET2, BFE and GOSIP compliant.
2 Ethernet/IEEE 802.3 interfaces.
2 Serial network interfaces.
32K bytes of nonvolatile configuration memory.
16384K bytes of processor board System flash (Read/Write)

Configuration register is 0x2101 (will be 0x2102 at next reload)


After setting the appropriate boot system commands and reloading the router, you can see which image file the router used to boot with the show version command:

Router2#show version
Cisco Internetwork Operating System Software 
IOS (tm) 3600 Software (C3620-IK9S-M), Version 12.2(13), RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2002 by cisco Systems, Inc.
Compiled Tue 19-Nov-02 19:04 by pwade
Image text-base: 0x60008930, data-base: 0x61276000

ROM: System Bootstrap, Version 11.1(19)AA, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1)

Router2 uptime is 2 hours, 4 minutes
System returned to ROM by reload
System restarted at 21:13:13 EST Wed Jan 15 2003
System image file is "slot0:c3620-ik9s-mz.122-13.bin"

cisco 3620 (R4700) processor (revision 0x81) with 41984K/7168K bytes of memory.
Processor board ID 05969532
R4700 CPU at 80Mhz, Implementation 33, Rev 1.0
Bridging software.
X.25 software, Version 3.0.0.
SuperLAT software (copyright 1990 by Meridian Technology Corp).
Basic Rate ISDN software, Version 1.1.
1 Ethernet/IEEE 802.3 interface(s)
1 FastEthernet/IEEE 802.3 interface(s)
1 Serial network interface(s)
1 ISDN Basic Rate interface(s)
DRAM configuration is 32 bits wide with parity disabled.
29K bytes of nonvolatile configuration memory.
16384K bytes of processor board System flash (Read/Write)
16384K bytes of processor board PCMCIA Slot0 flash (Read/Write)
16384K bytes of processor board PCMCIA Slot1 flash (Read/Write)

Configuration register is 0x2102


In this case, the router says that it loaded its IOS image from slot0:, as configured. After changing your boot system commands, you should be sure to reboot and verify that it behaved as expected. You don't want the wrong IOS image to accidentally get loaded the next time the router reboots. If you do have problems with the boot system command, connect to the console and reload the router. This will display any error messages as the router boots. The router does not capture these messages anywhere, so this is the only way to see them.

Beginning with IOS Version 12.3(4)T, Cisco introduced the concept of boot markers. Essentially, all boot system command lines are now placed between two permanent boot markers located within the configuration file. These markers cannot be erased and make locating the boot system commands easy. The following is an example of a router using boot markers:

Router1#show running-config | include ^boot
boot system slot0:c3745-ipbasek9-mz.124-6.T.bin
boot system slot0:c3745-ipbasek9-mz.124-7.bin
boot system flash:

Notice that all of the boot system commands have been automatically placed between the start boot marker and the end boot marker. The files are also listed in order of boot preference. If you don't configure the router with explicit boot system commands, then the router will load the first available IOS image in flash by default. In this case, the boot markers will still appear in the configuration file, but no boot system commands will accompany them:

Router2#show running-config | include ^boot


See Also

Recipe 1.6; Recipe 1.8

Router Configuration and File Management

Router Management

User Access and Privilege Levels


IP Routing





Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time


Router Interfaces and Media

Simple Network Management Protocol





First Hop Redundancy Protocols

IP Multicast

IP Mobility




Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications


show all menu

Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net