Routers and Routing Basics CCNA 2

advertisement
Routers and Routing Basics CCNA 2
Chapter 5
www.ciscopress.com
Introduction
 The first half of this chapter reviews the boot process
 The second half examines several topics relating to how
to copy files to and from the router
www.ciscopress.com
2
Managing Cisco IOS Software
Router Boot Sequence and Loading Cisco IOS Images
Choosing the Cisco IOS Image During the Router Boot Sequence
Troubleshooting and Verifying the Choice of Cisco IOS
Managing Cisco Router IOS and Configuration Files
Cisco IOS File System
Cisco IOS Filenames
Copying and Managing Cisco IOS Images
Copying and Managing Cisco IOS Configuration Files
Recovering from Lost Passwords
Summary
www.ciscopress.com
3
Introduction
 Routers perform several functions at initialization, including picking
which Cisco IOS image to load into RAM and use.
 The final initialization step relates to how the router finds and picks a
configuration file to use, typically the startup-configuration is file
stored in NVRAM.
 To do both steps, the router must find, copy, move, and manipulate
files that hold IOS images and files that contain configuration
commands.
 This chapter closely examines the options and processes that
routers use to manage these types of files.
www.ciscopress.com
4
Router Boot Sequence and Loading
Cisco IOS Images
When an engineer first powers on or reboots a router, the router goes through
a four-step process:
1. Perform a power-on self test (POST).
- The POST process happens automatically, performing basic hardware
tests.
2. Load a bootstrap program.
- The bootstrap program completes the hardware testing and initializes
software in the router.
3. Load an IOS.
- The router loads an IOS image, enabling the router to route IP packets.
4. Load a startup configuration file.
- The router loads an initial configuration file, which tells IOS the parameters
it needs to know – things like IP addresses and routing protocols to use – so
that the router can successfully route packets.
- The last three steps require the router to copy the files into RAM,
www.ciscopress.com
5
Moving the Bootstrap, IOS, and
Configuration Files into RAM
In most networks
 all the routers simply load the
startup-config file in NVRAM into
RAM as the Running-config file
during the initialization process.
 in other networks, each router
may have different settings that
affect how each router picks
which IOS file to load.
www.ciscopress.com
6
Configuration Register
 The configuration register is a 16-bit register that Cisco
routers store in a hidden area of NVRAM that is not part
of the startup-config file.
 The configuration register’s value tells the router facts
about several operating parameters including
 Which IOS to load: the full image, ROMMON or RXBoot.
 The speed of the router console port.
 Whether or not to use the configuration file
www.ciscopress.com
7
Changing and Viewing the
Configuration Register’s Value
 The configuration register can be viewed using the show
version command.
 The configuration register can be set in two of ways,
 The most commonly used way to set its value is to use the
config-register global configuration command.
 It can also be set from Rommon Mode
 When you set the configuration register’s value, the
value is used only after the router is reloaded.
www.ciscopress.com
8
Changing and Viewing the Configuration
Register’s Value (Continued)
Example shows the (default) value of the configuration
register, the user changing the value, and the show
version command stating that the new value will not be
used until the next reload.
www.ciscopress.com
9
Changing and Viewing the Configuration
Register’s Value (Continued)
The current value at the end of the example shows the
Current setting (hex 2102) and the setting that will be used
at the next reload of the router (hex 2101).
www.ciscopress.com
10
How Routers Use the Boot Field
to Choose an IOS (Continued)
www.ciscopress.com
11
Choosing the Cisco IOS Image During
the Router Boot Sequence
Routers use the following logic to attempt to load an IOS:
1. Load a limited-function IOS based on whether the
configuration register’s last hex digit is set to 0 or 1.
- Engineers can use Step 1 when performing certain maintenance;
the OSs loaded at this step cannot route packets, but they can be
used for some useful functions, such as password recovery.
2. Load an IOS based on the configuration of boot system
commands in the startup-config file.
www.ciscopress.com
12
Choosing the Cisco IOS Image During the
Router Boot Sequence (Continued)
3. Load the first file in flash memory as the IOS.
- Routers almost always pick their IOS based on either Step 2 or Step 3.
Step 2 and 3 give engineers plenty of choices of how they can make the
router load the correct IOS for normal operation of the router
4. Use TFTP broadcasts to find a TFTP server, and download
an IOS from that server.
5. Load a limited-function IOS from ROM.
- Steps 4 and 5 exist mainly as fail-safe mechanisms when the first three
steps do not work.
www.ciscopress.com
13
The Boot Field
 Routers use the 4 low-order bits of the configuration
