- The flash has no space to store the Cisco IOS system image and the image has been stored on a local TFTP server;
- The flash has gone bad and cannot be used to store the IOS image;
- The TFTP server acts a repository for IOSes and all routers access IOSes from the TFTP server.
Whatever be the reason, booting the router from the TFTP server has its fair share of pros and cons.
The pros are that in case the compact flash goes bad, the router can still be booted up with the desired IOS image, without the need to purchase / replace the flash card; also, multiple routers on the network can be booted up from a single common IOS image stored on the TFTP server, without the need to store the IOS locally on the flash of each router.
The biggest drawback to this design, however, is that the router needs to have connectivity with the TFTP server at all times, so that in case the router gets reloaded, it can boot up from TFTP again.
Please note that if the router is up and running, then connectivity with the TFTP server is not required to keep the router up i.e. TFTP connectivity is only required during router bootup.
So, here is a brief description of how the router can be configured to boot from a TFTP server.
Step 1: Setting up required variables in ROMMON
Whenever a router boots up, it initially goes into the ROMMON mode and then boots up into the IOS from there. Now, inorder to boot up into the IOS, it obviously needs access to the IOS from ROMMON. So, inorder to boot from the TFTP server, we first need to ensure that the router has access to the TFTP server from ROMMON mode, from where it can download the IOS each time that the router needs to boot up.
There are some variables which we need to set in ROMMON mode, which will ensure that the IOS gets downloaded from TFTP.
So, here are the sequence of events that we need to carry out to set these variables.
- Power cycle the router, and during bootup, press ctrl + break continuously so that the router goes into ROMMON mode.
- Once in ROMMON, give the following commands:
rommon 1 > IP_ADDRESS=<ip address of router interface>
rommon 2> IP_SUBNET_MASK=<subnet mask for the above IP>
rommon 3 > DEFAULT_GATEWAY=<default gateway for router (can be same as TFTP server IP)>
rommon 4 > TFTP_SERVER=<IP address of TFTP server>
rommon 5 > TFTP_FILE=<name of IOS to be used for bootup (including the .bin extension)>
rommon 6> tftpdnld –r
(the ‘-r’ parameter ensures that when the IOS is downloaded, it is not stored in flash, but is directly decompressed into the DRAM during router bootup. So the flash is completely bypassed here.)
Once the above commands are entered, the router will start downloading the IOS from the TFTP server. After the download is complete, the router will reload automatically, and boot up into the IOS that was specified above.
The ‘show version’ output will have the following statement:
System image file is "tftp://<IP of tftp server>/<IOS image name>"
This step ensured that we have the correct variables set up in ROMMON for the router to reach the TFTP server and download the IOS from there on subsequent boot-ups.
Step 2: Changing boot variable in the IOS
Now that the router has booted successfully into the IOS and all the required variables have been set up in ROMMON, all that is left to do is to set the boot variable to point to the TFTP server in the IOS, so that the router looks for the TFTP server during bootup to find the IOS image.
This can be configured by the following command in global configuration mode:
Router(config)# boot system tftp <IOS image name> <IP of TFTP server>
Save the configurations.
We have now setup all the desired variables (in ROMMON and in the IOS) to ensure that the next time that the router boots up, it will download the IOS from the TFTP server, decompress it and then boot into the IOS.
Please note that since the IOS has to be downloaded from the TFTP server each time that the router boots up, the boot up process takes a bit of time.