O'Reilly logo

Cisco IOS Cookbook, 2nd Edition by Ian Brown, Kevin Dooley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introduction

The Internet Protocol (IP) seemed ubiquitous three years ago when we wrote the first edition of this book. It was then, as it still is today, the basis of the public Internet as well as nearly all corporate, institutional, educational, and home networks. But somehow it has managed to take on an even more important role than it ever had before.

It now seems almost quaint to find a cellphone that doesn’t have its own web browser, for example. And while the delivery method of choice for WANs was Frame Relay and ATM when we wrote the first edition, it is now MPLS, an IP protocol.

For its part, Cisco has continued to be the dominant network hardware vendor in all but a few niches, and has even edged out a few of its competitors. This has been partly due to excellent marketing, but we see a large part of its success in the Internetwork Operating System (IOS) that runs on most of their routers and switches. Cisco has done a great job of producing new IOS versions with new features, and in keeping this software relatively stable and bug free through frequent incremental software releases.

Of course, these new features and new software versions mean that writing books like this one is a little bit like running a dairy; nobody wants last week’s product. Keeping up with Cisco is hard work, but we think that this new edition has captured many of the most important and useful new IOS features.

Our benchmark software version for this edition is 12.4. The vast majority of the recipes in the book will in fact run on earlier versions, and we have noted version numbers when features have been introduced recently. Many of the recipes in this edition were also present in the previous edition, but we have reviewed and updated every chapter. We also added 89 new recipes throughout the book.

Many people wrote to us after the first edition with comments and suggestions. We have been able to include just about all of these suggestions in the current edition, and we sincerely hope that you will find this new edition as useful as the previous one.

IOS

You can think of a Cisco router as essentially a special purpose computer. It has its own operating system, which is called Internetwork Operating System (IOS), and even has files and filesystems. So we will start this book with a discussion of the basic system administration functions that a router engineer needs to know. This will include important matters such as how to manage your router’s filesystems, upgrading the operating system, doing backups, and restoring the system configuration.

Cisco routers use flash memory, rather than disks, for storing information. Flash storage media is significantly more expensive and slower than disk storage, but the amount of storage needed to run a router is relatively small, compared to the amount needed to run a general-purpose computer. So this is not a serious problem. Flash has the important benefit that it tends to be more reliable than disk storage.

Flash storage is similar to Random Access Memory (RAM), but it doesn’t need power to retain information, so it is called nonvolatile. Unlike Read Only Memory (ROM), you can erase and rewrite flash easily. Technically, there are other types of nonvolatile solid state storage, such as Erasable Programmable Read Only Memory (EPROM) and Electronically Erasable Programmable Read Only Memory (EEPROM). EPROM is not suitable for routers because it generally requires an external device, such as an ultraviolet light shone through a window on the chip to erase it. EEPROM, on the other hand, can be erased by simply sending an erase signal to the chip. But there is a key difference between EEPROM and flash memory. When you erase something from an EEPROM device, you must erase the entire device, while flash devices allow selective deletion of parts of the medium.

This is an important feature for routers because you don’t always want to erase the entire storage medium just because you want to erase a single file. In Recipes 1.11 and 1.12, we will discuss ways that you can erase single files on some types of routers, depending on the type of filesystem used.

There are at least two main pieces of nonvolatile storage in a Cisco router. The router’s configuration information is stored in a device called the Nonvolatile RAM (NVRAM), and the IOS images are stored in a device called the flash. It’s important to keep these names straight because, of course, all flash memory is nonvolatile RAM. And, in fact, most routers use Flash technology for their nonvolatile RAM. So it’s easy to get confused by the terms.

On most Cisco routers, the NVRAM area is between 16 Kb and 256 Kb, depending on the size and function of the router. Larger routers are expected to have larger configuration files, so they need more NVRAM. The Flash, on the other hand, is usually upgradeable, and can be anywhere from a few Megabytes to hundreds of Megabytes.

We often talk about a router’s configuration file, but in fact there are two important configuration files on any router. There is the configuration file that describes the current running state of the router, which is called the running-config. Then there is the configuration file that the router uses to boot, which is called the startup-config. Only the startup-config is stored in NVRAM. So it is important to periodically check that the version of the configuration in the NVRAM is synchronized with the version that the router is currently running. Otherwise you could get a surprise from ancient history the next time the router reboots. You can synchronize the two configuration files by simply copying the running-config onto the startup-config file:

Router1#copy running-config startup-config

Many Cisco engineers, including the authors, still use the old-fashioned version of this command out of force of habit:

Router1#write memory

This command is not only deprecated, however, but is also less descriptive of what the router is doing.

The router uses the larger flash storage device for holding the operating system, or IOS. Unlike the operating systems on most computers, the IOS is a single file containing all of the features and functions available on the router. You can obtain the IOS image files from Cisco either on CD or, if you have an account on their system, you can download IOS files from the Cisco web site by using File Transfer Protocol (FTP) over the public Internet.

Most examples throughout this book assume that you have IOS Version 12. However, many features we discuss are available in earlier versions. And we expect that Cisco will continue to support all of the features we describe well into the future, although there may be slight syntax changes. It is important to be flexible because, if you work with Cisco routers a lot, you will encounter a large variety of different IOS versions, with various subtle differences. Unfortunately, some of these subtle differences are actually bugs. Cisco offers a detailed bug tracking system on their web site for registered users.

When you go to change an IOS version on a router, there are several important things to consider. First is the feature set. For each IOS release, Cisco produces several different versions. There is usually an Enterprise Feature Set, which includes essentially all of the different feature options available at a given time. But because the IOS is a monolithic file containing all features and all commands, the Enterprise IOS files are usually quite large. The Enterprise version is also usually much more expensive than the various stripped-down versions.

The simplest IOS versions are usually the IP Only Feature Set. As the name suggestions, this only includes TCP/IP based functionality. In most networks, you will find that the IP Only Feature Set is more than sufficient. In fact, almost all of the recipes in this book will work with the IP Only version of IOS.

There are several other important variations such as IP Plus, IP Plus IPSec 56, IP Plus IPSec 3DES, and so forth. The contents of these different versions (and even their names, to some extent) vary from release to release. We encourage you to consult Cisco’s feature matrices to ensure the features you need are in the IOS version you have.

One of the most important considerations with any IOS release is whether you have sufficient RAM and Flash memory to support the new version. You can see how much storage your router has by looking at the output of the show version command.

The other important thing to remember about IOS images on Cisco routers is that every router has a fallback image located in the router’s Read Only Memory (ROM). This IOS image cannot be changed or upgraded without physically replacing the ROM chips in the router.

The router’s ROM contains three items: the power on self test (POST), the bootstrap program, and a stripped-down version of the router’s Operating System. The router uses the bootstrap program while booting. The IOS image in ROM is usually an extremely stripped-down version that frequently doesn’t support common features such as routing protocols, for example. In the normal boot cycle, the router will first load the POST, and then the bootstrap program, followed by the appropriate IOS image. Please refer to Recipe 1.7 for more information about booting from different IOS files.

Recipe 1.7 also shows how to adjust the configuration register values. These values tell the router a variety of boot options, and even allow you to force the router to stop its boot process before loading the IOS. This can be useful if the IOS image is corrupted, or if you need to do password recovery.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required