Lesson Contents
When you power on a Cisco IOS router, it will take the following steps:
- Perform a POST (Power on self test) to discover the hardware and to check if the hardware is working properly.
- Copy a bootstrap program from ROM into the RAM, run the bootstrap program.
- 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.
- 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.
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 configuration-register boot option.
- the boot system command
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.
Hello Rene,
Thanks for your amazing articles.
Could you please let me know what is the use of the commands " boot-start-marker" & “boot-end-marker”, sometimes I saw them on running config.
is it a must? is it safe to delete them?
Thanks in advance.
Hi Wisam,
These define the boot section of your switch or router. You can’t remove them, they are always in your config. If there is nothing in between then it means that your router/switch will use the default method to select the IOS image. If you use any of the boot system commands, they will be added in between these two commands.
Here’s an example of how you can do that:
https://networklessons.com/cisco/ccna-routing-switching-icnd1-100-105/cisco-ios-boot-system-image/
Rene
Thanks Rene for your reply.
but what about:
why sometimes see the boot system command in it, while I can just run this command “boot system flash:iosfilename.bin” from the CLI just one time?
Thanks in Advance Rene.
Hi Wisam,
With that boot system command, you tell the router specifically to use that filename when it is looking for the IOS image. If you remove it, it will just look for the first IOS file that it finds on the flash memory…
Rene
Thanks a lot Rene