FIGURE 6.1
A Cisco 2960 switch
The 3560 switch I’ll be using in this book looks a lot like the 2960, but it
can perform layer 3 switching, unlike the 2960, which is limited to only
layer 2 functions.
I also want to take a moment and tell you about the 2800 series router
because that’s the router series I’ll be using in this book. This router is
known as an Integrated Services Router (ISR) and Cisco has updated it to
the 2900 series, but I still have plenty of 2800 series routers in my
production networks.
Figure 6.2
shows a new 1900 series router. The new
ISR series of routers are nice; they are so named because many services,
like security, are built into them. The ISR series router is a modular
device, much faster and a lot sleeker than the older 2600 series routers,
and it’s elegantly designed to support a broad new range of interface
options. The new ISR series router can offer multiple serial interfaces,
which can be used for connecting a T1 using a serial V.35 WAN
connection. And multiple Fast Ethernet or Gigabit Ethernet ports can be
used on the router, depending on the model. This router also has one
console via an RJ45 connector and another through the USB port. There
is also an auxiliary connection to allow a console connection via a remote
modem.
FIGURE 6.2
A new Cisco 1900 router
You need to keep in mind that for the most part, you get some serious
bang for your buck with the 2800/2900—unless you start adding a bunch
of interfaces to it. You’ve got to pony up for each one of those little
beauties, so this can really start to add up and fast!
A couple of other series of routers that will set you back a lot less than the
2800 series are the 1800/1900s, so look into these routers if you want a
less-expensive alternative to the 2800/2900 but still want to run the
same IOS.
So even though I’m going to be using mostly 2800 series routers and
2960/3560 switches throughout this book to demonstrate examples of
IOS configurations, I want to point out that the particular router model
you use to practice for the Cisco exam isn’t really important. The switch
types are, though—you definitely need a couple 2960 switches as well as a
3560 switch if you want to measure up to the exam objectives!
You can find more information about all Cisco routers at
www.cisco.com/en/US/products/hw/routers/index.html
.
Bringing Up a Switch
When you first bring up a Cisco IOS device, it will run a power-on self-
test—a POST. Upon passing that, the machine will look for and then load
the Cisco IOS from flash memory if an IOS file is present, then expand it
into RAM. As you probably know, flash memory is electronically erasable
programmable read-only memory—an EEPROM. The next step is for the
IOS to locate and load a valid configuration known as the startup-config
that will be stored in nonvolatile RAM (NVRAM).
Once the IOS is loaded and up and running, the startup-config will be
copied from NVRAM into RAM and from then on referred to as the
running-config.
But if a valid startup-config isn’t found in NVRAM, your switch will enter
setup mode, giving you a step-by-step dialog to help configure some basic
parameters on it.
You can also enter setup mode at any time from the command line by
typing the command
setup
from privileged mode, which I’ll get to in a
minute. Setup mode only covers some basic commands and generally
isn’t really all that helpful. Here’s an example:
Would you like to enter the initial configuration dialog? [yes/no]:
y
At any point you may enter a question mark '?' for help.
Use ctrl-c to abort configuration dialog at any prompt.
Default settings are in square brackets '[]'.
Basic management setup configures only enough connectivity
for management of the system, extended setup will ask you
to configure each interface on the system
Would you like to enter basic management setup? [yes/no]:
y
Configuring global parameters:
Enter host name [Switch]:
Ctrl+C
Configuration aborted, no changes made.
You can exit setup mode at any time by pressing Ctrl+C.
I highly recommend going through setup mode once, then never again
because you should always use the CLI instead!
Command-Line Interface (CLI)
I sometimes refer to the CLI as “cash line interface” because the ability to
create advanced configurations on Cisco routers and switches using the
CLI will earn you some decent cash!
Entering the CLI
After the interface status messages appear and you press Enter, the
Switch>
prompt will pop up. This is called user exec mode, or user mode
for short, and although it’s mostly used to view statistics, it is also a
stepping stone along the way to logging in to privileged exec mode, called
privileged mode for short.
You can view and change the configuration of a Cisco router only while in
privileged mode, and you enter it via the
enable
command like this:
Switch>
enable
Switch#
The
Switch#
prompt signals you’re in privileged mode where you can both
view and change the switch configuration. You can go back from
privileged mode into user mode by using the
disable
command:
Switch#
disable
Switch>
You can type
logout
from either mode to exit the console:
Switch>
logout
Switch con0 is now available
Press RETURN to get started.
Next, I’ll show how to perform some basic administrative configurations.
Overview of Router Modes
To configure from a CLI, you can make global changes to the router by
typing
configure terminal
or just
config t
. This will get you into global
configuration mode where you can make changes to the running-config.
Commands run from global configuration mode are predictably referred
to as global commands, and they are typically set only once and affect the
entire router.
Type
config
from the privileged-mode prompt and then press Enter to
opt for the default of
terminal
like this:
Switch#
config
Configuring from terminal, memory, or network [terminal]? [
press
enter]
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
At this point, you make changes that affect the router as a whole
(globally), hence the term global configuration mode. For instance, to
change the running-config—the current configuration running in
dynamic RAM (DRAM)—use the
configure terminal
command, as I just
demonstrated.
CLI Prompts
Let’s explore the different prompts you’ll encounter when configuring a
switch or router now, because knowing them well will really help you
orient yourself and recognize exactly where you are at any given time
while in configuration mode. I’m going to demonstrate some of the
prompts used on a Cisco switch and cover the various terms used along
the way. Make sure you’re very familiar with them, and always check your
prompts before making any changes to a router’s configuration!
We’re not going to venture into every last obscure command prompt you
could potentially come across in the configuration mode world because
that would get us deep into territory that’s beyond the scope of this book.
Instead, I’m going to focus on the prompts you absolutely must know to
pass the exam plus the very handy and seriously vital ones you’ll need
and use the most in real-life networking—the cream of the crop.
Don’t freak! It’s not important that you understand exactly
what each of these command prompts accomplishes just yet because
I’m going to completely fill you in on all of them really soon. For now,
relax and focus on just becoming familiar with the different prompts
available and all will be well!
Interfaces
To make changes to an interface, you use the
interface
command from
global configuration mode:
Switch(config)#
interface ?
Async Async interface
BVI Bridge-Group Virtual Interface
CTunnel CTunnel interface
Dialer Dialer interface
FastEthernet FastEthernet IEEE 802.3
Filter Filter interface
Filtergroup Filter Group interface
GigabitEthernet GigabitEthernet IEEE 802.3z
Group-Async Async Group interface
Lex Lex interface
Loopback Loopback interface
Null Null interface
Port-channel Ethernet Channel of interfaces
Portgroup Portgroup interface
Pos-channel POS Channel of interfaces
Tunnel Tunnel interface
Vif PGM Multicast Host interface
Virtual-Template Virtual Template interface
Virtual-TokenRing Virtual TokenRing
Vlan Catalyst Vlans
fcpa Fiber Channel
range interface range command
Switch(config)#
interface fastEthernet 0/1
Switch(config-if)#)
Did you notice that the prompt changed to
Switch(config-if)#
? This tells
you that you’re in interface configuration mode. And wouldn’t it be nice
if the prompt also gave you an indication of what interface you were
configuring? Well, at least for now we’ll have to live without the prompt
information, because it doesn’t. But it should already be clear to you that
you really need to pay attention when configuring an IOS device!
Line Commands
To configure user-mode passwords, use the
line
command. The prompt
then becomes
Switch(config-line)#
:
Switch(config)#
line ?
<0-16> First Line number
console Primary terminal line
vty Virtual terminal
Switch(config)#
line console 0
Switch(config-line)#
The
line console 0
command is a global command, and sometimes you’ll
also hear people refer to global commands as major commands. In this
example, any command typed from the
(config-line)
prompt is known
as a subcommand.
Access List Configurations
To configure a standard named access list, you’ll need to get to the
prompt
Switch(config-std-nacl)#
:
Switch#
config t
Switch(config)#
ip access-list standard Todd
Switch(config-std-nacl)#
What you see here is a typical basic standard ACL prompt. There are
various ways to configure access lists, and the prompts are only slightly
different from this particular example.
Routing Protocol Configurations
I need to point out that we don’t use routing or router protocols on 2960
switches, but we can and will use them on my 3560 switches. Here is an
example of configuring routing on a layer 3 switch:
Switch(config)#
router rip
IP routing not enabled
Switch(config)#
ip routing
Switch(config)#
router rip
Switch(config-router)#
Did you notice that the prompt changed to
Switch(config-router)#
? To
make sure you achieve the objectives specific to the Cisco exam and this
book, I’ll configure static routing, RIPv2, and RIPng. And don’t worry—
I’ll explain all of these in detail soon, in Chapter 9, “IP Routing,” and
Chapter 14, “Internet Protocol Version 6 (IPv6)”!
Defining Router Terms
Table 6.1
defines some of the terms I’ve used so far.
TABLE 6.1
Router terms
Mode
Definition
User exec mode
Limited to basic monitoring commands
Privileged exec mode
Provides access to all other router
commands
Global configuration mode Commands that affect the entire system
Specific configuration
modes
Commands that affect interfaces/processes
only
Setup mode
Interactive configuration dialog
Editing and Help Features
The Cisco advanced editing features can also help you configure your
router. If you type in a question mark (
?
) at any prompt, you’ll be given a
list of all the commands available from that prompt:
Switch#
?
Exec commands:
access-enable Create a temporary Access-List entry
access-template Create a temporary Access-List entry
archive manage archive files
cd Change current directory
clear Reset functions
clock Manage the system clock
cns CNS agents
configure Enter configuration mode
connect Open a terminal connection
copy Copy from one file to another
debug Debugging functions (see also 'undebug')
delete Delete a file
diagnostic Diagnostic commands
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
dot1x IEEE 802.1X Exec Commands
enable Turn on privileged commands
eou EAPoUDP
erase Erase a filesystem
exit Exit from the EXEC
––More––
?
Press RETURN for another line, SPACE for another page, anything
else to quit
And if this is not enough information for you, you can press the spacebar
to get another whole page of information, or you can press Enter to go
one command at a time. You can also press Q, or any other key for that
matter, to quit and return to the prompt. Notice that I typed a question
mark (?) at the
more
prompt and it told me what my options were from
that prompt.
Here’s a shortcut: To find commands that start with a certain letter, use
the letter and the question mark with no space between them, like this:
Switch#
c?
cd clear clock cns configure
connect copy
Switch#
c
Okay, see that? By typing
c?
, I got a response listing all the commands
that start with c. Also notice that the
Switch#
c
prompt reappears after the
list of commands is displayed. This can be really helpful when you
happen to be working with long commands but you’re short on patience
and still need the next possible one. It would get old fast if you actually
had to retype the entire command every time you used a question mark!
So with that, let’s find the next command in a string by typing the first
command and then a question mark:
Switch#
clock ?
set Set the time and date
Switch#
clock set ?
hh:mm:ss Current Time
Switch#
clock set 2:34 ?
% Unrecognized command
Switch#
clock set 2:34:01 ?
<1-31> Day of the month
MONTH Month of the year
Switch#
clock set 2:34:01 21 july ?
<1993-2035> Year
Switch#
clock set 2:34:01 21 august 2013
Switch#
00:19:45: %SYS-6-CLOCKUPDATE: System clock has been updated from
00:19:45
UTC Mon Mar 1 1993 to 02:34:01 UTC Wed Aug 21 2013, configured from
console
by console.
I entered the
clock ?
command and got a list of the next possible
parameters plus what they do. Make note of the fact that you can just
keep typing a command, a space, and then a question mark until
(carriage return) is your only option left.
And if you’re typing commands and receive
Switch#
clock set 11:15:11
% Incomplete command.
no worries—that’s only telling you that the command string simply isn’t
complete quite yet. All you need to do is to press the up arrow key to
redisplay the last command entered and then continue with the
command by using your question mark.
But if you get the error
Switch(config)#
access-list 100 permit host 1.1.1.1 host 2.2.2.2
^
% Invalid input detected at '^' marker.
all is not well because it means you actually have entered a command
incorrectly. See that little caret—the
^
? It’s a very helpful tool that marks
the exact point where you blew it and made a mess.
Here’s another example of when you’ll see that caret:
Switch#
sh fastethernet 0/0
^
% Invalid input detected at '^' marker.
This command looks right, but be careful! The problem is that the full
command is
show interface fastethernet 0/0
.
Now if you receive the error
Switch#
sh cl
% Ambiguous command: "sh cl"
you’re being told that there are multiple commands that begin with the
string you entered and it’s not unique. Use the question mark to find the
exact command you need:
Switch#
sh cl?
class-map clock cluster
Case in point: There are three commands that start with
show cl
.
Table 6.2
lists the enhanced editing commands available on a Cisco
router.
TABLE 6.2
Enhanced editing commands
Command Meaning
Ctrl+A
Moves your cursor to the beginning of the line
Ctrl+E
Moves your cursor to the end of the line
Esc+B
Moves back one word
Ctrl+B
Moves back one character
Ctrl+F
Moves forward one character
Esc+F
Moves forward one word
Ctrl+D
Deletes a single character
Backspace
Deletes a single character
Ctrl+R
Redisplays a line
Ctrl+U
Erases a line
Ctrl+W
Erases a word
Ctrl+Z
Ends configuration mode and returns to EXEC
Tab
Finishes typing a command for you
Another really cool editing feature you need to know about is the
automatic scrolling of long lines. In the following example, the command
I typed reached the right margin and automatically moved 11 spaces to
the left. How do I know this? Because the dollar sign [
$
] is telling me that
the line has been scrolled to the left:
Switch#
config t
Switch(config)#
$ 100 permit ip host 192.168.10.1 192.168.10.0
0.0.0.255
You can review the router-command history with the commands shown
in
Table 6.3
.
TABLE 6.3
IOS-command history
Command
Meaning
Ctrl+P or up arrow
Shows last command entered
Ctrl+N or down
arrow
Shows previous commands entered
show history
Shows last 20 commands entered by default
show terminal
Shows terminal configurations and history buffer
size
terminal history
size
Changes buffer size (max 256)
The following example demonstrates the
show history
command as well
as how to change the history’s size. It also shows how to verify the history
with the
show terminal
command. First, use the
show history
command,
which will allow you to see the last 20 commands that were entered on
the router (even though my particular router reveals only 10 commands
because that’s all I’ve entered since rebooting it). Check it out:
Switch#
sh history
sh fastethernet 0/0
sh ru
sh cl
config t
sh history
sh flash
sh running-config
sh startup-config
sh ver
sh history
Okay—now, we’ll use the
show terminal
command to verify the terminal
history size:
Switch#
sh terminal
Line 0, Location: "", Type: ""
Length: 24 lines, Width: 80 columns
Baud rate (TX/RX) is 9600/9600, no parity, 2 stopbits, 8 databits
Status: PSI Enabled, Ready, Active, Ctrl-c Enabled, Automore On
0x40000
Capabilities: none
Modem state: Ready
[output cut]
Modem type is unknown.
Session limit is not set.
Time since activation: 00:17:22
Editing is enabled.
History is enabled, history size is 10.
DNS resolution in show commands is enabled
Full user help is disabled
Allowed input transports are none.
Allowed output transports are telnet.
Preferred transport is telnet.
No output characters are padded
No special data dispatching characters
When Should I Use the Cisco Editing Features?
You’ll find yourself using a couple of editing features quite often and
some not so much, if at all. Understand that Cisco didn’t make these
up; these are just old Unix commands! Even so, Ctrl+A is still a really
helpful way to negate a command.
For example, if you were to put in a long command and then decide
you didn’t want to use that command in your configuration after all,
or if it didn’t work, then you could just press your up arrow key to
show the last command entered, press Ctrl+A, type
no
and then a
space, press Enter—and poof! The command is negated. This doesn’t
work on every command, but it works on a lot of them and saves some
serious time!
Dostları ilə paylaş: |