register as the boot field.
 The boot field tells the router what to do in its first of the
five decision steps (Slides 11, 12).
 Depending on the value of the boot field and the model
of the router, a router can choose to load ROMMON,
load RXBoot, or move on to a later step in the five-step
list for choosing an IOS to load.
www.ciscopress.com
14
Comparing ROMMON
and RXBoot OSs
Only older routers, such as the Cisco 1600 and 2500 series routers,
have an RXBoot IOS in ROM. Later, Cisco added all the features of the
RXBoot IOS to ROMMON, so newer routers do not need (and do not
have) an RXBoot IOS.
www.ciscopress.com
15
How Routers Use the Boot Field
to Choose an IOS
 If the router loads either ROMMON or RXBoot software,
the process is complete, waiting for the network engineer
to do whatever low-level maintenance function needs to
be done.
 However, depending on the configuration register
settings, the router may simply move on to Step 2 or
even Step 3 of the process of finding an IOS to load.
 The most production routers default to use a boot field of
2, because the configuration register defaults to 0x2102,
which tells the router to load the IOS
www.ciscopress.com
16
How Routers Use the Boot Field
to Choose an IOS (Continued)
Software Configuration Bit Meanings
Bit No.
00-03
06
07
08
10
11-12
13
14
15
Hex
0x0000-0x000F
0x0040
0x0080
0x0100
0x0400
0x0800-0x1000
0x2000
0x4000
0x8000
Meaning
Boot Field (see Table B-2)
Ignore NVM contents
OEM bit enabled
Break disabled
IP broadcast with all zeros
Console line speed
Boot default ROM software if network boot fails
IP broadcasts do not have net numbers
Enable diagnostic messages and ignore NVRAM
contents
www.ciscopress.com
17
How Routers Use the Boot Field
to Choose an IOS (Continued)
Explanation of Boot Field (Configuration Register Bits
00-03)
Boot Field
Meaning
00
Stays at the system bootstrap prompt
01
Boots system image on EPROM
02-F
Specifies a default netboot filename
Enables boot system commands that override default
netboot filename1
www.ciscopress.com
18
Choosing the Cisco IOS Based on
boot system Commands
 The router looks in the startup-config file for any boot
system commands and loads the IOS file listed in the
commands.
 The boot system command may fail for one of several
reasons:
- mistype of a long filename
- IOS file erased from flash memory by mistake
- the file may be corrupted
- hardware error trying to access flash memory.
www.ciscopress.com
19
Choosing the Cisco IOS Based on
boot system Commands (Continued)
Cisco routers provide a couple of ways to prepare for cases
in which the router fails when trying to load the IOS listed in
a boot system command:
1. Configure multiple boot system commands, and the
router will try each of them sequentially until one of them
works.
2. After the router has tried all the boot system
commands, it moves on to Step 3, in which the router
attempts to load the first file it finds in flash memory, no
matter what its name is.
www.ciscopress.com
20
Configuring Multiple boot system
Commands
Example 5-2 shows a typical case of how to use multiple boot
system commands in a single configuration.
The configuration shows the following four boot system
commands, with the three extra commands giving the
engineer extra protection against potential problems.
www.ciscopress.com
21
Configuring Multiple boot system
Commands (Continued)
1. The first boot system command simply references the specific IOS
image in flash memory.
2. To be ready for the possibility that the file may be accidentally erased,
the boot system tftp command points to a TFTP server at IP address
10.1.1.1, but with the same filename. In that case, the router attempts
to contact the listed TFTP server, transfer a copy of the same IOS file,
and load that into RAM.
3. The boot system flash: command next tells the router to look in flash
memory, find the first file in flash (more on what “first file” means in the
next section), and load that file as the IOS.
4. If all these commands fail, the router attempts to use the last boot
system command, boot system rom, which tells the router to load
ROMMON. This last step would then allow to begin the process of
recovering and copying the erased IOS file back into flash.
www.ciscopress.com
22
Configuring Multiple boot system
Commands (Continued)
 If you add or change boot system commands the copy runningconfig startup-config command in the example is needed so that
