亲测。
传统方法,可尝试百度经验,GNS3中确实可以用该方法重置(转载百度https://jingyan.baidu.com/article/0eb457e5f35d6803f1a9051c.html),但在实体机中2960,和3850中试过该方法无效,于是我找了一波曲线救国的方式。
开机疯狂Ctrl+break键(网上说ctrl+c你们也可以试试),进入rommon模式
ssh中的LOG日志不知道被我删哪里去了,所以转载一下别人的,将就记录一下
Switch:dir flash: //查看Flash的文件名字可以用来确认文件名为config.text
Switch:rename flash:config.text flash:config.text.old //把配置文件重命名,当然你可以不改为config.text.old,只要文件名和原来的不相同就可以
Switch:boot //手动启动交换机
由于配置文件改过了,所以交换机找不到默认的config.text而出现配置的对话向导,选择n然后回车然后我们就会绕过原来的password而进入到:
Switch>
Switch>en //可以进入特权模式
Switch#rename flash:config.text.old flash:config.text //恢复交换机配置文件
Switch#copy flash:config.text system:running-config //保存配置到DRAM里
Switch#config t
Switch(config)#no enable password //删除特权模式旧密码
Switch(config)#no enable secret //删除加密密码
Switch(config)#exit
部分转载原文链接:https://blog.csdn.net/starvanq/article/details/81258699
下面是3850系列的修改方式
SUMMARY STEPS:
Connect a terminal or PC to the switch.
Set the line speed on the emulation software to 9600 baud.
Power off the standalone switch or the entire switch stack.
Reconnect the power cord to the or the active switch. Within 15 seconds, press the Mode button while
the System LED is still flashing green. Continue pressing the Mode button until all the system LEDs turn
on and remain solid; then release the Mode button.
After recovering the password, reload the switch or the active switch .
Power on the remaining switches in the stack.
DETAILED STEPS:
Step 1 :Connect a terminal or PC to the switch.
• Connect a terminal or a PC with terminal-emulation software to the switch console port. If you are recovering the
password for a switch stack, connect to the console port of the active switch or
• Connect a PC to the Ethernet management port. If you are recovering the password for a switch stack, connect to
the Ethernet management port of a stack member .
Step 2 :Set the line speed on the emulation software to 9600 baud.
Step 3 :Power off the standalone switch or the entire switch stack.
Step 4 :Reconnect the power cord to the or the active switch. Within 15 seconds, press the Mode button while the System LED
is still flashing green. Continue pressing the Mode button until all the system LEDs turn on and remain solid; then release
the Mode button.
•
Switch:
Xmodem file system is available.
Base ethernet MAC Address: 20:37:06:4d:e9:80
Verifying bootloader digital signature.
The system has been interrupted prior to loading the operating
system software, console will be reset to 9600 baud rate.
proceed to the Procedure with Password Recovery Enabled section, and follow the steps:
Step 1 Initialize the flash file system.
Switch: flash_init
Step 2 Ignore the startup configuration with the following command:
Switch: SWITCH_IGNORE_STARTUP_CFG=1
Step 3 Boot the switch with the packages.conf file from flash.
Switch: boot flash:packages.conf
Step 4 Terminate the initial configuration dialog by answering No.
Would you like to enter the initial configuration dialog? [yes/no]: No
Step 5 At the switch prompt, enter privileged EXEC mode.
Switch> enable
Switch#
Step 6 Copy the startup configuration to running configuration.
Switch# copy startup-config running-config Destination filename [running-config]?
Press Return in response to the confirmation prompts. The configuration file is now reloaded, and you can change the
password.
Step 7 Enter global configuration mode and change the enable password.
Switch# configure terminal
Switch(config)#
Step 8 Write the running configuration to the startup configuration file.
Switch# copy running-config startup-config
Step 9 Confirm that manual boot mode is enabled.
Switch# show boot
BOOT variable = flash:packages.conf;
Manual Boot = yes
Enable Break = yes
Step 10 Reload the switch.
Switch# reload
Step 11 Return the Bootloader parameters (previously changed in Steps 2 and 3) to their original values.
Switch: switch: SWITCH_IGNORE_STARTUP_CFG=0
Step 12 Boot the switch with the packages.conf file from flash.
Switch: boot flash:packages.conf
Step 13 After the switch boots up, disable manual boot on the switch.
Switch(config)# no boot manual