Ccna Command (Ccna2)
Ccna Command (Ccna2)
Configuring a Router
This chapter provides information and commands concerning the following topics:
• Configuring a router, specifically:
— Names
— Passwords
PART II CCNA 2
— Interfaces
— MOTD banners
— IP host tables
— Saving and erasing your configurations
• show commands to verify the router configurations
Router Modes
TIP: There are other modes than these. Not all commands work in all
modes. Be careful. If you type in a command that you know is correct—show
run, for example—and you get an error, make sure that you are in the correct
mode.
18 Configuring Passwords
hostname Cisco
Router(config)#h Name can be any word you choose
Cisco(config)#
Configuring Passwords
line con 0
Router(config)#l Enters console-line mode
password console
Router(config-line)#p Sets console-line mode password to
console
login
Router(config-line)#l Enables password checking at login
line vty 0 4
Router(config)#l Enters vty line mode for all 5 vty
lines
password telnet
Router(config-line)#p Sets vty password to telnet
login
Router(config-line)#l Enables password checking at login
show Commands 19
line aux 0
Router(config)#l Enters auxiliary line mode
password backdoor
Router(config-line)#p Sets auxiliary line mode password to
backdoor
login
Router(config-line)#l Enables password checking at login
CAUTION: You cannot set both enable secret and enable password to the same
password. Doing so defeats the use of encryption.
Password Encryption
service password-
Router(config)#s Applies a weak encryption to
encryption passwords
enable password cisco
Router(config)#e Sets enable password to cisco
line con 0
Router(config)#l …
password Cisco
Router(config-line)#p Continue setting passwords as above
…
no service password-
Router(config)#n Turns off password encryption
encryption
CAUTION: If you have turned on service password encryption, used it, and then
turned it off, any passwords that you have encrypted will stay encrypted. New
passwords will remain unencrypted
show Commands
show ?
Router#s Lists all show commands available
show interfaces
Router#s Displays statistics for all interfaces
show interface serial 0
Router#s Displays statistics for a specific
interface, in this case Serial 0
show ip interface brief
Router#s Displays a summary of all
interfaces, including status and IP
address assigned
20 Interface Names
Interface Names
One of the biggest problems that new administrators face is the names of the interfaces on
the different models of routers. The following chart lists the names of the Ethernet, Fast
Ethernet, and Serial interfaces on the 2500, 1700, and 2600 series of routers.
int
Router(config)#i interf
Router(config)#i interface
Router(config)#i
erface type port ace type port type slot/port
int
Router(config)#i interf
Router(config)#i int serial
Router(config)#i
serial0 (s0) ace serial 0 0/0 (s0/0)
int
Router(config)#i interf
Router(config)#i int
Router(config)#i
ethernet 0 (e0) ace fastethernet 0 fastethernet 0/0 (fa0/0)
Configuring an Ethernet/Fast Ethernet Interface 21
int s0
Router(config)#i int s0
Router(config)#i Moves to interface S0
mode
exit
Router(config-if)#e int e0
Router(config-if)#i In int S0, move to E0
int e0
Router(config)#i Router(config-if)# In E0 mode now
int s0/0
Router(config)#i Moves to interface Serial 0/0
mode
description Link to ISP
Router(config-if)#d Optional descriptor of the link is
locally significant
ip address 192.168.10.1
Router(config-if)#i Assigns address and subnet
255.255.255.0 mask to interface
clock rate 56000
Router(config-if)#c Assigns a clock rate for the
interface
no shut
Router(config-if)#n Turns interface on
TIP: The clock rate command is used only on a serial interface that has a DCE
cable plugged into it. There must be a clock rate set on every serial link between
routers. It does not matter which router has the DCE cable plugged into it, or which
interface the cable is plugged into. Serial 0 on one router can be plugged into
Serial 1 on another router.
int fa0/0
Router(config)#i Moves to Fast Ethernet 0/0
interface mode
description Accounting LAN
Router(config-if)#d Optional descriptor of the
link is locally significant
22 Assigning a Local Host Name to an IP Address
ip address 192.168.20.1
Router(config-if)#i Assigns address and subnet
255.255.255.0 mask to interface
no shut
Router(config-if)#n Turns interface on
TIP: The default port number in the ip host command is 23, or Telnet. If you want
to Telnet to a device, just enter the IP host name itself:
london = Router#t
Router#l telnet london = Router#t
telnet 172.16.1.3
exec-timeout Command 23
no ip domain-lookup Command
no ip domain-lookup
Router(config)#n Turns off trying to
Router(config)# automatically resolve an
unrecognized command to a
local host name
TIP: Ever type in a command incorrectly and left having to wait for a minute or
two as the router tries to translate your command to a domain server of
255.255.255.255? The router is set by default to try to resolve any word that is not
a command to a DNS server at address 255.255.255.255. If you are not going to set
up DNS, turn this feature off to save you time as you type, especially if you are a
poor typist.
line con 0
Router(config)#l
logging synchronous
Router(config-line)#l Turns on synchronous
logging. Information items
sent to console will not
interrupt the command you
are typing. The command
will be moved to a new line
TIP: Ever try to type in a command and an informational line appears in the
middle of what you were typing? Lose your place? Do not know where you are in
the command, so you just press ® and start all over? The logging
synchronous command will tell the router that if any informational items get
displayed on the screen, your prompt and command line should be moved to a
new line, so as not to confuse you.
The informational line does not get inserted into the middle of the command you
are trying to type. If you were to continue typing, the command would execute
properly, even though it looks wrong on the screen
exec-timeout Command
line con 0
Router(config)#l
exec-timeout 0 0
Router(config-line)#e Sets time limit when console
automatically logs off. Set to
0 0 (minutes seconds) means
console never logs off
Router(config-line)#
24 Configuration Example: Basic Router Configuration
TIP: exec-timeout 0 0 is great for a lab because the console never logs out. This
is very dangerous in the real world (bad security).
Saving Configurations
Erasing Configurations
erase start
Router#e Deletes the startup-config file from NVRAM
TIP: Running-config is still in dynamic memory. Reload the router to clear the
running-config.
Figure 3-1 shows the network topology for the configuration that follows, which shows a
basic router configuration using the commands covered in this chapter.
Boston Router
en
Router>e Enters privileged mode
clock set 18:30:00 15 Nov 2004
Router#c Sets local time on router
config t
Router#c Enters global config mode
Configuration Example: Basic Router Configuration 25
hostname Boston
Router(config)#h Sets router name to Boston
no ip domain-lookup
Boston(config)#n Turns off name resolution on
unrecog-nized commands
(spelling mistakes)
banner motd #
Boston(config)#b Creates an MOTD banner
This is the Boston Router.
Authorized Access Only
#
no service password-
Boston(config)#n Turns off password encryption
encryption
int fa 0/0
Boston(config)#i Moves to Fast Ethernet 0/0
mode
desc Engineering LAN
Boston(config-if)#d Sets locally significant
description of the interface
ip address 172.16.10.1
Boston(config-if)#i Assigns IP address and subnet
255.255.255.0 mask to the interface
no shut
Boston(config-if)#n Turns on the interface
int s0/0
Boston(config-if)#i Moves directly to Serial 0/0
mode
desc Link to Buffalo
Boston(config-if)#d Sets locally significant
Router description of the interface
ip address 172.16.20.1
Boston(config-if)#i Assigns IP address and subnet
255.255.255.0 mask to the interface
clock rate 56000
Boston(config-if)#c Sets a clock rate for serial
transmission (DCE cable must
be plugged into this interface)
no shut
Boston(config-if)#n Turns on the interface
exit
Boston(config-if)#e Moves back to global config
mode
ip host buffalo 172.16.20.2
Boston(config)#i Sets a local host name
resolution to IP address
172.16.20.2
exit
Boston(config)#e Moves back to privileged
mode