the boot system commands will not be lost when the router is
rebooted.
 If the router loads the IOS from the TFTP server based on the
second boot system tftp command, the IOS is copied from the
server, into RAM, and used; the file is not stored in flash.
 If you later add another boot system command, it is added to the
end of the list of boot system commands. If you want to add a new
command to the middle of the list instead of the end of the list, you
must delete some of the commands by using the no boot system
command, add the new boot system command, and then add the
previously deleted commands back into the configuration.
www.ciscopress.com
23
Loading the First File in Flash Memory
When a router fails to find and successfully load an IOS at Step 1 or 2,
it then tries one last time to find an IOS in flash memory.
The router looks in flash, finds the first file in flash, and attempts to use
that file as the IOS.
Example shows the output of a show flash command on router R1 with
the first file in flash (number 1 on the left).
www.ciscopress.com
24
Broadcasting to Find a Cisco IOS
on a TFTP Server
 Most routers have been configured so that they choose their IOS
images at Step 2 or Step 3.
 Step 4 provides the router with one final effort to find and load an IOS.
 At this step, the router broadcasts on all interfaces to which a cable
has been attached, looking for a TFTP server.
 If found, the router asks the TFTP server to send the router a specific
file, with the file using a standard name based in part on the router’s
hostname, and in part on the configuration register value.
www.ciscopress.com
25
Broadcasting to Find a Cisco IOS
on a TFTP Server
 Step 4 (TFTP) provides the router with one final effort to find and load
an IOS.
 At this step, the router broadcasts on all interfaces to which a cable
has been attached, looking for a TFTP server.
 If found, the router asks the TFTP server to send the router a specific
file, with the file using a standard name based in part on the router’s
hostname, and in part on the configuration register value.
www.ciscopress.com
26
Loading a Limited-Function OS
from ROM
If the router has given up trying to load a fully functional
IOS, it goes ahead and loads one of the limited-function
OSs, as follows:
 If the router has an RXBoot OS (only on older routers), the router
loads the RXBoot image.
 If the router does not have an RXBoot OS, the router loads
ROMMON.
In both cases, the OS loaded by the router can copy an IOS from a
TFTP server or copy an IOS image from a PC attached to the console.
www.ciscopress.com
27
Troubleshooting and Verifying
the Choice of Cisco IOS
Routers fail to load an IOS, or load the wrong IOS, for a variety of reasons:
- the configregister and boot system commands may have been
configured to incorrect values
- if the boot system commands are configured correctly, the files may
simply be missing from flash memory, or the file may not be on the TFTP
server.
When referencing a TFTP server, other problems could occur:
- the router may not have a working IP route to reach the TFTP server
- the TFTP server software may not be running at the time
- the router has hardware problems that prevent flash memory from
working.
www.ciscopress.com
28
Determining Wrong IOS
When the router has a possibly wrong IOS loaded, first look at the two
configurable items that impact the five-step IOS decision process: the
configuration register and the boot system commands.
See the configuration register only by looking at the output of the show
version command; the show running-config and show startup-config
commands do not list the value of the configuration register.
After examining the configuration register, examine the boot system
commands in the startup-config file by using the show startup-config
command.
It is important to look at the startup-config file, because the boot system
commands will not be used until the router reboots, and the running-config
file will be lost when the router reboots.
www.ciscopress.com
29
Determining Which Steps Failed
After you determine which specific IOS images the router
will attempt to load, verify that the files are there and
accessible.
Consider the following examples:
 For any boot system flash:filename commands, you should verify
that the file with that name is in flash, with the same spelling and
capitalization. The names are case-sensitive.
 For boot system tftp filename ip-address commands, you should
