Sunday, May 1, 2011

File system verification

File system verification
5.2.8

This page will review some commands that can be used to verify the router file system. One of these is the show version command. The show version command can be used to check the current image and the total amount of flash. It also verifies two other items that relate to how the IOS is loaded. It identifies the source of the IOS image that the router used to boot and displays the configuration register. Check the boot field setting of the configuration register to determine the location from which the router will load the IOS. If these do not agree, there may be a corrupt or missing IOS image in flash or there may be boot system commands in the startup configuration.
The show flash command can also be used to verify the file system. This command is used to identify IOS images in flash and the amount of flash that is available. This command is often used to confirm that there is ample space to store a new IOS image.
As previously mentioned, the configuration file may contain boot system commands. These commands can be used to identify the source of the desired IOS boot image. Multiple boot system commands may be used to create a fallback sequence to discover and load an IOS. These boot system commands will be processed in the order of their appearance in the configuration file.
This page concludes this lesson. The next page will summarize the main points from this module.

Environment variables

Environment variables
5.2.7
This page will explain what the ROMmon environment variables are and how they are used.
The IOS can also be restored from a TFTP session. The fastest way to restore an IOS image to the router is to use TFTP from ROMmon to download the image. To do this, set the environmental variables and then use the tftpdnld command.
Since the ROMmon has very limited functions, no configuration file is loaded during boot. As a result, the router has no IP or interface configuration. The environmental variables provide a minimal configuration to allow for the TFTP of the IOS. The ROMmon TFTP transfer works only on the first LAN port so a simple set of IP parameters are set for this interface. To set a ROMmon environment variable, type the variable name, then the equal sign (=), and the value for the variable. For example, to set the IP address to 10.0.0.1, type IP_ADDRESS=10.0.0.1 at the ROMmon prompt. 
Note:
All variable names are case sensitive.
The minimum variables required to use tftpdnld are as follows:
  • IP_ADDRESS - The IP address on the LAN interface
  • IP_SUBNET_MASK - The subnet mask for the LAN interface
  • DEFAULT_GATEWAY - The default gateway for the LAN interface
  • TFTP_SERVER - The IP address of the TFTP server
  • TFTP_FILE - The IOS filename on the server
Use the set command to check the ROMmon environment variables. 
Once the variables are set for the IOS download, the tftpdnld command is entered with no arguments. The ROMmon will echo the variables and then a confirmation prompt will appear with a warning that this will erase the flash. 
As each datagram of the IOS file is received, an exclamation point (!) will be displayed. When the complete IOS file has been received, the flash will be erased and the new IOS image file written. Appropriate messages will be displayed as the process is completed.
When the new image is written into flash and the ROMmon prompt is displayed, the router can be restarted by entering the reset command or typing i. The router should now boot from the new IOS image in flash.
The next page will describe some commands that can be used to verify a router file system.

Managing IOS images using Xmodem

Managing IOS images using Xmodem
5.2.5
This page will explain how ROMmon and Xmodem can be used to restore IOS software images.
If the IOS image in flash has been erased or corrupted, the IOS may need to be restored from the ROM monitor mode (ROMmon). In many of the Cisco hardware architectures, the ROMmon mode is identified by the rommon 1> prompt.
This first step in this process is to identify why the IOS image did not load from flash. This could be due to a corrupt or missing image. The flash should be examined with the dir flash: command.
If an image is located that appears to be valid, the user should attempt to boot from that image. This is done with the boot flash: command. For example if the image name is c2600-is-mz.121-5, the command is as follows:
rommon 1>boot flash:c2600-is-mz.121-5
If the router boots properly, the user should check two items to determine why the router did not use the IOS image from flash and booted to the ROMmon instead. First, use the show version command to check the configuration register to ensure that it is configured for the default boot sequence. If the configuration register value is correct, use the show startup-config command to see if there is a boot system command that instructs the router to use the IOS for ROMmon.
If the router will not properly boot from the image or there is no IOS image, a new IOS will need to be downloaded. To recover the IOS file, a user can use Xmodem to restore the image through the console or use TFTP to download the image from the ROMmon mode.

Download with Xmodem from ROMmon
To restore the IOS through the console, the local PC needs to have a copy of the IOS file to restore and a terminal emulation program such as HyperTerminal. The IOS can be restored with the default console speed of 9600 bps. The baud rate can be changed to 115200 bps to speed up the download. Use the confreg command to change the console speed from ROMmon mode. After the confreg command is entered, the router will prompt for the parameters that can be changed.
When the change console baud rate? y/n [n]: prompt appears, if the user selects y, the router will prompt the user to select the new speed. After the console speed is changed, restart the router into ROMmon mode. The terminal session at 9600 bps is terminated and a new session is started at 115200 bps to match the console speed.
The xmodem command can be used from the ROMmon mode to restore an IOS software image from the PC. The format of the command is xmodem -c image_file_name. For example, to restore an IOS image file named c2600-is-mz.122-10a.bin, use the following command:
xmodem -c c2600-is-mz.122-10a.bin  
The -c instructs the Xmodem process to use cyclic redundancy check (CRC) for error checking during the download.
The router will prompt the user to not begin the transfer and present a warning message. The warning message will inform the user that the bootflash will be erased and will ask for confirmation to continue. When the process is continued, the router will then prompt to start the transfer.
Now the Xmodem transfer needs to be started from the terminal emulator. In HyperTerminal, select Transfer > Send File. In the Send File popup specify the image name and location, select Xmodem as the protocol, and start the transfer. The Sending File popup will display the status of the transfer.
After the transfer is complete, a message will indicate that flash is being erased. This is followed by the Download Complete! message. Before the router is restarted, set the console speed back to 9600 and the config register back to 0x2102. Enter the command config-register 0x2102 at the privileged EXEC prompt.
While the router reboots, end the 115200 bps terminal session and begin a 9600 bps session.
The Lab Activities will teach students how to gain access to a router to recover a password and how to manage IOS images with ROMmon and Xmodem.
The next page will introduce the ROMmon environment variables.