对于许多初学者来说, cisco路由器的ROM Monitor常常令人感到陌生甚至望而生畏的,原因很简单,一是我们并不常常用到该模式,对其相关操作不熟悉;二是在ROM Monitor模式下的操作失误,往往会对路由器造成致命的伤害(比如破坏flash中的IOS文件,导致系统崩溃。),以致于很多人对它束手束脚,望而却步。
其实, ROM Monitor并不复杂,它只是cisco路由器的一个低级操作系统,通常用于测试和排错,我们只需花费很少的时间,就可以轻松搞定。下面笔者就以网管员在实际工作中最常遇到的两种需要使用ROM Monitor的情况为例,做一说明,希望能够抛砖引玉,以飨读者!
情景一:路由器的口令恢复
为了防止别人知道路由器的口令(特别是特权口令),威胁本地网络安全,故,许多管理员将口令设得特别复杂。但由于路由器的配置完成后,我们就很少在去操作路由器,这样过了一段时间后,我们再因为某种需要需对路由器进行配置时,就可能因忘记口令而无法进行。
这时候,我们只需要一台 PC机(OS为windows系列),console电缆一条及相应的接口转换器,还有就是我们在路由器的旁边。然后按照下面的操作,就可以轻松搞定。
1. 设置 PC机的超级终端,使我们能够使用路由器的console口直接对路由器进行操作。注:因其过程非常简单,笔者为节省篇幅,将其省略。
2. 启动路由器,并在前 60秒内按下break或ctrl+break键,进入路由器的ROM Monitor模式。
3. 下面以初学者最常接触到的 cisco 2600系列路由器为例,做一简要描述。
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 memory  (该路由器为 2600系列路由器)
(按下 ctrl+break键,进入ROM Monitor模式)
rommon 1 >?           注:我们可以使用?或help命令查看该模式下可以使用的命令。
alias                set and display aliases command
boot                 boot up an external process
break                set/show/clear the breakpoint
confreg              configuration register utility
cont                 continue executing a downloaded p_w_picpath
……(省略多行)
reset                system reset
set                  display the monitor variables
stack                produce a stack trace
sync                 write monitor environment to NVRAM
sysret               print out info from last system return
tftpdnld             tftp p_w_picpath download
unalias              unset an alias
unset                unset a monitor variable
xmodem               x/ymodem p_w_picpath download          
rommon 2 > confreg 0x2142   注:使用该命令修改路由器的配置寄存器的值,使路由器在下次重起时不要加载启动配置,从而跳过用户口令及特权口令的验证,进入特权模式。
You must reset or power cycle for new config to take effect
rommon 3 > 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 memory
program load complete, entry point: 0x80008000, size: 0x487758
Self decompressing the p_w_picpath : #################################################
################################################################################(以下启动过程省略)
--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: n  注:选择 no直接进入CLI模式
Press RETURN to get started!    (按回车键)
Router>en
Router#     注:此时使用 show version命令查看配置寄存器的值为0x2142.
Router#copy star run    注:使用该命令加载启动配置,然后设置新口令。若没有该步操作,会导致在下次重起后,新口令设置失败。
Router#conf t
Router(config)#config-register 0x2102    注:路由器下次重起后将加载启动配置,需使用新口令进行验证
Router(config)#end
Router#copy run star    注:保存运行配置到启动配置
Destination filename [startup-config]?
Building configuration...
[OK]
提示:
cisco2500、 2000、3000、4000和7000系列路由器的口令恢复与上述操作基本相同,其主要差别为修改配置寄存器的命令为“o/r 0x2142”,以及重起命令为“i”,其它系列的路由器与2600系列基本一致。