Cisco IOS Boot System Image

When you power on a Cisco IOS router, it will take the following steps:

  1. Perform a POST (Power on self test) to discover the hardware and to check if the hardware is working properly.
  2. Copy a bootstrap program from ROM into the RAM, run the bootstrap program.
  3. The bootstrap program looks for the first IOS image on the flash memory, extracts it into RAM and boots the IOS image. When there is no IOS image, it will boot into ROMMON.
  4. When IOS has loaded, it will look for the startup-config file on the NVRAM. If there is none, it will show you a wizard asking you if you want to configure the router.
ROMMON is a very simple OS with a few features. One of the things it is used for is to copy an IOS image to the flash memory in case you accidentally deleted it. You can also use it for password recovery.

There is nothing we can change in step 1 and 2 but we are able to make some changes to step 3 and 4. It’s possible to configure the router so that it will look for an IOS image in another location, like a TFTP server on your network. You can also configure the router so that it looks for the startup-config somewhere else.

Let’s see how we can configure the router to boot another IOS image.

Default Boot Option

Which IOS image the router wants to use depends on two options:

The default value of the configuration register is 0x2101:

Router#show version | include register
Configuration register is 0x2101

You can find the meaning of the bits in this Cisco document. The first 4 bits define where the router will look for the IOS image. The default value is 0001 which means that it will use the first IOS image that it finds on the flash memory.

Let’s see what is on our flash memory:

Router#show flash: | include c2800
12    67926080 Apr 2 2015 14:21:46 +00:00 c2800nm-adventerprisek9-mz.151-4.M10.bin
29    67929600 Nov 4 2016 12:11:22 +00:00 c2800nm-adventerprisek9-mz.151-4.M12a.bin

There are two images. Cisco IOS uses a number for each filename and will prefer the lowest file number. We can see which image was booted:

Router#show version | include image
System image file is "flash:c2800nm-adventerprisek9-mz.151-4.M10.bin"

Booting IOS image from flash

Let’s see how I can select a different image. I can configure the router to boot the other IOS image on my flash memory with the boot system command:

Router(config)#boot system flash c2800nm-adventerprisek9-mz.151-4.M12a.bin

After reloading the router, I can verify that it has booted the newer image:

Router#show version | include image
System image file is "flash:c2800nm-adventerprisek9-mz.151-4.M10.bin"

Booting IOS image from network

What if I want to boot an IOS image from the network? This could be useful. Perhaps your flash memory is too small to fit the latest IOS image or maybe you want to make sure all routers run the same IOS image without manually copying the images to the flash memory of each router.

The boot system command has some options:

Router(config)#boot system ?
  WORD   TFTP filename or URL
  flash  Boot from flash memory
  ftp    Boot from a server via ftp
  mop    Boot from a Decnet MOP server
  rcp    Boot from a server via rcp
  rom    Boot from rom
  tftp   Boot from a tftp server

One of the options is a TFTP server. Let’s see if we can boot from a TFTP server:

Router(config)#boot system tftp c2800nm-adventerprisek9-mz.151-4.M12a.bin 192.168.1.2

This tells the router to look for the specified filename on the TFTP server with IP address 192.168.1.2.

The command above however is only half of the story. The default configuration register will only look for the IOS image on the flash memory. We have to change it to tell the router to look for the IOS image on the network:

Router(config)#config-register 0x210F

This tells the router to look for an IOS image on the network, not on the local flash drive. We also have to make sure the router is able to reach our TFTP server. Let’s enable an interface with an IP address that is in the same subnet as our TFTP server:

Router(config)#interface FastEthernet 0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown

Now we can save our configuration and reload the router. Once you do, you will see this:

Readonly ROMMON initialized
program load complete, entry point: 0x8000f000, size: 0xcb80
program load complete, entry point: 0x8000f000, size: 0xcb80

program load complete, entry point: 0x8000f000, size: 0x40c7678
Self decompressing the image : ########################## [OK]

The router does its POST, initializes ROMMON and then loads the IOS image on the flash memory as usual. Once it is loaded, instead of showing you the command prompt you will see this:

Loading c2800nm-adventerprisek9-mz.151-4.M12a.bin from 192.168.1.2 (via FastEthernet0/0):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 67929600 bytes]

It downloads the IOS image that we specified from the TFTP server. Once the transfer is completed, it extracts and loads the image:

%SYS-6-BOOT_MESSAGES: Messages above this line are from the boot loader.

program load complete, entry point: 0x8000f000, size: 0x40c8438
Self decompressing the image : ################### [OK]

Your router will now run the IOS image from the TFTP server.

Booting IOS image from network through ROMMON

What if your flash memory is defective but you still want to run IOS somehow? It is possible with ROMMON to download the image and then extract and run it in RAM, without touching your flash memory. When the router boots, hit the CTRL+BREAK combination to get into ROMMON:

System Bootstrap, Version 12.4(13r)T, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.

Initializing memory for ECC
...
c2811 platform with 786432 Kbytes of main memory
Main memory is configured to 64 bit mode with ECC enabled


Readonly ROMMON initialized

program load complete, entry point: 0x8000f000, size: 0xcb80
program load complete, entry point: 0x8000f000, size: 0xcb80

monitor: command "boot" aborted due to user interrupt

Here we have to configure some variables. If your TFTP server is in the same subnet then you can skip the default gateway:

rommon 1 > IP_ADDRESS=192.168.1.1
rommon 2 > IP_SUBNET_MASK=255.255.255.0
rommon 3 > DEFAULT_GATEWAY=192.168.1.254
rommon 4 > TFTP_SERVER=192.168.1.2
rommon 5 > TFTP_FILE=c2800nm-adventerprisek9-mz.151-4.M12a.bin

When you are ready, use the tftpdnld command with the -r parameter. This tells the router not to store the IOS image on the flash memory:

rommon 6 > tftpdnld -r

You will see a quick overview with your variables and the router will start downloading:

          IP_ADDRESS: 192.168.1.1
      IP_SUBNET_MASK: 255.255.255.0
     DEFAULT_GATEWAY: 192.168.1.254
         TFTP_SERVER: 192.168.1.2
           TFTP_FILE: c2800nm-adventerprisek9-mz.151-4.M12a.bin
        TFTP_VERBOSE: Progress
    TFTP_RETRY_COUNT: 18
        TFTP_TIMEOUT: 7200
       TFTP_CHECKSUM: Yes
        TFTP_MACADDR: 00:1d:a1:8b:36:d0
             FE_PORT: Fast Ethernet 0 
       FE_SPEED_MODE: Auto

Receiving c2800nm-adventerprisek9-mz.151-4.M12a.bin from 192.168.1.2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
File reception completed.
Validating checksum.

loading image c2800nm-adventerprisek9-mz.151-4.M12a.bin
program load complete, entry point: 0x8000f000, size: 0x40c8438
Self decompressing the image : ###################################### [OK]

When it has received the file, it will extract it and load the IOS image in RAM. The router will then boot as normal.

Conclusion

You have now learned how to:

  • Boot a different IOS image on your flash memory.
  • How to boot an IOS image from a TFTP server.
  • How to boot an IOS image from a TFTP server using ROMMON.

Forum Replies

  1. Hi Rene,

    can we boot the IOS from TFTP for a switch? in this case, do we use the same configuration register to have the switch load the new image? thanks

  2. Hi Laz. Thanks for the reply

    You said that there is no configuration register that tells the router to search for the IOS image from a TFTP server. However, Rene mentioned in the lesson that the boot system command is half of the story and we need to set the configuration register to 0x210F. Please read boot from network section. I am confused now!!!

  3. Thanks Laz. My question now is can we do the same for the switch? I know we can use the boot system tftp command but do we need to change the configuration register?

    Hany

  4. Hello Hany.

    I believe I answered that in the previous post. The quick answer is yes, Here is an excerpt of my previous answer.

    ... Continue reading in our forum

  5. Hi Laz,

    If i understand correctly, we need to change the configuration register on a ROUTER so it takes the new boot command into consideration but we do not need to do the same on a SWITCH. in other words, using the command boot system tftp is sufficient on SWITCHES. am i right?

23 more replies! Ask a question or join the discussion by visiting our Community Forum