思科路由器恢恢复密码
三步搞定!
1:重启路由器设备,在出现很多“#”号的时候按crtl+break
2:输入confreg 0x2142
3:输入reset
这样你就可以绕过配置文件进去路由器了
下面就是重新设置一下密码了,然后在全局模式下把配置寄存器的值改为0X2102,然后保存一下,重启就可以了,你以前的配置除了密码修改了一下外,其他的都没变!
全局模式下配置寄存器的修改:Configuration register 0x2102
在加载系统过程中, 使用Ctrl+C键或者Ctrl+Break 键进入monitor模式。
我们需要知道2142 这个寄存器值,它的意思是我们进入系统后不加载配置。2102这个寄存器值代表每次进入系统都要加载配置文件。
**************
在重新载入的时候,我们需要按住Ctrl+C键或者Ctrl+Break键。进入monitor模式下。
查看可以执行的命令,这里我们需要知道2142 这个寄存器值,它的意思是我们进入系统后不加载配置。2102这个寄存器值代表每次进入系统都要加载配置文件。
请点击输入图片描述
修改寄存器值,并且重置
rommon 2 > confreg 0x2142
rommon 3 > reset
请点击输入图片描述
可以看到一个纯净的IOS系统
请点击输入图片描述
将配置文件拷贝到当前
Router>enable
Router# copy startup-config running-config
请点击输入图片描述
查看配置
R1# sh run
请点击输入图片描述
删除加密密码
R1#conf t
R1(config)#no enable secret
修改正常寄存器值为0x2102,并且保存。
R1(config)#config-register 0x2102
R1(config)#end
R1#wr
请点击输入图片描述
重新启动
Router#reload
请点击输入图片描述
启动后进入特权模式,可以看到没有要求密码。这样我们就完成了路由器的密码恢复!
**********************
路由器忘记密码是很常见也是很麻烦的事情,这个时候就需要我们恢复下密码。恢复密码的主要步骤是:
1.中断路由器启动 ctrl+break键
2.更改配置寄存器的值为0x2142
3.重启路由器
4.查看保存的配置文件中enable密码
5.重设enable密码
6.保存配置
7.更改配置寄存器的值为0x2102
实际配置:
关闭路由器,重启:
Self decompressing the p_w_picpath : 启动路由器时按ctrl+Break键
##########################
monitor: command "boot" aborted due to user interrupt
rommon 1 > confreg 0x2142 配置配置寄存器的值为0x2142
rommon 2 > reset 重启路由器
Continue with configuration dialog? [yes/no]: n 不再加载startup-config
Router#show startup-config 查看以前的密码
Router#copy startup-config running-config 将以前的配置加载到内存
Router#config t进入全局配置模式
Router(config)#enable password cisco 将密码重置
Router(config)#
Router#copy running-config startup-config 将更改完密码的配置保存
Destination filename [startup-config]?
Building configuration...
[OK]
Router#Router#show version 查看配置寄存器的值
Configuration register is 0x2142
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#conf t
Router(config)#config-register 0x2102 重新配置寄存器值
附:寄存器值意义
0x2102:运行过程中中断键被屏蔽,路由器会查看NVRAM中配置的内容以确定启动次序,如果启动失败会采用缺省的ROM软件进行启动。
0x2142:恢复密码时候使用。忽略NVRAM配置信息而进入初始配置对话模式中去。
路由器启动过程:
一、路由器加电后,首先运行ROM中的POST程序(Power On Self Test)对路由器的硬件进行检测,俗称加电自检。
二、检测通过后紧接着执行ROM中的引导程序(bootstrap),并根据寄存器值(register)来决定启动方式。
寄存器值的格式为:0x21YZ Y列的状态:0x210Z 从nvram加载配置文件 0x214Z 不从nvram加载配置文件 Z列的状态:0x21Y0 从rommon启动 提示符为:> (路由器启动时按Ctrl+Break) 0x21Y1 从mini ios启动 提示符为:Router(boot)> 0x21Y2 从flash 启动 提示符为:Router>
我们经常使用的两个寄存器值:0x2102 (正常),0x2142(不读取保存的配置)。
三、如果正常启动,则按引导程序到Flash中查找IOS镜像。如果找到IOS镜像,则读取后正常启动。如果没有找到IOS镜像,则进入boot模式,即Mini IOS启动。boot模式下可使用TFTP上的IOS;或使用TFTP/X-modem为路由器重新灌一个IOS。如果Mini IOS也启动失败,则进入rom monitor模式。
四、读取IOS并初始化成功后,引导程序将更具寄存器值决定加载或者不加载启动配置文件。如果选择加载,则到NVRAM中找到启动配置文件,并加载到 RAM中成为运行配置文件。如果选择不加载或者根本没有启动配置文件,则路由器会进入询问配置模式,以问答的方式对路由器进行基本配置。
五、进入用户模式,启动过程完毕。
**********************************
思科路由器密码恢复方法一
使用这种方法可使下列思科路由器密码恢复:Cisco2000系列、2500系列、3000系列、使用680x0MotorolaCPU的Cisco4000系列、运行10.0版本以上CiscoIOS系统的7000系列路由器。
1.在路由器的console口接上一个终端或用安装仿真终端软件的PC机。
2.输入showversion命令,然后记下寄存器值,通常是0x2102or0x102。这个值显示在***一行,注意寄存器的配置是否把Break设为enable或disable。
缺省配置寄存器值是0x2102。这个值从左数第三个数字如果是1,则是disableBreak;如果为零,则Break为enabled。
3.切断电源后再重启。
4.在路由器启动的60秒内在终端机上按Break键。将显示rommon>提示符。如果提示符不是这样,则终端没有发出正确的中断信号,检查Break键是否正确或是否被设为disable。
5.在提示符下输入o/r0x42或o/r0x41,o/r0x42意思是从Flashmemory引导,o/r0x41意思是从ROMs引导(注意,***个字符是字母o,不是数字0)。***用0x42,在Flashmemory没有装或erase的情况下,才用0x41,如果有0x41则只能view或erase配置,不能直接更改密码。
6.在rommon>提示符下输入初始化命令。
7.输入系统配置对话提示符敲no,一直等提示信息显示:PressRETURNtogetstarted!
8.敲回车,出现Router>提示符。
9.输入enable命令,出现Router#提示符。
10.选择下面选项中的一项:
如果password没有加密,直接用morenvram:startup-config命令可以看密码;在password加密的情况下,无法看,只能修改,输入命令如下:
Router#configurememory
Router#configureterminal
Router(config)#enablesecret1234abcd
Router(config)#ctrl-z
Router#writememory
11.在EXEC提示符输入configureterminal进入配置模式。输入config-register命令,把在第二步中记录的寄存器值复原。
12.敲Ctrl-Z,退出配置状态。
13.在特权模式下用writememory命令保存配置,然后reboot重启。
思科路由器密码恢复方法二
使用这种方法可使下列思科路由器密码恢复:Cisco1003、1600系列、3600系列、4500系列、7200系列、7500系列和IDTOrion-Based路由器,前四步和***种方法一样。
5.在rommon>提示符下输入confreg命令。
Doyouwishtochangeconfiguration[y/n]?
输入yes,然后回车。在回答后面的问题时一直选择no,直到出现“ignoresystemconfiginfo[y/n]?”时输入yes。接着继续敲no回答,一直到看到“changebootcharacteristics[y/n]?”时输入yes。
entertoboot:在这个提示符下可以有2和1两种选择。如果Flashmemoryiserased选择1,这样只能vieworerase配置,不能直接修改password。***选择2。出现如下提示:Doyouwishtochangeconfiguration[y/n]?回答no,然后回车,显示“rommon>”。
6.在特权EXEC下输入reload命令。
思科路由器密码恢复操作到这后,后面操作同***种方法。