verify that the correctly spelled filename is on the TFTP server, that
TFTP server software is installed and running on that computer, and
that the router can ping the server’s IP address.
www.ciscopress.com
30
Determining Which Steps Failed
(Continued)
 For a boot system flash command, with no filename listed, make
sure the lowest numbered file in flash is the IOS file that you want to
load.
In some rare cases, the router hardware may have a problem and be
unable to read the contents of flash memory. In these cases, it may be
best to simply call the Cisco Technical Assistance Center (TAC) and
get advice on how to attack the problem.
www.ciscopress.com
31
Cisco IOS File System
IOS has a file system, named the Cisco IOS File System (IFS).
Three general types of files defined and stored by IOS using the IFS:
www.ciscopress.com
32
Variations of Configuration
Commands Styles
The file system created by Cisco IOS has gone through three major
design steps over the years.
As a result, today’s most current IOS releases support three variations
of commands that reference the configuration files:
 The pre-Version-10.3 style
 The new style as of Version 10.3 (which is the most commonly used
style)
 The style of commands that use the full IFS names for the
configuration files.
www.ciscopress.com
33
Recently Added Styles
of Configuration File Commands
The last column of Table
lists prefixes added to IOS
as part of the IFS.
These prefixes have
the same sort of meaning as
a drive letter with a PC’s OS.
For example, a PC’s hard
disk drive may be drive letter
C:.
With IFS, nvram: of course
refers to NVRAM, and
system: refers to system
files held in RAM, including
the running-config file.
www.ciscopress.com
34
Cisco IFS File System Prefixes
Table lists the prefixes defined by IFS, along with
a brief description.
www.ciscopress.com
35
Cisco IOS Filenames
Cisco supports a very large set of customer requirements. As a result,
Cisco offers a large number of different IOS files to its customers.
IOS files differs from each other with the four main points:
1. The differences in Cisco IOS versions and releases.
To support the various versions and releases, Cisco must create different
files for each IOS version number and, inside that version, for each
maintenance release.
2. The differences between router model series/Cisco IOS platforms.
3. The differences in Cisco IOS feature sets.
4. Other minor differences, including whether the IOS is compressed or
relocatable.
www.ciscopress.com
36
Common IOS Feature Sets
 IP Base—Provides basic IP routing functions, including all the
features covered in this book.
 IP Voice—Supports the same features as IP Base, plus support for
voice sent inside IP packets (voice over IP, or VoIP).
 IP/FW 3DES—Includes the features of IP Base, plus a firewall
feature and Triple Digital Encryption Standard (3DES) encryption.
This feature set provides many security features.
 IP/ADSL/IPX/AT/IBM Plus—Includes IP, IPX, and AppleTalk (AT)
routing, support for many proprietary protocols from IBM, and
support for asymmetric DSL (ADSL), which is the type of DSL most
typically found installed in the United States today.
 Enterprise Services—Includes most every feature used in the
