Understanding the Cisco Internetwork Operating System (IOS)
Two major topics are covered in this sample chapter: what the Cisco IOS is and how to upgrade it, and how to use the Cisco IOS command interpreter. The Cisco IOS contains the instruction sets needed to configure, maintain, and run a Cisco router successfully in any environment.
To enable functionality on a Cisco router that may not have been installed by default, IOS feature packs need to be installed. Feature packs can add the ability to run firewalls, protocols, and VPNs. Cisco routers are produced in two memory configurations: Run-from-RAM and Run-from-Flash. The type of memory configuration for a router will determine the location for running the IOS.
In this lesson (Day 3) we will discuss the Cisco IOS (Internetwork Operating System), the operating system that drives most Cisco routers (except the 700 Series). Before we examine any other features of Cisco's routers (such as configurations and operations), we need to understand the basic IOS elements. Therefore, this lesson will focus primarily on providing you that key knowledge base that is essential to understanding the rest of this book and successfully mastering Cisco routers.
The IOS features a complete set of tools to help administrators monitor and configure Cisco routers. One of these tools is the Exec, or command interpreter. The Exec is the engine that drives the Cisco IOS.
The command interpreter is the core of the Cisco IOS. Any command entered into the Cisco IOS needs a master process to act upon it and supply an appropriate response. This is the basic job description of the Exec.
The Cisco command interpreter is divided into two modes, or levels. The lower level, offering the most basic interpretation of commands, is the user mode command interpreter. The highest level is known as the privilege mode command interpreter. We will cover the procedures required to use both modes of the Exec.
If you have a Cisco router that you will be using to follow the lessons in this book, do not use it here. This lesson serves as an introduction to the Cisco IOS. Therefore it would be better just to read along and absorb the information rather than trying to reproduce the examples on your own. (Beginning with the next lesson, sample exercises will appear at the end of each day. These exercises will allow you to practice what you have learned in the day's lesson.)
If you do have a Cisco router, and have yet to turn it on for the first time (or you have turned it on and were confused by what you saw), don't use it until Day 6, "Getting the Router Up and Running." All Cisco routers enter what is known as setup mode the first time they are powered up. Setup mode allows the administrator to provide the initial configuration to the router. Therefore, if you do not already have a basic understanding of the Cisco IOS, you may feel lost during the process. That is why we will be covering the concepts behind the Cisco IOS here, on Day 3.
This lesson, covering the basic elements of the Cisco IOS, will tie directly into Day 4, "Learning the Cisco User Interface." Together, these two lessons will completely introduce you to the operating system of Cisco routers: the Cisco IOS.
Two major topics are covered in this lesson:
What the Cisco IOS is and how to upgrade it
The Cisco IOS command interpreter
Behind the Cisco IOS
Like any computer (and most other electronic devices), Cisco routers require an operating system to perform their primary functions. The heart of every Cisco router is the Cisco IOS. The Cisco IOS contains the instruction sets needed to configure, maintain, and run a Cisco router successfully in any environment.
Routers, like PCs, are complex devices capable of incredible calculations. Cisco routers apply complicated formulas to sets of criteria (representing routing paths and options), ultimately producing a desired result of the "best path" for information to traverse. Calculations such as these require an operating system that is both robust and user friendly. However, this operating system needs to be lightweight and fast to handle the load of today's routing environments.
The Cisco IOS is a robust operating system that is fully featured but at the same time very streamlined. The operating system that runs all Cisco routers is packed with features that allow for the most complex configurations (meaning the routers can be adapted to work in almost any situation). However, there are no superfluous or "seldom used" functions. The Cisco IOS is a very efficiently assembled package of commands and functions for managing routers.
As you will discover, the Cisco IOS is more than just a set of commands for running routers. The IOS provides tools for file storage, memory management, and other services that an administrator would use to operate within a given environment.
You might think, however, that with such a powerful command structure (and given the complexity of router operations), the Cisco IOS would be complicated or hard to use. In fact, the Cisco IOS is extremely user friendly and easy to learn. Anyone familiar with basic PC functions and terminology can easily learn the Cisco IOS.
However, before we explore the structure of the Cisco IOS, let's examine it as an operating systemin other words, the important stuff, such as where you buy it and how you install it.
After we examine these topics, we will look into the technology that drives the Cisco IOS. By the conclusion of this lesson, you will be familiar with the overall architecture of the Cisco IOS.
Obtaining IOS Updates
Operating systems, regardless of platform, need to be flexible to be successful. That is, the more control you as an administrator have over the operating system, the more satisfied you will be with its results. Part of being flexible is the ability to be replaced or modified.
Almost every operating system on the market today can be considered flexible. For example, if you own a PC, you can install Microsoft Windows 2000, upgrade it to Microsoft Windows XP, or keep it and modify it through the use of service packs.
The Cisco IOS is just as flexible. You can install IOS version 12.0(3) on your router, upgrade it to 12.2, or keep it and modify it through the use of feature packs.
A Cisco IOS feature pack is a version of the IOS software that contains added functionality not available in the basic IOS, such as the ability to run a firewall or utilize virtual private networks (VPNs).
Every router is packaged (unless otherwise stated) with the Basic Cisco IOS. The Basic IOS usually supports routing one routed protocol, such as IP or IPX. To give a router with the Basic IP Cisco IOS the ability to router both IP and IPX, you would need to install the IP/IPX feature pack.
In contrast to most PC operating systems, a Cisco IOS feature pack actually contains the entire operating system within itnot just the parts needed to add the new features. Therefore, when you add a feature pack to your router, you should be sure that the feature pack includes all of the functionality you currently have.
For example, suppose an administrator has a router running the Basic Cisco IOS that routes IP, decides that the particular router also needs to route IPX, and therefore installs the Cisco IPX IOS feature pack. The error in the administrator's logic is that installing a feature pack is not a cumulative process. What the administrator has actually done is overwrite the current IP IOS with IOS that routes IPX (and only IPX), thus losing the ability to route IP. To be able to route both the IP and IPX protocols, the administrator should have installed the Cisco IP/IPX IOS feature pack. Therefore it is important to be aware of your needs when you look to upgrade a router with an IOS feature pack.
After the decision to upgrade the Cisco IOS has been made, you need to acquire the desired software.
The Cisco IOS, unlike many operating systems, can be obtained only through Cisco, simply because you can run it only on Cisco products. When you purchase a Cisco router, it should come with a preloaded version of the latest IOS. This is all that you need to get your router operational. However, given the reliability of Cisco's equipment and the loyalty of its customers, many people may want to upgrade their IOS when a new version is released. Moreover, the needs of a network may change over time, and a new feature pack may need to be installed. Where do you find these updates?
There are two ways to obtain the "latest and greatest" that Cisco has to offer. The first (and recommended) way is to register your router and purchase a service agreement. This book does not cover all the details of the various service agreements that Cisco has to offer, but most of the agreements include access to Cisco's secure Web site, shown in Figure 3.1.
Figure 3.1 The Cisco secure download page for IOS upgrades.
From Cisco's secure site you can freely download (as covered by your particular service plan) the latest Cisco IOS updates and feature packs. IOS images (the files that contain the installable Cisco operating system) are available for the current release and most past releases as well. Therefore, administrators with older equipment can still find the IOS they need to keep their network running.
The Cisco CCO (Cisco Connection Online) secure site is a great tool not only for obtaining the IOS releases but for accessing many of Cisco's technical documents and specifications as well.
Obtaining the Cisco IOS is only the first step. Next you need to upgrade the IOS (or apply the specific feature pack, as the situation may be).
Router Memory Architecture
Before attempting to upgrade your router's IOS, you need to understand the memory architecture of your router. Different models of Cisco routers run the Cisco IOS from different locations. Knowing where the IOS is running on your particular router can be the difference between a successful upgrade and a corrupt IOS image.
Cisco routers fall into two categories, depending on the way in which they run the Cisco IOS. Run-from-RAM (RFR) routers are Cisco routers that load the IOS into RAM to be run, whereas Run-from-Flash (RFF) routers will run the IOS directly from the flash memory.
The letter R after the model number identifies a Run-from-RAM router. For example, the Cisco 1605R is a Run-from-RAM router.
It can be assumed that any router without an R after the model name is a Run-from-Flash router.
Depending on the memory architecture of your specific router, you may use different methods to upgrade your IOS. The Cisco IOS on Run-from-RAM routers cannot be upgraded the same way as it is on Run-from-Flash routers. Therefore, we must understand the underlying difference between the two architectures.
The nature of flash memory is to retain information regardless of whether the device it is installed in is powered on or off. This nonvolatilitythe ability to retain information when the power is offis the reason that Cisco uses flash memory as its primary means of storage in most of its routers.
All files, configurations, and IOS images are stored in the router's flash memory, regardless of the router's memory architecture. On both Run-from-RAM and Run-from-Flash routers, an IOS image is stored in the Flash memory. It is where the IOS image goes after the router boots that creates the difference between the two architectures.
Run-from-Flash routers boot up like all other Cisco routers. During the boot process, the loader calls and executes the images in the Flash memory directly. Figure 3.2 illustrates the boot process in a Run-from-Flash router.
Figure 3.2 Loading an RFF IOS image.
The boot process executes the uncompressed IOS image directly from flash. The IOS runs from the flash memory, while all working files are copied to the RAM.
This process has some advantages over other memory architectures. The first advantage is boot speed. Because the IOS image does not need to be decompressed to run, the router can boot quicker. This can be important in environments where every minute counts. (Where a Run-From-RAM router will generally take 2 to 3 minutes to boot, a Run-From-Flash router can boot in less than a minute.)
Running directly from flash memory also frees up RAM. Because the working IOS files (the running-config, routing tables, and other files required for immediate operation) are the only IOS components occupying the RAM space, the IOS can access them more quickly. This adds another advantage over other router architectures.
The final advantage to using a Run-from-Flash architecture is a reduced risk of corruption. The IOS image is not tampered with or modified as much as it would be in other memory configurations.
Because the IOS image that is stored on the flash memory is not modified at a binary level (that is, compressed and decompressed) and the image is relatively stationary, the router can run in a more stable condition. The likelihood of a file-level corruption is then greatly reduced.
However, the Run-from-Flash architecture has some disadvantages as well. The major disadvantage is that the IOS image is actually being run from the router's sole source of storage. As a result, the router's IOS cannot be upgraded while the IOS is in use. While this may sound operationally counterintuitive, it will make sense. However, before we look at the upgrade process, let's discuss the architecture of Run-from-RAM routers.
Run-from-RAM routers take a different approach to router loading. Like their Run-from-Flash counterparts, Run-from-RAM routers store the IOS image in the flash memory. However, this is where many of the similarities end. The IOS image that is stored in flash memory on a Run-from-RAM router is compressed, whereas on a Run-from-Flash router it is not compressed.
Regardless of their architecture, all Cisco routers utilize the provided flash memory as storage. All IOS images, compressed or uncompressed, are stored on the flash.
During the boot process, the compressed IOS image is extracted from the flash memory and decompressed. During the decompression process the image is restored to a working executable operating system. Figure 3.3 illustrates the boot process for Run-from-RAM routers.
Figure 3.3 Loading an RFR IOS image
The decompressed IOS image is then copied to the router's RAM. Because the image is copied to the router's RAM, it must share the available RAM space with the router's working files. As a result, routers with a Run-from-RAM architecture are usually equipped with more base RAM than Run-from-Flash routers.
Recall from Day 2 that the RAM in most Cisco routers is DRAM.
After the IOS image is decompressed and copied to the RAM, the router executes it. This starts the router's operational systems. The router will continue all standard operations from the system RAM, leaving the flash open for router storage.
Run-from-RAM architecture has its advantages, as Run-from-Flash does. The foremost advantage is the freeing of the Flash memory. Because the IOS is run from RAM, the flash memory is free to accept a replacement for the IOS image without disturbing the running software. As a result, upgrading the IOS is much easier on a Run-from-RAM system than on a Run-from-Flash router.
However, a disadvantage to using Run-from-RAM routers is the increased risk of IOS corruption. Because the IOS is manipulated and modified much more in a Run-from-RAM router than in a Run-from-Flash system, the chances of a binary-level corruption of the operating system are increased.
Therefore, it is very important in Run-from-RAM router maintenance to keep backups of your router's configuration and IOS files. (Router backup methods and procedures will be covered on Day 7, "Backing Up Router Configurations.")
Upgrading Run-from-Flash IOS Images
There are generally two ways to upgrade the IOS of Run-from-Flash routers. The most common way is by using the Flash Load Helper (FLH), a separate command space that can be used to gain access to the flash memory independent of the IOS.
The other way is by using a dual flash bank. This method utilizes one larger flash SIMM that has been partitioned into two areas, thus giving the administrator the ability to access the unused flash regardless of whether the IOS is running. Let's examine the procedures for using both methods.
Feel free to read through these procedures. However, do not be discouraged if you cannot follow the IOS functions being used. The Cisco IOS user interface concepts and functions involved here will be explained in more depth on Day 4.
Using Dual Flash Banks
Although using dual flash banks to upgrade an IOS image is fairly simple and relatively straightforward, there is considerable preparation time needed. In most cases, however, this is a procedure that needs to be performed only once.
The minimum number of memory chips that can be used as a flash partition is 4.
Keep in mind that not every Cisco router has the capability to run a dual flash bank. To tell whether your router can be set up for dual flash banks, check the router's specific documentation, or open the case and check the flash SIMM. If the router's flash SIMM contains more than one set of four memory chips, the router can be set up to use dual flash banks.
By partitioning the flash memory you are creating two logical areas in which data can be stored and accessed by the router. This allows the administrator to write an IOS image to one partition of the flash while a separate image is running in the other partition.
One advantage to this method is that no router downtime is required to upload a new IOS image, whereas using the Flash Load Helper requires a minor amount of router downtime.
After determining whether the router is capable of being partitioned for dual flash banks, use the following steps to set up the flash banks.
First, enter the privilege mode command interpreter.
In privilege mode, enter the global configuration program.
Router#configure Configuring from terminal, memory, or network [terminal]? terminal
Enter configuration commands, one per line. End with Ctrl-Z.
Within the global configuration program, you can issue the commands needed to partition the flash memory.
Router(config)# partition flash
This command will accept parameters relating to the number of partitions you want and the desired size of each.
Router(config)#partition flash ? <1-8> Number of partitions in device Router(config)#partition flash 2 ? <1-64> Size of partition 1
After partitioning the flash memory, upgrading the IOS becomes rather easy. Using the copy command, copy a suitable IOS image to the unused Flash partition.
For now, do not be overly concerned with the underlying operation of the commands listed during this process. As we progress through the lessons, the purpose and function of all the commands will become much clearer.
The copy command is used to move files from one location to another, regardless of memory architecture or method of upgrade. Therefore, you will be using the copy command quite often during normal router operation.
Router#copy tftp flash
This command structure copies an unspecified file from a TFTP (Trivial File Transfer Protocol) server to the flash memory. Entering this command will cause the IOS to prompt you for several pieces of information before the actual copy can continue. The parameters you will be prompted for are:
TFTP server name
IOS image file name
Destination flash partition
Destination file name
TFTP server programs can be downloaded (usually for free) for almost any operating system. However, be advised that FTP software is generally not the same as TFTP. Most FTP clients cannot handle TFTP transactions.
Once the desired IOS image is copied to the desired partition, you need to specify to the router what image to use. That is, you now have a router with two flash memory areas, each with a working operating system. Therefore, the router needs to know which IOS to use for daily operation.
To indicate to the router which flash partition to boot, use the boot command from within global configuration mode.
Router(config)#boot system flash 2
This command specifies that the router is to boot the system from the second flash partition.
The router should now be fully configured to run the new IOS. However, if your Run-from-Flash router cannot utilize multiple flash partitions, you must use the Flash Load Helper.
Using the Flash Load Helper
Using Flash Load Helper is a far easier method to upgrade Run-from-Flash routers. The FLH is a small preinstalled utility that automates the upgrade system. However, not every Run-from-Flash router can run Flash Load Helper.
To run the Flash Load Helper, simply use the same commands that you would use to initiate a file copy. If your router is configured to run Flash Load Helper, the FLH notification message will appear after you enter the copy command.
Router# copy tftp flash ***************** NOTICE *************************** Flash load helper v1.0 This process will accept the TFTP copy options and then terminate the current system image to use the ROM based image for the copy. Router functionality will not be available during that time. If you are logged in via telnet, this connection will terminate. Users with console access can see the results of the copy operation. *******************************************************
This message indicates that the router is ready to run Flash Load Helper and you can proceed with the IOS upgrade.
After the FLH notification message is displayed, you will be prompted for several pieces of information. The FLH will ask you for the address of the TFTP server from which to obtain the desired IOS image, the file name of the image, and the destination file name. The FLH will then ask you to confirm your actions, and the upgrade will begin.
The only major disadvantage to using the FLH is that, when the process is complete, FLH reboots. The router needs to be rebooted to load the new image (because the old one no longer exists). Therefore, a small amount of system downtime is required to complete an upgrade using Flash Load Helper.
Upgrading Run-from-RAM IOS Images
There are two different ways to upgrade the Cisco IOS on a Run-from-RAM router. The first is by using a Cisco-supplied program known as the RSL (Router Software Loader). The RSL will connect to your router, determine its current IOS version, and allow you to upgrade it. However, to upgrade the IOS you do need to supply a new IOS image, as described in the previous section. Figure 3.4 illustrates the RSL.
Figure 3.4 The Cisco Router Software Loader.
After successfully connecting to your router and examining its flash memory, the RSL will allow you to either back up or overwrite the existing IOS and install the new one. However, one problem you will inevitably encounter is a warning about the IOS you are installing not being an official release. This error is illustrated in Figure 3.5.
Figure 3.5 An RSL error.
This error is generated by the RSL because the file you are trying to install to the router is not named correctly even though it is a valid IOS image. For example, the Basic IP release of IOS 12.0(3) for a Cisco 1600 Series router is downloadable as a file named c1600-y-mz.120-3.bin. However, the RSL wants the file to be named aaa0269.bin. Why the discrepancy? I really can't say. Either way most engineers find it much easier to upgrade the IOS manually.
The following instructions will walk you through upgrading the Cisco IOS. Even though you will not understand most of the commands now, it will give you a good look at router maintenance. You can also refer back to this section later, when you know more of the router functions. (As with any configuration-altering process, it is recommended that you make a backup copy of your existing flash memory before you begin. You can back up your flash memory to the TFTP server by executing the command copy flash TFTP.)
To upgrade the IOS, you need to enter (or enable) privilege mode.
Within privilege mode, use the copy command to start the dialog. The copy command simply states that you want to copy something from a TFTP server to the flash memory.
Router#copy tftp flash
The router will prompt you for three pieces of information: the TFTP server's IP address (or DNS name), the IOS image file name, and the destination file name.
Address or name of remote host ? 10.16.4.152 Source filename ? c1600-y-mz.120-3.bin Destination filename [c1600-y-mz.120-3.bin]?
You will notice that the destination file name (which is the name you want applied to the image file after it is copied to the flash memory) will default to the name of the source file. After starting the download, the router will ask you if you want to erase the current IOS image file. Answer yes and continue:
%Warning: Run from flash images are recommended for this platform. Erase flash: before copying? [confirm] Erasing the flash filesystem will remove all files! Continue? [confirm] Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased Erase of flash: complete Loading c1600-y-mz.121-8a.bin from 10.16.4.152 (via Ethernet0): !!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! [OK - 2868332/5736448 bytes] Verifying checksum... OK (0xD6C8) 2868332 bytes copied in 106.936 secs (27059 bytes/sec)
Finally, after the new IOS image has been copied to the router, run the reload command to restart your device.
When your device restarts, you will have a shiny new IOS to "play with." You might not get away that easily, though. One common problem with installing an IOS via TFTP occurs after the router is restarted. The router may display an error on startup explaining that the device cannot load the IOS image. Don't worry; not only will the router continue to load, but the error is easy to clear up.
One common result of loading an IOS image from a TFTP server is that, after the image is loaded, the Cisco IOS Boot Loader wants to continue looking for the file on the TFTP location. After the router realizes that the file is no longer on the TFTP site, it will look to the flash memory and load the image from there. To keep this from happening, you need to edit the startup-config file, which can be done from within privilege mode.
Router#configure terminal Router (config)# no boot tftp 1: <image file name> Router (config)#z Router#reload
In the previous sample, replace <image file name> by the name of the IOS image file that the boot loader is trying to load.
These steps should fix any error from trying to boot the IOS from TFTP. However, there is one more issue that you should be aware of when upgrading a Cisco IOS.
Pay very close attention to the DRAM requirements of the particular IOS version you are downloading. It is very possible to copy an IOS image to your router and not have the memory to run it. Keep in mind that the copy command does not monitor what is being copied; it simply moves binary data from location to location.
You may have more than enough physical space to store a particular IOS image in flash memory. However, if you do not have the minimum required DRAM to run it, your boot loader will become stuck in a loading loop. The boot loader will load the image, try to run it, realize it can't, and try to load it again, resulting in an infinite loop.
Even though it is a bit more complicated, there is a way to remedy this problem as well. You will need the following items:
A PC running terminal software that is capable of sending a "break" key sequence and performing Xmodem file transfers
A backup copy of your original IOS image (or other comparable IOS image). This image should be on the terminal PC.
Lots of patience
The key to being able to perform this fix successfully is using a terminal program that is capable of sending a break key sequence. Many people use HyperTerminal, supplied with most Microsoft operating systems. However, HyperTerminal on Windows NT4 is not able to utilize a break sequence. Therefore, you may want to look into the various other terminal emulators that can be downloaded for the platform.
The first step in curing the loading loop problem is to restart the router. Right when the router powers up, send a break to it. This will put the router into monitor mode. You can tell the router is in monitor mode by the following prompt:
rommon 1 >
From this monitor prompt, start the XModem protocol on the router:
rmonitor 1 >xmodem r s9600 aaa0269.bin
This command states that you want to start an XModem download to the router (xmodem), copy an image file directly to the DRAM and execute it (-r), copy the file at 9600 bps (-s9600), and name the file aaa0269.bin (aaa0269.bin). (Replace this name with the name of the file you want to send to your router.)
There are two reasons for copying the image directly to DRAM and not to flash. First, you cannot delete the image that is currently on the flash, so you most likely will not have room for the new one. Second, if you could fit the image on the flash, your router would still want to boot the old one. Therefore, you want to copy the good image directly to the DRAM.
When the router alerts you that it is ready to receive the file, start the XModem protocol on your terminal emulator. You want to send your router the backup file of the original IOS image for your router. After the XModem transfer has finished (which could take a little while over serial lines), the router will restart with the version of the IOS you sent it. You are not finished yet, though.
The remainder of today's lesson will introduce you to the IOS and its commands and functionsskills that you will need for successfully retaining and understanding the information provided in the remaining lessons). Before we examine the command set of the Cisco IOS, let's look at how the user interface (UI) is organized.