实验拓扑图:
实验内容:
如何进入路由器的三种模式:
⑴用户模式:
接通路由器后首先进入的就是用户模式了.
Router>
Router>?
Exec commands:
access-enable Create a temporary Access-List entry
access-profile Apply user-profile to interface
clear Reset functions
connect Open a terminal connection
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
exit Exit from the EXEC
help Description of the interactive help system
lat Open a lat connection
lock Lock the terminal
login Log in as a particular user
logout Exit from the EXEC
modemui Start a modem-like user interface
mrinfo Request neighbor and version information from a multicast
router
mstat Show statistics after multiple multicast traceroutes
mtrace Trace reverse multicast path from destination to source
name-connection Name an existing network connection
pad Open a X.29 PAD connection
ping Send echo messages
ppp Start IETF Point-to-Point Protocol (PPP)
resume Resume an active network connection
rlogin Open an rlogin connection
show Show running system information
slip Start Serial-line IP (SLIP)
systat Display information about terminal lines
tclquit Quit Tool Command Language shell
telnet Open a telnet connection
terminal Set terminal line parameters
tn3270 Open a tn3270 connection
traceroute Trace route to destination
tunnel Open a tunnel connection
udptn Open an udptn connection
where List active connections
x28 Become an X.28 PAD
x3 Set X.3 parameters on PAD
⑵特权模式:
Router>enable
Router#?
Exec commands:
access-enable Create a temporary Access-List entry
access-profile Apply user-profile to interface
access-template Create a temporary Access-List entry
alps ALPS exec commands
archive manage archive files
audio-prompt load ivr prompt
auto Exec level Automation
bfe For manual emergency modes setting
call Reload IVR call application, accounting template
ccm-manager Call Manager Application exec commands
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
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
erase Erase a filesystem
exit Exit from the EXEC
help Description of the interactive help system
isdn Run an ISDN EXEC command on an ISDN interface
lat Open a lat connection
lock Lock the terminal
login Log in as a particular user
logout Exit from the EXEC
microcode microcode commands
modemui Start a modem-like user interface
monitor Monitoring different system events
more Display the contents of a file
mpls MPLS commands
mpoa MPOA exec commands
mrinfo Request neighbor and version information from a multicast
router
mrm IP Multicast Routing Monitor Test
mstat Show statistics after multiple multicast traceroutes
mtrace Trace reverse multicast path from destination to source
name-connection Name an existing network connection
ncia Start/Stop NCIA Server
no Disable debugging functions
pad Open a X.29 PAD connection
ping Send echo messages
ppp Start IETF Point-to-Point Protocol (PPP)
pwd Display current working directory
reload Halt and perform a cold restart
rename Rename a file
restart Restart Connection
resume Resume an active network connection
rlogin Open an rlogin connection
rsh Execute a remote command
sdlc Send SDLC test frames
send Send a message to other tty lines
setup Run the SETUP command facility
show Show running system information
slip Start Serial-line IP (SLIP)
squeeze Squeeze a filesystem
start-chat Start a chat-script on a line
systat Display information about terminal lines
tarp TARP (Target ID Resolution Protocol) commands
tbct configure TBCT related parameters
tclquit Quit Tool Command Language shell
tclsh Tool Command Language shell
telnet Open a telnet connection
terminal Set terminal line parameters
test Test subsystems, memory, and interfaces
tn3270 Open a tn3270 connection
traceroute Trace route to destination
tunnel Open a tunnel connection
udptn Open an udptn connection
undebug Disable debugging functions (see also 'debug')
upgrade Upgrade software
verify Verify a file
vlan Configure VLAN parameters
voice Voice Commands
where List active connections
which-route Do OSI route table lookup and display results
write Write running configuration to memory, network, or terminal
x28 Become an X.28 PAD
x3 Set X.3 parameters on PAD
⑶配置模式:
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
⑷其它模式:
接口模式:
Router(config)#interface s1
% Incomplete command.
(因为路由器有每个槽,而每个槽里面又分开有接口,所以这里的接口应该写为s1/0)
Router(config)#interface s1/0
定义路由器的名称为R1
Router(config-if)#hostname R1
R1(config)#
给路由器设置特权密码
R1(config)#enable password cisco (定义的是明文密码cisco)
R1(config)#enable secret ming (定义的是密文密码ming)
启用控制台密码
R1(config)#line console 0
R1(config-line)#password cisco
R1(config-line)#login
设置telnet访问启用密码
R1(config)#line vty 0 4
R1(config-line)#password cisco
R1(config-line)#login
注意:执行telent一定要设置enable密码和telnet密码才可以实现采用telnet登陆路由器
拒绝执行DNS解析
R1(config)#no ip domain-lookup
注意:当我们一不小心输入错误的命令的时候,路由器会认为这条命令没有错,把它当作是一个域名的形式,从而会给你解析.这样会浪费一些时间.
配置路由器,使控制台端口不会中止与电脑的连接
R1(config)#line console 0
R1(config-line)#exec-timeout 0
注意:如果长时间不去操作路由器,路由器会自动终止与电脑的对话连接,跳转到非连接状态.我们需要重新输入密码进行设置,在一定意义上增加了安全性,但也很不方便.
配置路由器,使路由器发送的控制台屏幕的消息不会附加到命令行中
R1(config-line)#logging synchronous
配置路由器,使路由器登陆控制台端口时显示一个标题
R1(config)#banner motd #
Enter TEXT message. End with the character '#'.
hello
#
R1(config)#
给路由器的各个接口配置IP地址
R1(config)#interface s1/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shut
R1(config-if)#
*Mar 1 00:55:10.203: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
*Mar 1 00:55:11.203: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
R1(config-if)#interface e0/0
R1(config-if)#ip address 192.168.1.2 255.255.255
*Mar 1 00:55:33.715: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down
R1(config-if)#ip address 192.168.1.2 255.255.255.0
% 192.168.1.0 overlaps with Serial1/0
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shut
查看配置的结果
R1(config)#^Z
R1#show ru
*Mar 1 00:57:05.519: %SYS-5-CONFIG_I: Configured from console by console
R1#show run
Building configuration...
Current configuration : 907 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
enable password cisco
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!
!
! !
!
!
!
interface Ethernet0/0
ip address 192.168.2.1 255.255.255.0
half-duplex
!
interface Serial1/0
ip address 192.168.1.1 255.255.255.0
serial restart-delay 0
clock rate 64000
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
ip http server
ip classless
!
!
!
!
!
!
gatekeeper
shutdown
!
banner motd ^C
hello
^C
!
line con 0
exec-timeout 0 0
password cisco
logging synchronous
login
line aux 0
line vty 0 4
password cisco
login
!
!
End
查看路由器各端口状态
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.2.1 YES manual up up
Serial1/0 192.168.1.1 YES manual up down
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
R1#
本文转自 独钩寒江雪 51CTO博客,原文链接:http://blog.51cto.com/bennie/96649,如需转载请自行联系原作者