您的位置:首页 > 其它

How to reset password for Cisco router and switch

2013-11-19 20:02 429 查看
这是我在公司写的文档,所以是英文的,我水平也差,不喜勿喷!红色字体的都是命令,注意操作,不要丢了配置,相关问题在我的另一篇博文中有提到:/article/4549289.html。谢谢!不得不说一句:实践出真知,当你有一个思路去实践的时候,你会发现各种各样的问题,获得意想不到的收获:Router(这个是我根据书上自己总结写的,没有经过实践):
1. Console port connectsto PC COM port.
2. Open the ScecureCTRor other software , e.g. Putty.
3. When loadingIOS image ,use Ctrl+C to interrupt the progress to got ROMMON model
rommon>
4. confreg 0x2142, This command tell router don’t loadstartup-config at next time restart 。
5.Restart therouter manually,or use reload to restart.
6 Execute the followingcommand when the router on(after IOS image loaded and the
setup process show.enter no to terminate the process.)
enable enter the privileged EXEC mode
copy start run copy the startup-config to running-config
conf t enter theconfiguration mode
ena sec **** enable secretset as ****,change the password.
config-register 0x2102 restore theregister value,the value maybe
different,so you better got the value before change to 0x2142 use show version
end or Ctrl+C exit from the configurationmode
copy run start or wr save allthe config to NVRAM.
Boot or Reload boot theIOS or reboot the router.it seems that we
don’t need to restart the router.

Switch(这有在交换机上试验过,中文部分都是实践所得,花了好几天的时间思考和验证,都是精华啊!):
1. Connect theswitch RJ-45 console port and the PC’s COM port.
2. launch theremote connect software, e.g. SecureCRT,Putty.
3.Poweron the switch device,and press the mode button until the port status LEDs aredown.enter the ROMMON model.
flash_init init the flash file system.
//这个命令的作用感觉有点像linux中的磁盘挂载,如果不先执行这个命令,dir flash 就会报错。
load _helper //在C3560G交换机中,没有该命令,实践告诉我至少在这台交换机上不需要
dir flash: change the work directory to flash: and display the files.
rename flash:config.txt flash:config.back rename the configure file name to let the switch can’t find
the file”config.txt”.
boot boot the IOS image and the operation system will can’t find the configure file. the setup dialog will process.
//boot是在ROMMOM模式下,继续加载过程.
NO enter NO to ignore the dialog
enable enter the privileged EXEC mode
rename flash:config.back flash:config.text restore the file name of the config.txt
//config.text是在使用WR保存running-config的时候生成的,show命令查看的就是这个文件的内容,因为这时dir all,会看到nvram中的startup-config是0字节,而show startup则会显示内容,只能是config.text.可以确认的是nvram:startup-config是flash:config.text的备份copy.
总之,show start,其实是show flash:config.text。

copy flash:config.text system:running-config copy the startup-configto running-config,
//不知道system:running-config是不是就是内存中的那个running-config,难道system:就是内存空间的标识,但有一点事可以肯定的,那就是这二者的内容随时都是一样的内容,(我是有在修改配置等变化的情况下,把文件导出对比过的)
//还有两个命令,效果一样:copy star run 与copy flash:config.text run。其实质是一样的,因为:startup-config,flash:config.text,nvram:startup-config在涉及到他们的命令可用时那么三者必定是一样的。同样:running-config,system:running-config,随时都是一样的。所以只要方向没有问题,在命令有效的条件下,三个命令都可行。(在ROMMON模式下,nvram不可读,所以后二者不能使用,在正常模式下三者都可行,但常用的是copy star run.)
经过多次测试:
copy start tftp
copy flash:config.text tftp
copy nvram:startup-config tftp
三者会得到一样的文件,内容完全一样,而且字节数也一样。但config.text应该是核心文件,都以它作为标准。使用erase startup-config的时候,会同时删除flash和nvram中的两个文件。尝试单独删除其中之一时,显示命令错误...
copy run tftp
copy system:running-config tftp
二者也是得到一样的文件。(那个system里的running-config是内存空间中的一个备份,就像nvram中的是flash中的备份一样吗?还是直接就是内存的表示?)
conf t enter the configuration mode
ena sec **** reset enable password
end exit from the configuration mode
copy run start save the running-config to NVRAM
reload or
unplug thepower line of the switch and then plug in to restart the switch.
In ALL.The purposeof all the methods used is to ignore/skip the configuration file loading. Because the password is stored in the configuration file.

本文出自 “奋斗的菜鸟” 博客,谢绝转载!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: