By James Boney
Cover | Table of Contents | Colophon
Router>
show
commands in user mode are limited to a
few basic levels. You cannot edit or view configurations at this
stage; you can only view the router status and other miscellaneous
information. To obtain a basic listing of commands, type a
question mark:
Router>?
enable
command to enter this mode:
Router>enable Password: Router# Privileged mode prompt
> at the end; the privileged mode prompt always
has a # at the end, regardless of the submode.
configure
terminal
(see Section 1.3 for a shortcut). This command can be
entered only when you are in the privileged mode.
Router#configure terminal Enter configuration commands, one per line. End with Ctrl-Z Router(config)# Configuration mode
configure
terminal:
Router#configure terminal
Router#conf t
conf
t
to configure
terminal. Another
shortcut is to press Tab after typing "conf"; the router
will fill in the best completion, which is "configure".
Here is another example:
Router#show running-config
Router#sh ru
show is the only command that begins with
"sh"; likewise, the only subcommand of
show that begins with "ru" is
running-config.
^) under the
point at which it ran into trouble. For example:
Router>show itnerface e0
>show itnerface e0
^
% Invalid input detected at '^' marker.
Router>show interface e0
Router>sh int e0
? at the prompt. You can also use this trick to
find the subcommands of any command. For example, if you know you
want to use the copy
command but cannot remember which
subcommand you need, type:
Router#copy ?
WORD Copy from flash device - format <dev:>[partition:][filename]
flash Copy from system flash
flh-log Copy FLH log file to server
mop Copy from a MOP server
rcp Copy from an rcp server
running-config Copy from current system configuration
startup-config Copy from startup configuration
tftp Copy from a TFTP server
configure command begins with
"co", but that's it. The router gives us the
matching commands:
Router#co?
configure connect copy
copy. Had
there not been a space, the router would have tried to complete the
word "copy" for us, not given us the next available
commands. In the next example, we did not add the space, so the
router tried to complete "co" with all the commands it
could find that start with "co".
|
Keys
|
Commands
|
|---|---|
|
Ctrl-a
|
Returns the cursor to the beginning of the current line.
|
|
Ctrl-b
|
Moves the cursor back one character. (Equivalent to the left arrow
key.)
|
|
Ctrl-d
|
Deletes the character to the left of the cursor.
|
|
Ctrl-e
|
Moves the cursor to the end of the line.
|
|
Ctrl-f
|
Moves the cursor forward one character. (Equivalent to the right
arrow key.)
|
|
Ctrl-k
|
Deletes all the characters from the current cursor position to the
end of the line.
|
|
Ctrl-n
|
Goes to the next command in the session history. (Equivalent to the
down arrow key.)
|
|
Ctrl-p
|
Goes to the previous command in the session history. (Equivalent to
the up arrow key.)
|
|
Ctrl-t
|
Switches the current character with the character to the left of the
cursor.
|
|
Ctrl-r |
terminal
command, you
can set an important feature of the user interface: the pausing of
lengthy output. For example, if you run a command that has more than
one page of output, the router will pause after 24 lines with a
"—More—" prompt. The value 24 is the default
terminal length. Depending on the size of your terminal window, this
might not be adequate. You can change the length and width using the
terminal command, like this:
Router>terminal length 10 Router>terminal width 80
Router>terminal length 0
show
commands. They are among
the most useful commands you will ever use; they allow you to view
just about any settings within the router. Issuing the command
show
? produces output like
this:
Router>show ?
clock Display the system clock
history Display the session command history
hosts IP domain-name, lookup style, nameservers, and host table
sessions Information about Telnet connections
snmp snmp statistics
terminal Display terminal configuration parameters
users Display information about terminal lines
version System hardware and software status
show command has many different subcommands.
However, notice that we are in user mode. In privileged mode, the
show command has a lot more subcommands, which
would take up a few pages if we listed them here. The important thing
to remember is that show commands often have more
than one keyword. For example, the command
show ip route works by itself, but there are also
many other options that can be applied to it. For example:
router#show ip route ?
Hostname or A.B.C.D Network to display information about or hostname
bgp Border Gateway Protocol (BGP)
connected Connected
egp Exterior Gateway Protocol (EGP)
eigrp Enhanced Interior Gateway Routing Protocol (EIGRP)
igrp Interior Gateway Routing Protocol (IGRP)
isis ISO IS-IS
odr On Demand stub Routes
ospf Open Shortest Path First (OSPF)
rip Routing Information Protocol (RIP)
static Static routes
summary Summary of all routes
supernets-only Show supernet entries only
<cr>
show keywords with the question mark. The
show
version
:
Router>show version
Cisco Internetwork Operating System Software IOS (tm)
3600 Software (C3640-JS-M), Version 12.0(5)T1, RELEASE SOFTWARE (fc1)show
version
:
Router>show version
Cisco Internetwork Operating System Software IOS (tm)
3600 Software (C3640-JS-M), Version 12.0(5)T1, RELEASE SOFTWARE (fc1)|
Filesystem type
|
Router
|
|---|---|
|
Class A
|
7000 series, C12000, and LightStream 1010
|
|
Class B
|
1003, 1004, 1005, 2500, 3600, 4000, AS5200, 800
|
|
Class C
|
3810
|
|
Command
|
Filesystem
|
Description
|
|---|---|---|
cd
|
All
|
Changes the working directory.
|
delete
|
All
|
Router#copy running-config startup-config
Building configuration...
Router#copy running-config tftp
writeRouter#copy tftp running-config (for TFTP) Router#copy rcp running-config (for RCP)
Router#copy tftp startup-config (for TFTP) Router#copy rcp startup-config (for RCP)
Router#copy running-config startup-config
Router#show startup-config Router#show running-config
hostname
command:
Router(config)#hostname Sphinx
Sphinx(config)#
hostname
command:
Router(config)#hostname Sphinx
Sphinx(config)#
prompt
command. For example:
Sphinx(config)#prompt %h:%n%p Sphinx(config)#exit Sphinx:5#
%h), followed by the command number
(%n), followed by the appropriate prompt character
for the current command mode (%p). The escape
sequences for the prompt command are listed in
Table 3-1.
|
Escape sequence
|
Meaning
|
|---|---|
%%
|
Percent character
|
%h
|
Hostname of the router
|
%n
|
TTY number for this EXEC session
|
%p
|
Prompt character: either > for user level or # for privileged level
|
%s
|
Space character
|
%t
|
Tab character
|
no prompt command returns the router to the
default prompt.
! ! This is a comment. !
enable password
command:
Router(config)#enable password not2secure
service
password-encryption (with no arguments) configures
the router to store the password in an encrypted form.
show commands or to use commands
such as ping to check your network connectivity.
ip
host command builds
and maintains the router's host table. This command takes a
hostname followed by one or more IP addresses. You can have up to
eight IP addresses per hostname.
ip host pyramid 10.10.1.3 ip host sphinx 10.10.1.2 10.10.1.4 10.10.1.5
no ip host pyramid 10.10.1.3 no ip host sphinx 10.10.1.2 10.10.14 10.10.1.5
clock
set command. This
command is not a configuration command (i.e., you must be in enable
mode to give it, but you don't need to give the
configure
terminal command) and
is not stored in the router's configuration. The time is in
military (24-hour) time. For example:
Router#clock set 13:00:00 20 jun 1999
clock
timezone command.
This command is part of the router's configuration. For
example, a router on the east coast of the United States would have
the line:
Router(config)#clock timezone EST -5
Router(config)#clock summer-time EDT recurring
calendar
set command simply
sets the time, and is not stored in the router's configuration.
Router#calendar set 12:10:00 5 September 1999 Router#clock read-calendar
snmp-server community name mode access-list
RO
for read-only access (unprivileged), or RW for
read-write access (privileged). RO means that the
management station can read information about the router but
can't change anything; cdp run
no form of the command:no cdp run
no
cdp
enable command in interface configuration mode.
Router>show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP
Device ID Local Intrfce Holdtme Capability Platform Port ID
switch1 Eth 0 162 T S 1900 AUI
router2 Eth 0 176 R 4000 Eth 0
This is the message of the day banner.
(motd banner)
This is the login banner.
(login banner)
User access verification
Password:
(not echoed)
This is the exec banner.
(exec banner)
Router>
(user mode prompt)
#
message
#
.
The pound character (#) represents the
delimiting character of your choice. It marks the beginning and end
of your message. You cannot use your delimiting character inside the
message body. For example, the following command sets the message of
the day:
Router(config)#banner motd # Router will be rebooted today for maintenance. #
Router(config)#banner motd $ Enter TEXT message. End with the character '$'. Router will be down until tomorrow. I guess we should have planned it better. $ Router(config)#
banner
command followed by the type of banner
and the message:
Router(config)#banner motd # message # Router(config)#banner login # message # Router(config)#banner exec #
line command (and various commands that follow it)
and include items such as parity and port speed. The high-level
protocol characteristics are configured by the
interface command (and the commands that follow
it); these characteristics include IP addresses and other properties.
line command can configure:line command specifies which line or group of
lines you want to configure by entering the line configuration mode.
It doesn't actually do the configuration; it is followed by
other commands that set up the specific properties you want.
Here's the syntax of the line command:
line [aux | console | tty | vty] starting-line-number ending-line-number
aux,
console, tty, and
vty. These line types are discussed individually
in this chapter. The following example shows how to use the
line command to configure some properties of the
router's console
interface:
Router>enable Enter the privileged command mode Router#config terminal Enter configuration mode Router(config)#line console 0 Select the console line Router(config-line)#
line command (and various commands that follow it)
and include items such as parity and port speed. The high-level
protocol characteristics are configured by the
interface command (and the commands that follow
it); these characteristics include IP addresses and other properties.
line command can configure:line command specifies which line or group of
lines you want to configure by entering the line configuration mode.
It doesn't actually do the configuration; it is followed by
other commands that set up the specific properties you want.
Here's the syntax of the line command:
line [aux | console | tty | vty] starting-line-number ending-line-number
aux,
console, tty, and
vty. These line types are discussed individually
in this chapter. The following example shows how to use the
line command to configure some properties of the
router's console
interface:
Router>enable Enter the privileged command mode Router#config terminal Enter configuration mode Router(config)#line console 0 Select the console line Router(config-line)#exec-timeout 30 0 Set the timeout to 30 minutes Router(config-line)#exit Exit the line configuration mode Router(config)#exit Exit the configuration mode Router#
line commands to more than one line, you can
specify the starting and ending numbers of a group of lines. For
example, say you want to apply the command
exec-timeout to TTY lines 5 through 10. Instead of
typing this command five times, you can configure the entire group
with one line command:
Router(config)#line tty 5 10 Router(config-line)#exec-timeout 30 0
line
command, you give it
"relative" line numbers: the first TTY is
tty0,
the first virtual terminal is vty0, and so on.
This numbering scheme is intuitive and convenient. Internally, the
router uses an absolute numbering scheme to keep track of the lines.
It would be nice if you could ignore the router's internal
bookkeeping, but a number of commands use absolute line numbers when
reporting information about a line's status.
line commands, we can define and control
access to the
console port. Here is a basic
configuration:
Router#config terminal Router(config)#service linenumber Router(config)#line console 0 Router(config-line)#location Building-2A Router(config-line)#exec-timeout 30 0
location
command identifies the router's
location to the users. The command
service
linenumber displays
the location information automatically to the user upon login. This
information can be useful when you are administering your routers.
Next, we add a basic security measure: a
timeout. If the console port is idle for
more than 30 minutes, the session automatically closes. You do not
want the session active all the time in a real environment. If you
forget to log out, someone might come in after you and modify the
router's configuration!
Router(config)#username bob password letmein Router(config)#line console 0 Router(config-line)#