| 当前位置:蓝信数码-网络基础-路由器- IOS软件中路由器的口令设置和口令恢复 |
IOS软件中路由器的口令设置和口令恢复
口令设置是网络设备经常使用的安全措施之一,当忘记原来配置在网络设备上的口令而试图获得对该设备的控制权时,则需要相应的口令恢复操作。
本节以路由器为例进行口令设置和口令恢复方面的实验。
实验目的
通过本实验,读者可以掌握以下技能:
路由器Console端口、vty线路、enable等口令的设置;
路由器口令恢复的技巧。
2.设备需求与线缆连攘要求
本实验的设备与线缆连接要求和实验1完全相同,请参见实验1的有关图示和说明。在此不再重复说明。
3.实验配置及监测结果
连接好线缆并给pc和路由器加电后,开始本节的实验。
第1部分:配置各种口令
首先进行控制台(Console)端口、辅助口(AUX)、虚拟终端(vty)线路、,特权模式口令及密码的设置。
其中Console端口口令控制通过Console端口到路由器的访问;AUX端口口令用于控制通过AUX端口到路由器的访问;vty线路口令控制Telnet到路由器的访问;特权模式口令是为保护路由器特权模式而设置的口令,即enable password;而特权模式密码是加密的口令,即enable secret,在路由器的配置清单中不显示其内容,当同时配置了enable password和enablesecret时,后者生效。
配置清单2-2记录了对各种口令的设置方法。
配置清单2-2 设置路由器的各种口令
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#enable password cisco1
Router(config)#enabSe secret cisco2
Router(config)#line con 0
Router(config-line)#login
Router(config-line)#passw cisco3
Router(config-line)#exit
Router(config)#line aux 0
Router(config-line)#loglis
Router(config"line)#passw cisco4
Router(config-line)#exit
Router(config)#line vty 0 4
Router(config-line)#login
Router(config-line)#passw ciscoS
Router(config-line)#end
Router#sh run
Building configuration...
Current configuration : 566 bytes
version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Router
!
enable secret 5 $l$cQDs$6M3C79y9sWQgk.mYywxTt0
enable password ciscol
... (此处省略多行)
line con 0
password cisco3
login
transport input none
line aux 0
password cisco4
login
line vty 0 4
password cisco5
login
!
end
(1)以上配置清单详细记录了各种口令的配置方法,同时列出运行配置清单,清单中对cnable密码进行了加密显示。
(2)在上述配置下,从用户执行模式进入特权执行模式时应输入的口令是cisco2,而不是Cisco1,这一点要特别注意。
(3)路由器支持对所有口令进行加密显示,实现这个功能的命令是service命令的一个子命令,即sewice password-encryption,此命令应在全局配置模式下发出。配置此命令后的showrunning-config结果中会出现类似以下内容的显示:
line con 0
password 7 02050D04808095C
login
我们在配置清单开头部分经常看到的service timestamps debug uptime和servicce timestampslog uptime是路由器的缺省配置"分别指示系统在显示Debug信息和log信息的同时提供开机后的时间信息,即所谓"时间戳"(Timestamp)。
(4)注意以上所有口令都是对大小写敏感的。
第2部分:进行口令恢复操作
口令恢复的操作往往令初学Cisco设备操作的人生畏,认为这种操作过于复杂、难以掌握。产生这样感觉的原因是初学者往往对Cisco路由器的另一种运行模式ROM Monitor模式缺乏认识造成的。
路由器的ROM中除固化了一种功能有限的IOS之外,还有一种非IOS的简单操作系统,同IOS一样,也可以被加载,加载之后进入的模式被称为ROM Monitor模式。ROM Mintor模式通常被用于对设备进行低级调试和口令恢复。在网络设备的一般性调试中很少用到ROMMonitor模式。这是许多人对它不熟悉的主要原因。
以PC机的超级终端访问路由器,在路由器加电后的60s内按下Break键 (或Ctrl+Break键)就能进入到ROM Monitor模式下,口令恢复的操作便可以进行了。
监测清单2-5记录了对Cisco2500系列路由器口令恢复操作的全过程,其中与口令恢复操作无关的内容己被删节。
监测清单2-5 Cisco 2500系列路由器的口令恢复操作
第1段: ROM Monitor
System Bootstrap, Version 5.2(8a), RELEASE SOFTWARE
Copyright (c) 1986-1995 by cisco Systems
2500 processor with 16384 Kbytes of main memory
(按下Break键, 进入ROM Monitor模式)
Abort at Ox1OEA81C (PC)
>?
$ Toggle cache state
B [filename] [TFTP Server IP address I TFTP Server Name]
Load and execute system image from ROM or from TFTP server
C [address] Continue execution [optional address]
D/S M LV Deposit value V of size S into location L with modifier M
E/S M L Examine location L with size S with modifier M
G [address] Begin execution
H Help for commands
I Initialize
K Stack trace
L [filename] [TFTP Server IP address ! TFTP Server Name]
Load system image from ROM or from TFTP server, but do not
begin execution
O Show configuration register option settings
P Set the break point
S Single step next instruction
T function Test device (? for help)
Deposit and Examine sizes may be B (byte), L (long) or S (short).
Modifiers may be R (register) or S (byte swap).
