Lessons · Network switches · password recovery
Getting back into a switch nobody has the password for
The configuration register decides whether the startup configuration is read at boot. 0x2142 skips it; 0x2102 is normal.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
You will inherit a switch whose password left with somebody. This is the documented way back in, and it works because it needs physical access to the console, which is the point.
How to think about it
Skip the configuration, boot, then LOAD it deliberately with copy startup-config running-config so nothing is lost, set a new secret, put the register back, and save. The last two steps are the ones people forget.
Worked example
enableThe console gets you here on a box booted without its configuration.
configure terminalInto configuration mode.
config-register 0x2142The next boot will skip the startup configuration.
endOut.
write memoryThe register setting has to survive the reload, so it is saved.
reloadIt comes back with defaults, and no password, because the configuration was skipped rather than erased.
enableStraight in.
configure terminalAnd now the recovery proper.
enable secret Ledger-4-RoomA password you know.
config-register 0x2102Back to normal, or the switch skips its own configuration for ever.
endOut.
write memorySaved. Miss this and the whole recovery is undone by the next power cut.
Your turn
Set the register back to its normal value.
config-register
Console into a switch
The trap
Erasing the startup configuration instead of skipping it. That gets you in too, and it takes the whole configuration with it: every VLAN, every port, every description.