When a router boots up, it searches for a Cisco iOS image in a specific sequence, it will search for
the Cisco iOS based on what's configured in the configuration register, whether there's an iOS in flash,
if a TFTP server is available or it will use ROM monitor.
So when the router boots up, the first thing it checks is the configuration register
boot field, if the boot field is set to 0 in hexadecimal, it will load ROM monitor.
Remember, the configuration registers 16 binary bits by default it would be 0x2102 the
last
hexadecimal value specifies the boot field, so if that's set to 0, it'll go into ROM monitor mode.
If it's set to 2 or greater
in other words, 2.3.4.5.6.7.8 and so forth up to F
it will check for boot commands and load the Cisco iOS image as specified in the boot command.
If no boot command has been configured, it will boot an image in flash and typically it will boot the
first iOS image found in Flash unless you specify a boot command telling it to boot off a different operating
system.
If no files are available in flash, it will look for an iOS image on a TFTP server.
So it'll try and load a Cisco iOS image from a TFTP server
but if none is available, then it will load ROM monitor.
Now on this router
it has multiple files in flash, so it has this operating system and this operating system in flash.
Notice the difference in the name, the one that was loaded is the one with _2 in the name
that was loaded from Flash.
The reason why that operating system was loaded is the configuration register is set to the default.
So the boot field is set to 2
but in the running configuration, there is a boot command telling the router to boot from that second
operating system.
So there are two files in flash, this one and this one
but the router was configured to boot off the second image here's the full show run command notice here's
the command in the running-config telling the router which image to boot from.
So show version shows that image was loaded by the router. On this router
however, there are no boot commands, so show-run pipe include boot doesn't show any boot commands
specifying that the router should boot from some other operating system.
Show version shows which operating system was loaded
and we can see that the configuration registers using the default value, so the router loaded the first
operating system that it found in Flash,
in other words, this operating system.
So you can specify with boot commands
which operating system should be loaded by the router, but by default, it will simply use the first
operating system found in Flash unless you override that with the boot system command. You could
as an example, specify that it boot from a TFTP server or FTP server as an example.
So how does Cisco routers load iiOS configuration files? When the operating system is loaded and started,
the router needs to be configured with IP addresses and other values to make it of any use.
So it will typically look for the startup-config in NVRAM
if there's no startup-config in NVRAM, it will either begin an auto-install or enter the setup
utility.
So when the router boots up, it looks for a startup-config in NVRAM.
If it exists, it will load that startup-config.
If there's no startup-config it looks for an active link to another router and then tries to load
a configuration from a TFTP server using a protocol called slop.
If that doesn't work, it will prompt for the initial configuration dialog.