记得在上一家公司时,出现过交换机突然重启了,配置文件也消失了,所以导致一系列问题等。后来通过查问同事找到了原因,是因为交换机的MODE键抵住了机架,导致重启。而通过按住交换机前面板的MODE键10s后交换机会将配置文件清除,然后重启,也就是说恢复到出厂状态。后来通过查找cisco文档发现有一条命令可以解决这个问题。
全局模式命令:no setup express
解释:
When Express Setup is enabled on a new (unconfigured) switch, pressing the Mode button for 3 seconds
activates Express Setup. You can access the switch through an Ethernet port by using the IP address
10.0.0.1 and then can configure the switch with the web-based Express Setup program or the CLI-based
setup program.
When you press the Mode button for 3 seconds on a configured switch, the mode LEDs start flashing. If
you press the Mode button for a total of 10 seconds, the switch configuration is deleted, and the switch
reboots. The switch can then be configured like a new switch, either through the web-based Express
Setup program or the CLI-based setup program.
......
The primary purpose of the no setup express command is to prevent someone from deleting the switch
configuration by pressing the Mode button for 10 seconds.
不过同时想到了另外一个问题:交换机做密码恢复时需要使用到这个MODE键,如果在交换机上面配置“no setup express”后,会不会导致不能进行密码恢复了呢?于是我今天针对这个问题做了一个实验,答案是使用“no setup express”命令与交换机密码恢复不冲突。
下面介绍一下交换机密码恢复过程:
1,按住MODE键(大概10s)同时启动电源,在发现SYST灯经过一段时间闪动后,突然变成黄色,然后马上就变成绿色不闪烁,这个时候松开MODE键;
2,终端上面会出现如下界面:

3,输入“flash_init”命令,初始化后再输入“dir flash:”命令,显示如下:
4,输入“rename flash:/config.text flash:/config.text.renamed”,结果如下:
需要注意的是:有可能当你输入上述命令后,系统会提示错误信息,重新输入就可以了。这个问题我碰到过很多次。
5,然后重启交换机,命令:boot
注意:这个模式下可以通过“help”命令来查看命令。
6,重启后进入系统,这是show run命令查看出来的是初始化配置,所以需要重命名flash:/config.text.renamed文件,命令:<b>rename flash:</b>config.text.renamed <b>flash:</b>config.text;
7,将<b>flash:</b>config.text拷贝到内存中,命令:<b>copy flash:</b>config.text <b>system:</b>running-config;
8,这个时候就可以修改密码了,然后保存就行了。
总结:为了解决交换机通过mode重启导致配置丢失的问题,可以在交换机上面配置"no setup express"命令,这个命令与交换机密码恢复没有冲突。
本文转自 chris_lee 51CTO博客,原文链接:http://blog.51cto.com/ipneter/92233,如需转载请自行联系原作者