largest enterprises.
www.ciscopress.com
37
Multiple File Formats of IOS Files
The file format differs mainly on two features:
- Whether the file is compressed
Compressed IOS files require less space in flash memory, but
they require more time when the router reboots, because the
router has to uncompress the file before loading it.
- Whether the file is relocatable
With a relocatable IOS file, the router does not have to copy the
whole IOS into RAM, instead leaving most of it in flash memory,
which saves some space in RAM. IOS files that cannot be
relocated must be fully copied into RAM when the IOS is loaded.
www.ciscopress.com
38
Cisco IOS Filenames
(Continued)
Cisco names the IOS files so that all four different items
are implied by the name.
www.ciscopress.com
39
Copying IOS Files Using
copy Command
The IOS copy command provides a way to copy files to
and from flash memory in the router and a server in the
network. It supports three main protocols:
1. Trivial File Transfer Protocol (TFTP)
2. Remote Copy (RCP)
3. File Transfer Protocol (FTP)
TFTP tends to be the most commonly used option, and it
has been supported in IOS longer than RCP and FTP.
www.ciscopress.com
40
Copying from TFTP Server
into Flash Memory
1. The user enters the copy tftp flash
command.
2. The router asks for the hostname or IP
address of the TFTP server and waits for a
response.
3. The user enters 192.168.119.20 and
presses Enter.
4. The router asks for the name of the
source file to be taken from the TFTP
server and waits for a response.
5. The user enters C2600-js-l_121-3.bin,
presses Enter.
6. The router asks for the name it should
use when storing the file in flash memory,
which defaults to the same name as the
source file, as shown in brackets. The
router then waits for a response.
www.ciscopress.com
41
Copying from TFTP Server
into Flash Memory (Continued)
9. The user presses Enter, taking the
default action of erasing all the flash files.
10. The router asks if the user is sure
about erasing flash memory, again asking
the user to confirm.
11. The user presses Enter, taking the
default action of erasing flash memory.
7. The user presses Enter to accept
the default of using the same filename.
8. The router displays several lines
and then asks if the user wants to
erase flash memory before copying
the file. The router then waits for a
response.
12. The router erases flash memory and
then copies the file. Progress on the
erasure of flash memory is shown by the
router’s displaying another e every few
seconds, and progress on the copy is
shown by displaying another ! every few
seconds.
www.ciscopress.com
42
Copying Using the ROMMON
tftpdnld Command
The ROMMON tftpdnld command can work only if the
following conditions are met:
 The IP network is working well enough that the broken
router can send IP packets to and from a TFTP server.
 The TFTP server has the appropriate IOS file available
for download.
www.ciscopress.com
43
Copying Using the ROMMON
tftpdnld Command (Example)
(continued)
www.ciscopress.com
44
Environment Variables Needed for the
tftpdnld Command
www.ciscopress.com
45
Copying Using ROMMON
and Xmodem
 The Xmodem protocol defines a method to transfer files
over an asynchronous serial line.
 Xmodem was first created to support transferring files
over dialed links that used modems.
 Because the word “transfer” was frequently abbreviated
as “xfer,” Xmodem seemed like a good short name for a
protocol for transferring files using modems and dialed
serial links.
www.ciscopress.com
46
Copying Using ROMMON
and Xmodem (Continued)
To transfer an IOS file into a router using the Xmodem
protocol, you need three basic components:
1. A router running ROMMON software so that the
ROMMON xmodem command can be used.
2. A PC with the IOS file and a terminal emulator that
supports Xmodem—for example, HyperTerminal.
3. A connection between a PC and the router that connects
to the router’s console or the aux ports.
www.ciscopress.com
47
Copying Using ROMMON
and Xmodem (Continued)
 Using Xmodem to copy a new IOS into a router’s flash
memory should be your last resort when trying to get an
IOS to load into a Cisco router.
 The first option is to use the IOS copy command to copy
the correct IOS into flash, assuming you can get some
copy of IOS up and working.
 If the router cannot load an IOS directly, using ROMMON
and the tftpdnld command is the next best option, but this
option requires a working IP network and working TFTP
server.
 The Xmodem option works when no IOS will load in the
router and when there is no IP connectivity between the
router and a TFTP server.
www.ciscopress.com
48
Components Required for Xmodem
Transfer over the Console
 Transferring an IOS using Xmodem, with the default console speed,
Is a very slow process.
 To speed up the process, you can change the speed of the console port
up to its maximum speed of 115.2 kbps.
www.ciscopress.com
49
Setting the Configuration Register
from ROMMON
 To change the speed, you must
change the value of the configuration
register; to change the register from
ROMMON, you need to use the
ROMMON confreg command.
 The confreg command prompts the
user with a series of questions.
 The answers to the questions tell
ROMMON to what value the configuration register should be changed.
 As it turns out, the console speed
can be changed by changing some of
the bits in the configuration register.
www.ciscopress.com
50
Setting the Configuration Register
from ROMMON (Continued)
 Example above focuses on how to set the console bit rate to a
different value, but the command allows the user to change any
of the bits in the configuration register.
 Note that the configuration register does not immediately change. It
requires a reset or power off/on to take effect, just like when setting
the configuration register using the IOS config-register command.
 When you do reload the router, the console bit rate changes, so the