程序1
完成这些步骤为了恢复您的密码:
附加终端或PC有终端仿真的路由器的控制台端口。
使用以下终端设置:
有关如何使用电缆将终端连接到控制台端口或 AUX 端口的信息,请参阅以下文档:
控制台和Aux端口的布线指南
连接终端到在Catalyst交换机的控制台端口
将终端连接到 Catalyst 2948G-L3、4908G-L3 和 4840G 系列交换机
9600波特率
无奇偶校验
8 个数据位
1 个停止位
无流控制
如果可以访问路由器,请在提示符处键入 show version,并且记录配置寄存器设置。参见密码恢复流程示例为了查看输出的show version命令。
Note: 配置寄存器通常设置为0x2102或0x102。如果能不再访问路由器(由于未接通登录或TACACS密码),您能安全假设,您的配置寄存器设置为0x2102。
请使用电源开关为了关闭路由器,然后翻回路由器。
重要说明:
要在 Cisco 6400 上模拟此步骤,请将节点路由处理器 (NRP) 或节点交换机处理器 (NSP) 卡拔出,然后再插入。
要在带有 NI-2 的 Cisco 6x00 上模拟此步骤,请将 NI-2 卡拔出,然后再插入。
按在终端键盘的中断在60秒功率以内为了举起路由器到ROMmon。
如果中断顺序不起作用,请参阅口令恢复过程中的标准break键序列组合,获取其他键组合。
在 rommon 1> 提示符处键入 confreg 0x2142,以便从闪存启动。
此步骤将会跳过存储口令的启动配置。
键入重置在rommon 2>提示。
路由器重新启动,但是忽略已保存的配置。
在每个设置问题后键入 no 或按 Ctrl-C,跳过初始设置过程。
键入enable (event)在Router>提示。
您将进入启用模式,此时应看到 Router# 提示符。
键入 configure memory 或 copy startup-config running-config,将非易失性 RAM (NVRAM) 复制到内存中。
警告: 请勿键入 copy running-config startup-config 或执行写操作。这些erase命令您的启动配置。
键入show running-config。
show running-config 命令将会显示路由器的配置。在此配置中,在所有接口下将会出现 shutdown 命令,显示当前关闭的所有接口。另外,密码(特权密码、enable secret、VTY,控制台密码)在加密或未加密的格式。您能重新使用未加密的密码。您必须更改加密的密码到一个新的密码。
类型配置终端。
hostname(config)-提示出现。
键入 enable secret <password>,以更改 enable secret 口令。例如:
hostname(config)#enable secret cisco
在所用的每个接口上发出 no shutdown 命令。
如果发出 show ip interface brief 命令,则要使用的每个接口都应显示 up up。
键入 config-register <configuration_register_setting>。其中 configuration_register_setting 的值为步骤 2 中记录的值或 0x2102。例如:
hostname(config)#config-register 0x2102
按 Ctrl-z 或 end,离开配置模式。
主机名提示出现。
键入 write memory 或 copy running-config startup-config,以提交更改。
程序2
完成这些步骤为了恢复您的密码:
关闭路由器。
去除在路由器的返回的微型闪存。
在路由器的功率。
一旦Rommon1>提示出现,请输入此命令:
confreg 0x2142
插入微型闪存。
键入重置。
当提示您输入初始配置时,请键入没有,并且按Enter。
在Router>提示,请键入enable (event)。
在Router-提示,请输入configure memory命令,并且按Enter为了复制启动配置到运行的配置。
请使用config t命令为了输入全局配置模式。
请使用此命令为了创建一个新的用户名和密码:
router(config)#username cisco privilege 15 password
cisco请使用此命令为了更改引导说明:
config-register
0x2102请使用此命令为了保存配置:
write
memory重新载入路由器,然后请使用新的用户名和密码登陆到路由器。
密码恢复流程示例
本部分提供了一个口令恢复过程的示例。此示例是使用 Cisco 2600 系列路由器创建的。即使您使用的不是 Cisco 2600 系列路由器,以下输出也可为您的产品体验提供示例。
Router>enable
Password:
Password:
Password:
% Bad secretsRouter>show version
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-IS-M), Version 12.0(7)T, RELEASE SOFTWARE (fc2)
Copyright (c) 1986-1999 by cisco Systems, Inc.
Compiled Tue 07-Dec-99 02:21 by phanguye
Image text-base: 0x80008088, data-base: 0x80C524F8ROM: System Bootstrap, Version 11.3(2)XA4, RELEASE SOFTWARE (fc1)
Router uptime is 3 minutes
System returned to ROM by abort at PC 0x802D0B60
System image file is "flash:c2600-is-mz.120-7.T"cisco 2611 (MPC860) processor (revision 0x202) with 26624K/6144K bytes of memory.
Processor board ID JAB031202NK (3878188963)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
Basic Rate ISDN software, Version 1.1.
2 Ethernet/IEEE 802.3 interface(s)
2 Serial(sync/async) network interface(s)
1 ISDN Basic Rate interface(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash partition 1 (Read/Write)
8192K bytes of processor board System flash partition 2 (Read/Write)Configuration register is 0x2102
Router>
!--- The router was just powercycled, and during bootup a !--- break sequence was sent to the router.
!
*** System received an abort due to Break Key ***
signal= 0x3, code= 0x500, context= 0x813ac158
PC = 0x802d0b60, Vector = 0x500, SP = 0x80006030
rommon 1 > confreg 0x2142You must reset or power cycle for new config to take effect
rommon 2 > reset
System Bootstrap, Version 11.3(2)XA4, RELEASE SOFTWARE (fc1)
Copyright (c) 1999 by cisco Systems, Inc.
TAC:Home:SW:IOS:Specials for info
C2600 platform with 32768 Kbytes of main memoryprogram load complete, entry point: 0x80008000, size: 0x6fdb4c
Self decompressing the image : ###############################
##############################################################
##############################################################
##############################################################
############################### [OK]Restricted Rights Legend
Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.cisco Systems, Inc.
170 West Tasman Drive
San Jose, California 95134-1706Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-IS-M), Version 12.0(7)T, RELEASE SOFTWARE (fc2)
Copyright (c) 1986-1999 by cisco Systems, Inc.
Compiled Tue 07-Dec-99 02:21 by phanguye
Image text-base: 0x80008088, data-base: 0x80C524F8cisco 2611 (MPC860) processor (revision 0x202) with 26624K/6144K bytes of memory.
Processor board ID JAB031202NK (3878188963)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
Basic Rate ISDN software, Version 1.1.
2 Ethernet/IEEE 802.3 interface(s)
2 Serial(sync/async) network interface(s)
1 ISDN Basic Rate interface(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash partition 1 (Read/Write)
8192K bytes of processor board System flash partition 2 (Read/Write)--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: n
Press RETURN to get started!
00:00:19: %LINK-3-UPDOWN: Interface BRI0/0, changed state to up
00:00:19: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
00:00:19: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up
00:00:19: %LINK-3-UPDOWN: Interface Serial0/0, changed state to down
00:00:19: %LINK-3-UPDOWN: Interface Serial0/1, changed state to down
00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0/0,
changed state to down
00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0,
changed state to up
Router>
00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1,
changed state to up
00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0,
changed state to down
00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1,
changed state to down
00:00:50: %SYS-5-RESTART: System restarted --
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-IS-M), Version 12.0(7)T, RELEASE SOFTWARE (fc2)
Copyright (c) 1986-1999 by cisco Systems, Inc.
Compiled Tue 07-Dec-99 02:21 by phanguye
00:00:50: %LINK-5-CHANGED: Interface BRI0/0,
changed state to administratively down
00:00:52: %LINK-5-CHANGED: Interface Ethernet0/0,
changed state to administratively down
00:00:52: %LINK-5-CHANGED: Interface Serial0/0,
changed state to administratively down
00:00:52: %LINK-5-CHANGED: Interface Ethernet0/1,
changed state to administratively down
00:00:52: %LINK-5-CHANGED: Interface Serial0/1,
changed state to administratively down
00:00:53: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0,
changed state to down
00:00:53: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1,
changed state to down
Router>
Router>enable
Router#copy startup-config running-config
Destination filename [running-config]?
1324 bytes copied in 2.35 secs (662 bytes/sec)
Router#
00:01:24: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0/0:1,
changed state to down
00:01:24: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0/0:2,
changed state to down
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#enable secret < password >
Router(config)#^Z
00:01:54: %SYS-5-CONFIG_I: Configured from console by console
Router#show ip interface briefInterface IP-Address OK? Method Status Protocol
Ethernet0/0 10.200.40.37 YES TFTP administratively down down
Serial0/0 unassigned YES TFTP administratively down down
BRI0/0 193.251.121.157 YES unset administratively down down
BRI0/0:1 unassigned YES unset administratively down down
BRI0/0:2 unassigned YES unset administratively down down
Ethernet0/1 unassigned YES TFTP administratively down down
Serial0/1 unassigned YES TFTP administratively down down
Loopback0 193.251.121.157 YES TFTP up up
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface Ethernet0/0
Router(config-if)#no shutdown
Router(config-if)#
00:02:14: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
00:02:15: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0,
changed state to up
Router(config-if)#interface BRI0/0
Router(config-if)#no shutdown
Router(config-if)#
00:02:26: %LINK-3-UPDOWN: Interface BRI0/0:1, changed state to down
00:02:26: %LINK-3-UPDOWN: Interface BRI0/0:2, changed state to down
00:02:26: %LINK-3-UPDOWN: Interface BRI0/0, changed state to up
00:02:115964116991: %ISDN-6-LAYER2UP: Layer 2 for Interface BR0/0,
TEI 68 changed to up
Router(config-if)#^Z
Router#
00:02:35: %SYS-5-CONFIG_I: Configured from console by console
Router#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
Router#show version
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-IS-M), Version 12.0(7)T, RELEASE SOFTWARE (fc2)
Copyright (c) 1986-1999 by cisco Systems, Inc.
Compiled Tue 07-Dec-99 02:21 by phanguye
Image text-base: 0x80008088, data-base: 0x80C524F8ROM: System Bootstrap, Version 11.3(2)XA4, RELEASE SOFTWARE (fc1)
Router uptime is 3 minutes
System returned to ROM by abort at PC 0x802D0B60
System image file is "flash:c2600-is-mz.120-7.T"cisco 2611 (MPC860) processor (revision 0x202)
with 26624K/6144K bytes of memory.
Processor board ID JAB031202NK (3878188963)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
Basic Rate ISDN software, Version 1.1.
2 Ethernet/IEEE 802.3 interface(s)
2 Serial(sync/async) network interface(s)
1 ISDN Basic Rate interface(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash partition 1 (Read/Write)
8192K bytes of processor board System flash partition 2 (Read/Write)Configuration register is 0x2142
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#config-register 0x2102
Router(config)#^Z
00:03:20: %SYS-5-CONFIG_I: Configured from console by consoleRouter#show version
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-IS-M), Version 12.0(7)T, RELEASE SOFTWARE (fc2)
Copyright (c) 1986-1999 by cisco Systems, Inc.
Compiled Tue 07-Dec-99 02:21 by phanguye
Image text-base: 0x80008088, data-base: 0x80C524F8ROM: System Bootstrap, Version 11.3(2)XA4, RELEASE SOFTWARE (fc1)
Router uptime is 3 minutes
System returned to ROM by abort at PC 0x802D0B60
System image file is "flash:c2600-is-mz.120-7.T"cisco 2611 (MPC860) processor (revision 0x202)
with 26624K/6144K bytes of memory.
Processor board ID JAB031202NK (3878188963)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
Basic Rate ISDN software, Version 1.1.2 Ethernet/IEEE 802.3 interface(s)
2 Serial(sync/async) network interface(s)
1 ISDN Basic Rate interface(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash partition 1 (Read/Write)
8192K bytes of processor board System flash partition 2 (Read/Write)Configuration register is 0x2142 (will be 0x2102 at next reload)
Router#