Managing Cisco Devices
Carefully managing Cisco IOS images and configuration files reduces device downtime and maintains best practices. Cisco IOS image files contain the Cisco IOS Software required for a Cisco device to operate, and the device configuration files contain a set of user-defined configuration commands that customize the functionality of a Cisco device.
Cisco IOS File System and Devices
The Cisco IOS File System (Cisco IFS) feature provides a single interface to all the file systems that a router uses. This topic describes the file systems used by a Cisco router. Figure 6-10 shows the various file systems for an IOS device.
Figure 6-10 IOS File System Devices
The Cisco IFS feature provides a single interface to all the file systems that a Cisco router
uses, including the following:
- Flash memory file systems
- Network file systems: TFTP, Remote Copy Protocol (RCP), and FTP (This lesson only discusses commands used to transfer Cisco IOS images and configuration files to and from a TFTP server.)
- Any other endpoint for reading or writing data (such as NVRAM, the running configuration in RAM, and so on)
One key feature of the Cisco IFS is the use of the URL convention to specify files on network devices and the network.
Table 6-2 contains some commonly used URL prefixes for Cisco file devices.
Table 6-2 Common URLs for IOS File Devices
With Cisco IOS Release 12.0, commands used to copy and transfer configuration and system files changed to include the Cisco IFS specifications.
Table 6-3 contains pre–Cisco IOS Release 12.0 and newer Cisco IOS Release 12.x commands used for configuration file movement and management. Notice that the Cisco IOS Release 12.x commands identify the location of the configuration files following the colon as [[[//location]/directory]/filename], as applicable.
Table 6-3 IFS Management Files
Managing Cisco IOS Images
As any network grows, storage of Cisco IOS images and configuration files on a central TFTP server enables control of the number and revision level of Cisco IOS images and configuration files that must be maintained.
Production internetworks usually span wide areas and contain multiple routers. For any network, it is always prudent to retain a backup copy of the Cisco IOS Software image in case the system image in the router becomes corrupted or accidentally erased. Widely distributed routers also need a source or backup location for Cisco IOS Software images. Using a network TFTP server allows image and configuration uploads and downloads over the network. The network TFTP server can be another router, a workstation, or a host system. Figure 6-11 illustrates copying files to and from a network server.
Figure 6-11 Copying IOS Images to a Network Server
Before copying the Cisco IOS image software from flash memory in the router to the network TFTP server, you should follow these steps:
Step 1 Make sure that you have access to the network TFTP server. You can ping the TFTP server to test connectivity.
Step 2 Verify that the TFTP server has sufficient disk space to accommodate the Cisco IOS Software image. Use the show flash command on the router to determine the size of the Cisco IOS image file.
Step 3 Check the filename requirements on the TFTP server. This can differ, depending on whether the server is running Microsoft Windows, UNIX, or another operating system.
Step 4 Create the destination file to receive the upload, if required. This step depends on the network server operating system.
The show flash command, shown previously, is an important tool to gather information about the router memory and image file. The show flash command can determine the following:
- Total amount of flash memory on the router
- Amount of flash memory available
- Name of all the files stored in the flash memory
The name for the Cisco IOS image file contains multiple parts, each with a specific meaning. For example, the filename c2800nm-ipbase-mz.124-5a.bin, shown earlier in Figure 6-11, contains the following information:
- The first part of the image name identifies the platform on which the image runs. In this example, the platform is c2800.
- The second part of the name specifies where the image runs and whether the file is compressed. In this example, mz indicates that the file runs from RAM and is compressed.
- The third part of the name indicates the version number. In this example, the version number is 124-5a.
- The final part of the name is the file extension. The .bin extension indicates that this is a binary executable file.
The Cisco IOS Software naming conventions, field meaning, image content, and other details are subject to change. You can contact the Cisco sales representative or distribution channel for updates, or refer to Cisco.com.
A software backup image file is created by copying the image file from a router to a network TFTP server. To copy the current system image file from the router to the network TFTP server, use the following command in privileged EXEC mode:
Router# copy flash tftp:
The copy flash tftp command requires you to enter the IP address of the remote host and the name of the source and destination system image files. Example 6-9 shows the output of this command.
Example 6-9 Output of the copy flash tftp Command
RouterA# copy flash tftp: Source filename ? c2800nm-ipbase-mz.124-5a.binAddress or name of remote host ? 10.1.1.1 Destination filename [c2800nm-ipbase-mz.124-5a.bin] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<output omitted> 12094416 bytes copied in 98.858 secs (122341 bytes/sec) RouterA#
The exclamation points (!!!) indicate the copying process from the flash memory of the router to the TFTP server. Each exclamation point means that one User Datagram Protocol (UDP) segment has successfully transferred.
Before updating the flash memory with a new Cisco IOS image, you should back up the current Cisco IOS image to a TFTP server. Backing up provides a fallback in case there is only sufficient space to store one image in the flash memory.
Upgrading a system to a newer software version requires a different system image file to be loaded on the router. Use the following command to download the new image from the
network TFTP server: Router# copy tftp flash:
The command prompts you for the IP address of the remote host and the name of the source and destination system image file. Enter the appropriate filename of the update image just as it appears on the server. Example 6-10 shows the output of this command.
Example 6-10 Output of the copy tftp flash Command
RouterA# copy tftp flash: Address or name of remote host [10.1.1.1]? Source filename ? c2800nm-ipbase-mz.124-5a.bin Destination filename [c2800nm-ipbase-mz.124-5a.bin] Accessing tftp://10.1.1.1/c2600-js-mz.122-21a.bin... Erase flash: before copying? [confirm] Erasing the flash filesystem will remove all files! Continue? [confirm] Erasing device... eeeeeeeeee (output omitted) ...erased Erase of flash: complete Loading c2800nm-ipbase-mz.124-5a.bin from 10.1.1.1 (via Ethernet0/0): !!!!!!!!!!!!!!! (output omited) [OK - 12094416 bytes] Verifying checksum... OK (0x45E2) 12094416 bytes copied in 120.465 secs (100398 bytes/sec) RouterA#
After these entries are confirmed, the erase flash prompt appears. Erasing flash memory makes room for the new image. Erase flash memory if there is not sufficient flash memory for more than one Cisco IOS image. If no free flash memory is available, the erase routine is required before new files can be copied. The system informs you of these conditions and prompts for a response.
NOTE Make sure that the Cisco IOS image loaded is appropriate for the router platform. If the wrong Cisco IOS image is loaded, the router could be made unbootable, requiring ROMMON intervention.
Managing Device Configuration Files
Device configuration files contain a set of user-defined configuration commands that customize the functionality of a Cisco device.
Configuration files contain the Cisco IOS Software commands used to customize the functionality of a Cisco routing device, such as a router, access server, switch, and so on. Commands are parsed, that is, translated and executed, by the Cisco IOS Software when you boot the system from the startup configuration file or when you enter commands at the command-line interface (CLI) in configuration mode.
Configuration files are stored in the following locations:
- The running configuration is stored in RAM.
- The startup configuration is stored in NVRAM.
You can copy configuration files from the router to a file server using FTP, RCP, or TFTP. For example, you can copy configuration files to back up a current configuration file to a server before changing its contents, thereby allowing the original configuration file to be restored from the server. The protocol used depends on which type of server is used. Figure 6-12 shows the various locations in which a configuration file can be stored.
Figure 6-12 Configuration File Locations
You can copy configuration files from a TFTP, RCP, or FTP server to the running configuration in RAM or to the startup-config file in NVRAM of the router for one of the following reasons:
- To restore a backed-up configuration file.
- To use the configuration file for another router. For example, you might add another router to the network and want it to have a similar configuration as the original router. By copying the file to the network server and making the changes to reflect the configuration requirements of the new router, you can save time by not re-creating the entire file.
- To load the same configuration commands onto all the routers in the network so that all the routers have similar configurations.
Cisco IOS copy Command
The Cisco IOS Software copy command is used to move configurations from one component or device to another, such as RAM, NVRAM, or a TFTP server.
In addition to using AutoInstall, the setup utility, or the CLI to load or create a configuration, there are several other sources for configurations that you can use. Figure 6-13 shows the variety of copy commands that can be used with the configuration file.
You can use the Cisco IOS Software copy command to move configurations from one component or device to another. The copy command indicates the source (from where the configuration is to be copied), followed by the destination (to where the configuration is to be copied). For example, in the copy running-config tftp command, the running configuration in RAM is copied to a TFTP server.
Use the copy running-config startup-config command after a configuration change is made in RAM and must be saved to the startup-config file in NVRAM. Similarly, copy the startup-config file in NVRAM back into RAM with the copy startup running command. Notice that you can abbreviate the commands.
Figure 6-13 Copying the Configuration File
Similar commands exist for copying between a TFTP server and either NVRAM or RAM. Use the configure terminal command to interactively create configurations in RAM from the console or remote terminal.
Use the erase startup-config command to delete the saved startup-config file in NVRAM. Figure 6-14 shows an example of how to use the copy tftp run command to merge the running configuration in RAM with a saved config
Figure 6-14 Merging Configuration Files
NOTE When a configuration is copied into RAM from any source, the configuration merges with, or overlays, any existing configuration in RAM, rather than overwriting it. New configuration parameters are added, and changes to existing parameters overwrite the old parameters. Configuration commands that exist in RAM for which there is no corresponding command in NVRAM remain unaffected. Copying the running configuration from RAM into the startup-config file in NVRAM will overwrite the startup-config file in NVRAM.
You can use the TFTP servers to store configurations in a central place, allowing centralized management and updating. Regardless of the size of the network, there should always be a copy of the current running configuration online as a backup. Example 6-11 shows how to transfer, back up, and restore configuration files.
Example 6-11 Actions for Configuration Files
RouterA# copy running- config: tftp: Address or name of remote host ? 10.1.1.1 Destination filename [running-config]? wgroa.cfg .!! 1684 bytes copied in 13.300 secs (129 bytes/sec) RouterA# copy tftp: running- config: Address or name of remote host ? 10.1.1.1 Source filename ? wgroa.cfg Destination filename [running-config]? Accessing tftp://10.1.1.1/wgroa.cfg... Loading wgroa.cfg from 10.1.1.1 (via Ethernet0): ! [OK - 1684/3072 bytes] 1684 bytes copied in 17.692 secs (99 bytes/sec)
The copy running-config tftp command allows the current configuration to be uploaded and saved to a TFTP server. The IP address or name of the TFTP server and the destination filename must be supplied. On the display, a series of exclamation marks show the progress of the upload.
The copy tftp running-config command downloads a configuration file from the TFTP server to the running configuration of RAM. Again, the address or name of the TFTP server and the source and destination filename must be supplied. In this case, because you are copying the file to the running configuration, the destination filename should be running-config. This is a merge process, not an overwrite process.
Using show and debug Commands on Cisco Devices
The show and debug commands are built-in tools for troubleshooting. The show command is used to display static information, while the debug command is used to display dynamic data and events. Table 6-4 outlines the major differences in these commands.
Table 6-4 show Versus debug Commands
The show and debug commands have the following functions:
- show: To snapshot problems with interfaces, media, or network performance
- debug: To check the flow of protocol traffic for problems, protocol bugs, or misconfigurations
Table 6-5 describes the major differences between the show and debug commands.
Table 6-5 Differences Between the show and debug Commands
Use debug commands to isolate problems, not to monitor normal network operation. Because the high overhead of debug commands can disrupt router operation, debug commands should be used only when looking for specific types of traffic or problems and when those problems have been narrowed to a likely subset of causes.
The following are some considerations when using debug commands:
- Be aware that the debug commands can generate too much data that is of little use for a specific problem. Normally, knowledge of the protocol or protocols being debugged is required to properly interpret the debug outputs.
- Because the high CPU overhead of debug commands can disrupt network device operation, debug commands should be used only when looking for specific types of traffic or problems and when those problems have been narrowed to a likely subset of causes.
- When using the debug troubleshooting tools, be aware that output formats vary with each protocol. Some generate a single line of output per packet, whereas others generate multiple lines of output per packet.
- Some debug commands generate large amounts of output; others generate only occasional output. Some generate lines of text, and others generate information in field format.
- Use of debug commands is suggested for obtaining information about network traffic and router status. Use these commands with great care.
- If you are not sure about the impact of a debug command, check http://www.cisco.com for details or consult with a technical support representative.
Many IOS commands are useful when performing debugs. Table 6-6 lists descriptions of the commands that you can use with a debug command.
Table 6-6 Command Descriptions
Because the problem condition is an abnormal situation, you might be willing to temporarily trade off efficiency for the opportunity to rapidly diagnose and correct the problem. To effectively use debugging tools, you must consider the following:
- The impact that a troubleshooting tool has on router performance
- The most selective and focused use of the diagnostic tool
- How to minimize the impact of troubleshooting on other processes that compete for resources on the network device
- How to stop the troubleshooting tool when diagnosing is complete so that the router can resume its most efficient switching
It is one thing to use debug commands to troubleshoot a lab network that lacks end-user application traffic. It is another thing to use debug commands on a production network that users depend on for data flow. Without proper precautions, the impact of a broadly focused debug command could make matters worse.
With proper, selective, and temporary use of debug commands, you can easily obtain potentially useful information without needing a protocol analyzer or other third-party tool. Other considerations for using debug commands are as follows:
- Ideally, it is best to use debug commands during periods of lower network traffic and fewer users. Debugging during these periods reduces the effect on other users.
- When the information you need from the debug command is interpreted and the debug (and other related configuration settings, if any) is undone, the router can resume its faster switching. Problem solving can be resumed, a better-targeted action plan created, and the network problem resolved.
All debug commands are entered in privileged EXEC mode, and most debug commands take no arguments.
CAUTION Do not use the debug all command because this can cause a system to crash.
To list and see a brief description of all the debugging command options, enter the debug ? command in privileged EXEC mode.
By default, the network server sends the output from debug commands and system error messages to the console. When using this default, you should monitor the debugging output using a virtual terminal connection rather than the console port. To redirect debugging
output, you should use the logging command options in configuration mode. Possible destinations include the console, vty, internal buffer, and UNIX hosts running a syslog server. The syslog format is compatible with 4.3 Berkeley Software Distribution (4.3 BSD) UNIX and its derivatives.
NOTE It is important to turn off debugging when you have finished your troubleshooting.