Sunday, May 1, 2011

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.

Managing IOS images using TFTP

Managing IOS images using TFTP
5.2.5
The page will show students how to store IOS images on a TFTP server.
The IOS may need to be backed up, upgraded, or restored using the copy command. When a router first arrives, the IOS should be backed up. The IOS backup can be initiated from the privileged EXEC mode with the copy flash tftp command. This IOS image can be stored in a central server with other IOS images. These images can be used to restore or upgrade the IOS on the routers and switches in a network. This server should have a TFTP service running. The router will prompt the user to enter the IP address of the TFTP server and to specify a destination filename.
To restore or upgrade the IOS from the server use the copy tftp flash command as shown in Figure . The router will prompt the user to enter the IP address of the TFTP server. Next, the router will prompt the user for the filename of the IOS image on the server. The router may then prompt the user to erase flash. This often happens if there is not sufficient flash available for the new image. As the image is erased from flash, a series of es will appear to show the erase process.
As each datagram of the IOS image file is downloaded, an exclamation mark (!) will be displayed. This IOS image is several megabytes and may take a long time to download.
The new flash image will be verified after it is downloaded. The router is now ready to be reloaded to use the new IOS image.
The Lab Activity will allow students to back up a copy of a router IOS onto a TFTP server.
The next page will show students how ROMmon and Xmodem can be used to manage IOS images.

Managing configuration files using copy and paste

Managing configuration files using copy and paste
5.2.4
This page will explain how HyperTerminal can be used to copy a configuration. The file is then edited and pasted back into the router.
Another way to create a backup copy of the configuration is to capture the output of the show running-config command. To do this from the terminal session, copy the output, paste it into a text file, and then save the text file. This file will need to be edited before it can be used to restore the router configuration.  
Perform the following steps to capture the configuration from a HyperTerminal screen:
  1. Select Transfer.
  2. Select Capture Text.
  3. Specify a name for the text file to capture the configuration.
  4. Select Start to start capturing text.
  5. Use the show running-config command to display the configuration on the screen.
  6. Press the Spacebar when each "-More -" prompt appears.
After the complete configuration has been displayed, use the following steps to stop the capture:
  1. Select Transfer.
  2. Select Capture Text.
  3. Select Stop.
After the capture is complete, the configuration file needs to be edited to remove extra text. Remove any unnecessary information from the captured configuration so it can be pasted back into the router. Comments may also be added to explain the various parts of the configuration. To add a comment, begin a line with an exclamation mark (!).
The configuration file can be edited from a text editor such as Notepad. To edit the file from Notepad click on File > Open. Find the captured file and select it. Click Open.
The lines that need to be deleted contain the following information:
  • show running-config
  • Building configuration...
  • Current configuration:
  • - More -
  • Any lines that appear after the word "End"
Add the no shutdown command to the end of each interface section. Click File > Save to save a clean version of the configuration.
The backup configuration can be restored from a HyperTerminal session. Before the configuration is restored any remaining configuration should be removed from the router. To do this, enter the erase startup-config command at the privileged EXEC prompt and then enter the reload command to restart the router.
HyperTerminal can be used to restore a configuration. Use the following steps to copy a clean backup of the configuration into a router:
  1. Enter router global configuration mode.
  2. Click on Transfer > Send Text File in HyperTerminal.
  3. Select the name of the file for the saved backup configuration.
  4. Watch as the lines of the file are entered into the router.
  5. Observe any errors.
  6. Press Ctrl-Z to exit global configuration mode after the configuration is entered.
  7. Restore the startup configuration with the copy running-config startup-config command.
The next page will explain how TFTP can be used to mange IOS images.

Managing configuration files using TFTP

Managing configuration files using TFTP
5.2.3
This page will explain how a TFTP server can be used to back up the configuration files for a Cisco device.
In a Cisco router or switch, the active configuration is in RAM and the default location for the startup configuration is NVRAM. The startup configuration should be backed up in case the configuration is lost. One of these backup copies of the configuration can be stored on a TFTP server. The copy running-config tftp command can be used to do this. The steps for this process are listed below:
  • Enter the command copy running-config tftp.
  • Enter the IP address of the TFTP server to store the configuration file.
  • Enter the name to assign to the configuration file or accept the default name.
  • Type yes to confirm each choice.
The backup configuration file can be loaded from a TFTP server to restore the router configuration. The steps below outline this process:
  • Enter the command copy tftp running-config.
  • Select a host or network configuration file at the prompt.
  • Enter the IP address of the TFTP server where the configuration file is located.
  • Enter the name of the configuration file or accept the default name.
  • Confirm the configuration filename and the server address that the system supplies.
The Lab Activity on this page will teach students how to back up a copy of a router configuration file and load it from a TFTP file server.
The next page will show students how the copy and paste feature can be used to manage configuration files.