Terminal emulator settings also need to be changed to match the
same speed – in this case, 115.2 kbps.
www.ciscopress.com
51
Steps Used by the xmodem Command
A Router Preparing to Receive
a File Using ROMMON’s
xmodem Command
Regardless of the console speed,
the transfer of the IOS file from the
PC to the router’s flash memory
requires two basic steps:
Step 1 The engineer issues the
ROMMON xmodem command to
prepare the router to receive the file.
Step 2 The engineer tells the
terminal emulator to send the file
using Xmodem.
www.ciscopress.com
52
Starting an Xmodem File Transfer
Using a Terminal Emulator
www.ciscopress.com
53
After Transfer is Done
To get the router working again, you need to follow these steps:
Step 1 Use the confreg command to reset the configuration
register to its original setting.
Step 2 Use the reset command to reload the router (or turn it
off and then on).
Step 3 Change back the terminal-emulator configuration to
use a speed of 9600 bps.
www.ciscopress.com
54
Verifying Cisco IOS Images
The two main types of information about IOS images
include the following:
1. Information about the IOS that the router is currently
using.
2. Information that determines what IOS images the router
will attempt to load the next time it reboots.
www.ciscopress.com
55
Important show Commands When
Working with IOS Files
www.ciscopress.com
56
Key Items in the Output of the
show version Command
The show version command lists most of the information relevant to
examining IOS files.
www.ciscopress.com
57
Copying and Managing Cisco
IOS Configuration Files
 IOS includes two main configuration files:
1. startup-config—Stored in NVRAM and holds the
configuration that will be used the next time the router reloaded.
2. running-config—Sits in RAM and holds the configuration
commands currently being used in the router.
 Copying the configuration to a computer allows the engineer to keep
backup copies of the configuration.
 Copying the configuration into the running-config file may give the
engineer a more convenient method for typing and adding
configuration commands to routers.
www.ciscopress.com
58
Copying Configuration Files Using the
IOS copy Command
The process of copying configuration files between a router
and a TFTP server requires that you use:
- the copy tftp running-config command to the file from
the server into the running-config file
- the copy running-config tftp command to the file from
the router’s running-config file to the TFTP server.
www.ciscopress.com
59
Copying Configuration Files Using the
IOS copy Command (Continued)
Copying to and from a TFTP Server Step 1 Enter either the copy tftp
running-config or copy runningconfig tftp command, and press
Enter.
Step 2 Respond to the prompt with the
IP address or hostname of the TFTP
server, and press Enter.
Step 3 Respond to the next prompt
with the filename to be used on the
TFTP server, and press Enter.
Step 4 Respond to the third prompt by
simply pressing Enter to confirm that
you want to transfer the file.
www.ciscopress.com
60
Copying Configuration Files Using
Copy and Paste
 Most Windows-based applications have a copy-and-paste feature
that makes it easy to duplicate text between applications. Because
configuration files are all text-based, they can be copied and pasted
as well.
 There are two variations on how to use the copy-and-paste feature
of a PC to copy configuration commands to and from the runningconfig file in a router:
- use a text-editor window and a terminal-emulator window,
copying the text between the two
- use some text-capture and text-sending features typically
included in most terminal emulators.
www.ciscopress.com
61
Copy and Paste Between the Emulator
and a Text Editor
 Every PC OS supports a variety of applications called
text editors. All of these applications allow the user to
enter text into the editor, change the text, and save the
file as text file.
 For example, Notepad on Microsoft OSs is relatively
simple, while Microsoft Word is quite sophisticated.
 For the purpose of copying the configuration to and from
a router, a simple text editor such as Notepad will work
just fine.
www.ciscopress.com
62
Entering Commands into a Text Editor
and Copying the Command Text
Use Notepad (or any other editor) to
enter configuration commands:
select and copy the text. After that the
PC is ready to paste the text into
another window.
The picture shows a window from a
PC, with the Notepad editor.
The user has entered four
configuration commands, selected the
text, and is ready to select the Copy
function on the Edit menu.
www.ciscopress.com
63
Pasting Text into a Terminal-Emulator
Window
When the PC has a copy of the text
that was shown in the text-editor
screen, the user can paste the text
into another window.
To add the configuration commands
to a router’s configuration:
- log in to the router using a terminal
emulator, from that same PC, and get
into configuration mode.
- in configuration mode use the Paste
feature of the OS, which sends the
text to the chosen window—in this
case, the terminal emulator.
Pasting the text into the window
works just like someone typing the
exact same text into the window.
www.ciscopress.com
64
Using copy-and-paste
 When configuring the same commands on many routers, you can
