方法1:(需要通过console连接控制,波特率115200)
1 重启设备,启动过程中按ctrl+b进入到boot模式
2 在boot模式下执行命令:nopassword
3 在boot下执行:run,系统加载后就可以进入cli了。注意在运行run之前不能下电或重启。
4 在cli下,手工删除或修改密码。
(附录:如果忘记了命令,在boot下运行su,能看到所有的隐含命令)
注:
1 nopassword 是一种厂商使用的特殊机制,取消enable时输入password的过程,并不删除任何配置
2 举例说明,enable如果要输入password,配置如下
switch(config)#enable password level 15 0 test
switch(config)#login
保存后重启,enable进入用户模式时,是需要Password的。
switch>enable
Password:
如果在boot下执行nopassword后,enable就直接进入了。不需要password
switch>enable
switch#
3 而且nopassword只能本次启动有效,如果不改配置,下次重启时如果没有执行nopassword,仍然是要输入密码的
方法2:
1 进入到boot,用show boot-files看当前采用的配置文件名(缺省为startup.cfg)
[Boot]: show boot-files
The primary img file : flash:/linshi.img
The backup img file : flash:/nos1.img
The startup-config file: flash:/startup.cfg
2 删除这个文件
[Boot]: delete startup.cfg
Delete file flash:/startup.cfg? [Y/N]:[N] y
3 重启,效果等于reset,设置恢复出场配置。