Cisco® Router Configuration & Troubleshooting - 3 - Initial Router ...

woonsocketpoliticalΔίκτυα και Επικοινωνίες

28 Οκτ 2013 (πριν από 3 χρόνια και 9 μήνες)

70 εμφανίσεις

Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup
Page
1
of
10
file://I:\chapters\z\zb196.html
3/21/01
[Figures are not included in this sample chapter]
Cisco® Router Configuration &
Troubleshooting
- 3 -
Initial Router Setup
Cisco routers come with no default configuration. Before you can use a Cisco router on a network,
you must program it with the configuration to accomplish your predefined tasks. This chapter
discusses the various programming options available to you. In addition, various command-line
programming modes are discussed.
Startup Script
When a Cisco router is first powered on and the bootstrap ROM has loaded the basic IOS image into
RAM, the nonvolatile RAM (NVRAM) is checked for a preexisting configuration. If no
configuration file is found, the bootstrap program executes the setup script from ROM. This setup
script asks a series of questions that are used to generate an initial router configuration. Each question
asked has a default answer associated with it. The default choice is displayed in brackets at the end of
the prompt.
Running the Setup Script
The setup script can be run from privileged command mode at any time. Privileged
EXEC mode (most often referred to as enable mode) is discussed later in this chapter.
Running the setup script on an already configured router will wipe out any configuration
parameters that are currently in place.
Listing 3.1 shows some of the questions asked during an initial router power-on. The setup program
determines which questions to ask based on the responses you give to the first few questions. For
instance, if you answer "yes" to the question "Configure IGRP routing?", the setup program will ask
questions during the interface configuration dialogs that allow it to generate a basic IGRP
configuration for those interfaces.
LISTING 3.1 Setup script example
-- System Configuration Dialog --
At any point you may enter a question mark ? for help.
Refer to the Getting Started Guide for additional help.
Default settings are in square brackets [].
Would you like to enter the initial configuration dialog? [yes]:
Configuring global parameters:
Enter hostname [Router]: test-r1
Enter enable password: cisco
Enter virtual terminal password: termpwd
Configure SNMP Network Management? [yes]: no
Configure IP? [yes]:
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 2 of 10
file://I:\chapters\z\zb196.html 3/21/01
Configure IGRP routing? [yes]: no
Configure DECnet? [no]:
Configure XNS? [no]:
Configure Novell? [no]:
Configure AppleTalk? [no]:
Configure Vines? [no]:
Configure bridging? [no]:
Configure MOP? [no]:
Configuring interface parameters:
Configuring interface Ethernet0:
Is this interface in use? [yes]:
Configure IP on this interface? [yes]:
IP address for this interface: 192.168.17.2
Number of bits in subnet field [8]:
Class B network is 192.168.0.0, 8 subnet bits; mask is 255.255.255.0
Configuring interface Serial0:
Is this interface in use? [yes]: n
Configuring interface Ethernet1:
Is this interface in use? [yes]:
Configure IP on this interface? [yes]:
IP address for this interface: 192.168.80.2
Number of bits in subnet field [8]:
Class B network is 192.168.0.0, 8 subnet bits; mask is 255.255.255.0
Configuring interface Serial0:
Is this interface in use? [yes]: n
After you've answered all the questions, the setup program generates the configuration file that
matches the answers you provided. You are then asked whether this configuration should be used to
program the router. You must answer "yes" or "no" to this question. There is no default choice.
Listing 3.2 shows the sample configuration generated by the setup program answers shown in Listing
3.1.
LISTING 3.2 A sample configuration generated from the setup program
hostname test-r1
enable password cisco
line vty 0 4
password termpwd
!
ip routing
!
interface Ethernet0
ip address 192.168.17.2 255.255.255.0
!
interface Serial0
shutdown
no ip address
!
interface Ethernet1
ip address 192.168.80.2 255.255.255.0
!
interface Serial1
shutdown
no ip address
!
end
Once the configuration has been loaded, the router displays the user EXEC mode prompt test-r1>.
You ll notice that the setup program doesn t ask you whether you would like to configure OSPF or
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 3 of 10
file://I:\chapters\z\zb196.html 3/21/01
BGP, or many other features that are available in the IOS. These other features must be configured
manually either through the privileged EXEC mode command-line interface or from a prebuilt
configuration file on a TFTP server or flash card.
The Number of Bits in the Subnet Field
When you're prompted for the number of bits in the subnet field during IP configuration
of an interface, the IOS determines the default option based on the class of the IP address
that you entered in the preceding question. The correct response is not very intuitive. The
actual response should be the number of bits to allow for wildcards in the subnet mask as
written in binary form. If the interface is being configured with an IP address from a /30,
the number of bits in the subnet field is 2.
Configuring from a TFTP Server
Another option available is to have a preexisting configuration file built on a TFTP server. In order to
copy the configuration file from the TFTP server to the flash RAM on the router, some basic
programming must be done on the router. It isn't possible to access a file on a TFTP server if network
connectivity isn't yet enabled on the router. Therefore, one interface on the router connected to a
network containing the TFTP server must be programmed and operating properly. (Chapters 4 and 5
discuss the various interface configurations.) Once this task has been accomplished, the following
command can be used to copy the configuration file from the TFTP server to internal flash memory
on the router:
copy tftp flash [file_id]
file_id is required on 7000 and 7500 series routers because they offer the use of PCMCIA flash cards.
The configuration file must be given a name in this case. There are two PCMCIA flash card slots on
the RP: RSP7000 and RSP series route processor cards. Remember from Chapter 2, "Cisco Routers:
An Overview," that the route processor cards handle all the router's administrative functions. These
functions include responding to SNMP queries and receiving and processing routing updates. Also, in
cases where VIP cards aren't used, the router processor is actually responsible for forwarding packets.
The file_id would be a combination of the PCMCIA flash card slot number and the actual filename
given to the configuration file, separated by a colon. For example, the following command would
copy the configuration file from a TFTP server to a file named config-router1 on the flash card in
slot0:
copy tftp flash slot0:config-router1
After this command is entered in IOS command-line enable mode (which is discussed later in this
chapter), a series of prompts allows you to define the IP address of the TFTP server, as well as the
filename on the TFTP server.
After the configuration file has been copied to the flash card, it must be moved into memory. The
following command copies the configuration stored on the flash card into RAM:
copy slot0:config-router1 running-config
Now that the configuration file has been loaded into RAM, it must be stored into NVRAM so that it
won't be lost should the router ever need to be reloaded. The following command copies the
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 4 of 10
file://I:\chapters\z\zb196.html 3/21/01
configuration from RAM to NVRAM:
copy running-config startup-config
Another option using a TFTP server is to copy the configuration file from the TFTP server directly to
RAM or NVRAM. The following example copies a configuration file from a TFTP server into
NVRAM. This procedure would be used to load a completely new configuration for your router that
will be made active after the next reload of the router:
copy tftp startup-config
The next example copies a configuration file from a TFTP server to RAM. This procedure would be
used to enable or modify options in the configuration currently running in the router. An example of
when this would be used is to add lines to an existing access-list or to enable SNMP on a router that
doesn't currently have it active:
copy tftp running-config
Replacing a Portion of the Configuration
Be aware that execution of this command probably doesn't do exactly what you think it
does. What actually happens is that the configuration file read from the TFTP server is
merged with the current running configuration. Anytime a configuration is copied from
an external source--be it a TFTP server, the local PCMCIA flash card, or RCP server--to
the running configuration, the file is combined with the current configuration in the
router's flash memory. For this reason, if your intent is to replace a portion of the existing
running configuration, you're better off storing the new full configuration with your
modifications in the NVRAM (startup-config) and then reloading the router.
Manual Configuration
Manual configuration of a Cisco router encompasses building the router configuration piece by piece.
This means that all options you want enabled need to be programmed without the use of an
interactive setup program.
This section outlines the Cisco IOS command modes mentioned in this book. The following is a
complete list of the command modes available in the Cisco IOS:
User EXEC mode
User privileged EXEC mode (enable mode)
Global configuration mode
Interface configuration mode
Subinterface configuration mode
Controller configuration mode
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 5 of 10
file://I:\chapters\z\zb196.html 3/21/01
Hub configuration mode
Map-list configuration mode
Map-class configuration mode
Line configuration mode
Router configuration mode
IPX-router configuration mode
Route-map configuration mode
Key chain configuration mode
Key chain key configuration mode
ROM monitor mode
APPN command mode
LANE database configuration mode
IBM channel attach command mode
Access to the interactive command mode on a Cisco router can be achieved via a number of different
means. The method most often used to connect to a Cisco router that hasn't been configured is via the
console port. The console port is a serial connection on the chassis of the router or the processor
board if the router is a model in one of the modular router families. The console port interface is
usually a male DB-25 serial connection, but it can also be an RJ-45-type connector, depending on the
model of the router. Any VT100 terminal or PC with a serial port and communications software can
be used to connect to the console port.
Access to a Cisco router can also be achieved via telnet from a remote host once the router is placed
into a network and the appropriate configuration for the network interfaces and VTY lines is made on
the router.
The auxiliary port (labeled AUX on the router itself) can be configured as an asynchronous serial line
and supports SLIP and PPP. Once the AUX port has been configured as an asynchronous serial port,
you can attach a modem and use it to access your router from a remote location over a dedicated
phone line.
The basic prompt given when you first connect to a Cisco router is the user EXEC prompt. It consists
of the router name followed by a greater-than symbol (>). If the router name hasn't been configured,
the prompt is router>.
In basic user EXEC mode, a subset of the Cisco IOS commands is available for execution. In order to
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 6 of 10
file://I:\chapters\z\zb196.html 3/21/01
gain access to the full set of IOS commands, you must enter user privileged EXEC mode. The enable
command is used to change from user EXEC mode to privileged EXEC mode.
If there is an enable password or a secret password configured on the router, the user is prompted for
the password before the privileged EXEC mode prompt is returned. The commands available in basic
user EXEC mode don't let you alter the system parameters. All commands that affect the system are
accessed via privileged EXEC mode. For this reason, it's a good idea to password-protect access to
privileged EXEC mode.
The router prompt changes once you have entered privileged EXEC mode. The prompt becomes the
router hostname followed by the pound symbol (#). If no hostname is configured, the prompt is
router#. To leave privileged EXEC mode and return to basic user EXEC mode, use either the disable
or exit command.
Access to the other configuration modes is possible from privileged EXEC mode. The next sections
discuss the global configuration, interface configuration, line configuration, and router configuration
modes.
Global Configuration Mode
Global configuration commands set parameters that affect the operation of the router as a whole. Use
the following privileged EXEC command to enter global configuration mode:
configure
After entering this command, you will receive the following prompt:
Configuring from terminal, memory, or network [terminal]?
Setting a Password
A common mistake is to enable remote access on the router for the TTY and VTY lines,
require that a password be given, and then not set a password. I have often installed a
router in a network and then tried to access it via telnet and been denied access because a
password is required but not set.
The three configuration options are from the directly attached terminal or session, NVRAM, or a
network server. The default option terminal is displayed in brackets at the end of the command
prompt. Any of the three global configuration options can be given along with the configure
command to bypass the prompt. For example, to configure the router from NVRAM, you could use
the following command:
configure memory
Once the system is in global configuration mode, the command prompt on the router changes to the
hostname with the word config in parentheses, followed by the pound symbol (#). If the hostname
hasn't been configured, the prompt would be router(config)#. Using the configuration entered in the
startup script from Listing 3.1, the prompt is test-r1(config)#. After the router has been placed into
global configuration mode, all other configuration modes are accessible.
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 7 of 10
file://I:\chapters\z\zb196.html 3/21/01
The rest of configuration mode can be accessed from global configuration mode. To leave global
configuration mode and return to privileged EXEC mode, type exit or end, or press Ctrl+Z.
Interface Configuration Mode
Many of the Cisco IOS features are configured on a per-interface basis. Interface configuration
commands are entered after the router has been placed in interface configuration mode. The following
command is used to change from global configuration mode to interface configuration mode:
interface interface-type interface-number
interface-type can be any of the interfaces currently installed in the router. interface-number is the
corresponding port on the interface card that you want to apply the interface configuration commands
to. For example, if you wanted to assign IP address 192.168.300.10 with a 24-bit subnet mask to
interface Ethernet 4/0, you would use the following series of commands:
router> enable
password:
router# configure terminal
router(config)# interface ethernet 4/0
router(config-if)# ip address 192.168.300.10 255.255.255.0
router(config-if)#
The Correct Configuration Mode
It is a common mistake for users to attempt to enter sublevel configuration commands,
such as interface configuration commands, right after entering enable mode. Be sure that
you are in the correct configuration mode before entering commands in the IOS.
The router prompt changes once the command mode is changed from global to interface. The router
prompt becomes the hostname, followed by config-if in parentheses, followed by the pound symbol
(#). The router prompt will now look like this:
test-r1(config-if)#
To leave interface configuration mode and return to global configuration mode, use the exit
command. To leave interface configuration mode and return to enable mode, either use the end
command or press Ctrl+Z.
Interface Notation
The interface notation used here is from a modular router in the Cisco product family.
The notation 4/0 means slot 4, interface 0. To someone actually looking at the router, it is
the first port on the interface card in slot 4. Interface cards that have multiple ports on
them are numbered sequentially, starting with 0. Also, you might remember from
Chapter 2 that the slots on the modular routers are numbered from 0 as well. So slot 4 is
actually the fifth slot in the chassis.
Abbreviated Command Notation
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 8 of 10
file://I:\chapters\z\zb196.html 3/21/01
The commands used in the preceding example to configure the IP address for the
Ethernet interface could also have been entered in abbreviated notation. The Cisco IOS
allows commands to be entered with only the first few letters of the actual command
name. For instance, the IP address command could have been entered as ip add rather
than ip address. The number of letters required before the command is recognized
depends on the various other commands available at that command level. For instance,
the interface configuration command ip a could mean ip address, ip accounting, or ip
access-group. The interface configuration command ip ac could be either ip accounting
or ip access-group. Once you have reached a point in the spelling of the command that
allows only one possible interpretation by the IOS, the IOS will accept the abbreviated
command.
Router Prompts
If you are beginning to see a recurring theme with the router prompts, you are correct.
Every Cisco IOS command mode has a different prompt. This helps you keep track of
where you are within the IOS command structure.
Line Configuration Mode
Line configuration mode is used to set parameters on the TTY and VTY ports of a Cisco router, as
well as the console and auxiliary ports. To enter line configuration mode from global configuration
mode, enter the following command:
line {aux | con | tty | vty } line-number ending-line-number
line-number is the port number that you want the following commands applied to. You can apply the
line configuration commands to a series of line numbers by specifying an ending line number. For
example, to have vty port 0 through 12 auto-disconnect after 15 minutes of idle time, execute the
following series of commands:
test-r1> enable
password:
test-r1# configure terminal
test-r1(config)# line vty 0 12
test-r1(config-line)# exec-timeout 15 0
test-r1(config-line)# exit
test-r1(config)# exit
test-r1#
The router prompt changes once you have entered line configuration mode. The prompt becomes the
hostname, followed by config-line in parentheses, followed by the pound symbol (#). The router
prompt now looks like this:
test-r1(config-line)#
To exit line configuration mode and return to global configuration mode, use the exit command. To
leave line configuration mode and return to privileged EXEC mode, use the end command or press
Ctrl+Z.
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 9 of 10
file://I:\chapters\z\zb196.html 3/21/01
Router Configuration Mode
Router configuration mode is used to configure IP routing protocols. To enter router configuration
mode from global configuration mode, use the following command:
router keyword
The keyword used can be any of the options listed in Table 3.1.
TABLE 3.1 Router configuration mode keywords
Keyword
Description
bgp
Border gateway protocol
egp
Exterior gateway protocol
igrp
Interior gateway protocol
isis
ISO IS-IS
iso-igrp
IGRP for OSI networks
ospf
Open shortest path first
rip
Routing information protocol
static
Static CLNS routing
The command prompt in the IOS changes once you have entered router configuration mode. The
command prompt becomes the hostname, followed by config-router in parentheses, followed by the
pound symbol (#).
For example, to configure the redistribution of static routes into OSPF process 1000, use the
following series of commands:
test-r1> enable
password:
test-r1# configure terminal
test-r1(config)# router ospf 1000
test-r1(config-router)# redistribute static subnets
test-r1(config-router)# ^Z
test-r1#
To exit from router configuration mode and return to global configuration mode, use the exit
command. To leave router configuration mode and return to privileged EXEC mode, use the end
command or press Ctrl+Z.
Cisco® Router Configuration & Troubleshooting - CH 3 - Initial Router Setup Page 10 of 10
file://I:\chapters\z\zb196.html 3/21/01
Each of the configuration modes can be accessed directly from another configuration mode. For
instance, if you are in line configuration mode and you want to program an Ethernet interface, you
don't have to exit line configuration mode and then enter interface configuration mode from global
configuration mode. You can simply enter interface configuration mode from line configuration
mode.
Conclusion
The configuration modes discussed here are only a few of those available in the Cisco IOS. All of the
configuration modes operate in the same fashion. You can enter them and exit them all the same way
and with a similar syntax. Use of the ? operator in any of the EXEC or command modes will list the
available command options. This help operator is an invaluable tool, because no one wants to
memorize the command syntax of every feature in the Cisco IOS, and rarely do network operators
carry the complete IOS command set publications with them.
Table 3.2 recaps the most-used command modes, their corresponding router prompts, what the
command mode is used for, and the command used to enter that mode.
TABLE 3.2 Common Cisco IOS command modes
Command
Mode
Router Prompt
Command Used to Enter
Mode
Command Mode Use
Basic user
mode
router>
None
Displays basic
information on router
functionality
Enable mode
router#
Enable
Displays detailed
information on all router
functionality
Global
configuration
router(config)#
Configure
Adds and modifies mode
global configuration
parameters and enters
sublevel configuration
modes
Router
configuration
mode
router(config- router)#
router<mode>
Configures routing
processes
Interface
configuration
mode
router(config- if)#
interface<interface
designation>
Configures option on a
per-interface basis
Line
configuration
mode
router(config- line)#
line{con|aux|tty|vty}
<line number>
Configures options for
access lines and ports