enter the commands into an editor on the PC and then copy and paste
the commands into several routers’ configurations,
saving time and effort.
 You can also copy from the terminal-emulator window and paste the
text into the text editor to make backup copies of the configuration.
 While performing labs during the class, you can easily copy and paste
from the terminal emulator into an editor such as Notepad and then
save the file on your PC for later reference.
www.ciscopress.com
65
Using a Terminal Emulator’s
Text Capture Feature
 Most terminal emulators have a feature (that is the a
variation of the copy-and-paste process) by which you
can tell the emulator to capture all text displayed by the
emulator and then put the text into a text file.
 Emulators also typically have a feature by which you can
tell the emulator to take the content of a text file and
send it into the window as if you had entered all the text
in the file into that window.
www.ciscopress.com
66
Using a Terminal Emulator’s
Text Capture Feature (Continued)
These two features together allow network engineers to use a simple
three-step process to back up the configurations of routers:
Step 1 Use the emulator’s text-capture feature to capture the output of
a show running-config or show startup-config command.
Step 2 Because the capture process may capture extraneous
characters or other unneeded text, edit the file to prepare it to be
used as a backup configuration file.
Step 3 Should the router ever lose its configuration, use the emulator’s
“send text file” feature to send the contents of the backup
configuration file back to the router and into configuration mode.
www.ciscopress.com
67
Using a Terminal Emulator’s
Text Capture Feature (Continued)
For Step 1, you need to use the emulator’s text-capture feature to capture the
output of a show running-config command.
The following list describes how to use the text-capture feature of
the HyperTerminal emulator to make a backup copy of the running-config file:
Step 1 In the HyperTerminal window, choose Transfer > Capture Text.
Step 2 Specify the name for the text file to the capture configuration.
Step 3 Click the Start button to start capturing text.
Step 4 Display the configuration to the screen by entering show runningconfig.
Step 5 Press the Spacebar when each --More-- prompt appears, which
continues with the configuration until the end is reached.
Step 6 When the complete configuration has been displayed, stop the capture
by choosing Transfer > Capture Text > Stop, as shown in Figure 5-7.
www.ciscopress.com
68
Stopping the HyperTerminal
Text-Capture Feature
If the user has already started the
text capture, so the menu shows
only an option to stop the current
capture.
If no text capture were currently in
progress, the menu would list a
Start option instead.
www.ciscopress.com
69
Editing File From Notepad
To edit the file from Notepad, complete the following steps:
Step 1 Open the Notepad application. (On Microsoft OSs, go to Start >
Run, enter notepad, and click OK).
Step 2 Select File > Open.
Step 3 Find the captured file and select it.
Step 4 Click Open.
The following types of lines typically need to be deleted to be ready to paste the
configuration back into the router:
show running-config
Building configuration...
Current configuration:
- More Any lines that appear after the word End
www.ciscopress.com
70
Additional Features
 You can also add comment lines to document the configuration.
When you are pasted back into the router, the router ignores and
discards the comment lines, but they are useful when reviewing the
file on your PC.
 To add a comment line, simply add a new line to the file, with the
first character being an exclamation mark (!).
 Additionally, you may also want to add the no shutdown command
under each interface so that when the configuration is pasted back
into the router, the router attempts to bring up each interface.
 Finally, don’t forget to save the file. With Notepad, choose
File > Save.
www.ciscopress.com
71
Restoring Backup Configuration
That last step occurs when you want to add the configuration back into
the router. You can then restore the backup configuration from a
HyperTerminal session by using the text-transfer feature:
Step 1 Log in to the router using HyperTerminal.
Step 2 Go into router global configuration mode.
Step 3 From the HyperTerminal window, choose
Transfer > Send Text File.
Step 4 Select the name of the file for the saved backup configuration.
www.ciscopress.com
72
Restoring Backup Configuration
(Continued)
Step 5 The lines of the file are entered into the router as if they are
being typed. Look for any errors.
Step 6 After the configuration is entered, press Ctrl-Z to exit global
configuration mode.
Step 7 Restore the startup configuration with
copy running-config startup-config.
www.ciscopress.com
73
Recovering from Lost Passwords
 If you forget the console, telnet, and enable passwords on a router,
you need to find a way to get back into the router and reset or
recover the passwords.
 The password recovery process requires reboot the router and tell it
to ignore the configuration in NVRAM. If the router manages to boot
without using the configuration in NVRAM, the router will not have
any passwords configured – it will have nothing configured.
 From that point, the engineer can log in from the console and get
into enable mode, and the router will not request a password.
 Then the engineer can reconfigure new passwords or display any
unencrypted passwords using the show startup-config command.
www.ciscopress.com
74
Password Recovery Process
The overall password recovery process runs like this:
Step 1 Connect to the console of the router.
Step 2 Reload the router (or turn it off and back on).
Step 3 Press the Break key on the keyboard in the first 30 seconds of
the reload.
Step 4 When the router responds by entering ROMMON mode, change
the configuration register (with the confreg ROMMON command) to
tell the router to ignore the startup-config file. (Typically, that means
setting the configuration register’s third octet to 4—for example,
0x2142.)
www.ciscopress.com
75
Password Recovery Process
(Continued)
Step 5 Reload the router (typically using the reset ROMMON command).
Step 6 When the router has completed booting, log in to the router from
the console, and enter enable mode.
Step 7 Use the copy startup-config running-config command to load
the configuration into the router.
Step 8 Enter configuration mode, and reconfigure new passwords.
 This list does not include every detail, but it does give the overall flow
of the process used on most every model of Cisco router.
 Go to Cisco.com and use the search tool to search for “password”
for detailed password recovery procedures.
www.ciscopress.com
76
Summary
 A Cisco router chooses the location from which it should load a
stored copy of an IOS image based on several rules:
- first, router attempt to load an IOS from flash memory;
- if that fails, the router attempts to load an IOS from a TFTP server;
- and if that fails, the router may have to load a limited-function OS
such as ROMMON or RXBoot.
 You can control this process by changing the boot field of the
configuration register (the last 4 bits, or last hex digit) using the configregister command, and by configuring boot system commands.
www.ciscopress.com
77
Summary (Continued)
 Under normal conditions, a router first looks for boot system
commands in the startup-config file
- if multiple boot system commands exist, the router attempts each
command, in order, until it manages to successfully load an IOS;
- if all the boot system commands fail, the router then attempts to
load the first file found in flash memory.
 To troubleshoot the boot process, look at the boot system commands
in the startup-config file by using the show startup-config command.
Additionally, look at the configuration register’s value as listed at the
end of the show version command output.
Note that the configuration register value changes only when the
router is reloaded.
www.ciscopress.com
78
Summary (Continued)
 Cisco creates the filenames of IOS files with four parts:
1. The hardware platform
2. A code that represents the feature set
3. A code that represents the file format
4. The version and release number
 Cisco routers use two internal configuration files: the startup-config
file and the running-config file. The startup-config file is stored in
NVRAM and is copied into RAM to be used as the running-config file
when the router is reloaded.
While configuring a router, periodically save the running-config file
using the copy running-config startup-config command, so the
files end up being identical.
www.ciscopress.com
79
Summary (Continued)
 It is useful and important to keep a backup copy of the configuration
files on an external device. The copy running-config tftp command
can be used to copy the configuration to an external
TFTP server.
 Use a text editor’s simple copy-and-paste mechanisms when logged
in to a router to copy the output of a show running-config
command into a file.
 Most terminal emulators support the ability to perform a text-capture
function, which causes the emulator to copy everything sent to the
screen into a text file.
www.ciscopress.com
80
Download