パスワードを忘れてしまった
Cisco SWのパスワードを忘れてしまい、SWにログインすることが出来なくなりました。
さてさて、どうしたものか・・・
グーグル先生に聞いてみたところ、以下の手順で設定されているコンフィグをクリアすることなく、パスワードの再設定を行うことが出来ます。
パスワード再設定手順
- コンソールケーブルでPCとパスワード再設定対象SWを接続
- パスワード再設定対象SWの電源断
- Modeボタンを押下してのパスワード再設定対象SWの起動
- フラッシュシステムの初期化
- ヘルパーファイルのロード
- コンフィグファイルの確認
- コンフィグファイル名の変更
- コンフィグファイル名の変更確認
- パスワード再設定対象SWの再起動
- 初期設定ダイアログの回避
- 特権モードへの移行
- コンフィグファイル名を復元
- コンフィグファイルをrunning-configへコピー
- パスワードの上書き
- 設定の保存
- パスワード再設定対象SWの再起動
コンソールケーブルでPCとパスワード再設定対象SWを接続
コンソールケーブルを物理的に接続し、PC上でターミナルソフトを起動
パスワード再設定対象SWの電源断
電源コードを抜き、電源を切断
Modeボタンを押下してのパスワード再設定対象SWの起動
電源コードを再接続し、15秒以内にModeボタンを押しっぱなしにする
しばらくすると以下の様な画面が表示されるのでそれまでModeボタンを押し続ける
Using driver version 4 for media type 2
Base ethernet MAC Address: bc:c4:93:1d:b2:00
Xmodem file system is available.
The password-recovery mechanism is enabled.
Modeボタンを離すと以下の様な画面が表示されます
The system has been interrupted prior to initializing the
flash filesystem. The following commands will initialize
the flash filesystem, and finish loading the operating
system software:
flash_init
boot
switch:
上記の画面が表示されない場合は、起動失敗なので電源断から再度トライ
フラッシュシステムの初期化
フラッシュファイルシステムを初期化するため以下のコマンドを入力
switch:flash_init
コマンド入力時に短縮形やTabキーでの補完は出来ないので、正確にフルフル入力します
コマンドを実行すると以下のような表示がされます
switch: flash_init
Initializing Flash...
mifs[2]: 10 files, 1 directories
mifs[2]: Total bytes : 2097152
mifs[2]: Bytes used : 689664
mifs[2]: Bytes available : 1407488
mifs[2]: mifs fsck took 1 seconds.
mifs[3]: 3 files, 1 directories
mifs[3]: Total bytes : 4194304
mifs[3]: Bytes used : 1394176
mifs[3]: Bytes available : 2800128
mifs[3]: mifs fsck took 1 seconds.
mifs[4]: 5 files, 1 directories
mifs[4]: Total bytes : 524288
mifs[4]: Bytes used : 9216
mifs[4]: Bytes available : 515072
mifs[4]: mifs fsck took 1 seconds.
mifs[5]: 5 files, 1 directories
mifs[5]: Total bytes : 524288
mifs[5]: Bytes used : 9216
mifs[5]: Bytes available : 515072
mifs[5]: mifs fsck took 0 seconds.
mifs[6]: 7 files, 3 directories
mifs[6]: Total bytes : 57671680
mifs[6]: Bytes used : 40489984
mifs[6]: Bytes available : 17181696
mifs[6]: mifs fsck took 21 seconds.
...done Initializing Flash.
Verifying image ucode0:usbdos.dl....
Image passed digital signature verification
Verifying bootloader image........
BootLoader self verification passed
switch:
ヘルパーファイルのロード
ヘルパーファイルをロードします
switch:load_helper
switch: load_helper
Unknown cmd: load_helper
switch:
ヘルパーファイルがない場合は上記のようにコマンドがないと表示されます
コンフィグファイルの確認
フラッシュメモリ内にconfig.textファイルがあることを確認
switch:dir flash:
switch: dir flash:
Directory of flash:/
2 drwx 512 <date> c3750e-universalk9-mz.152-4.E10
4 drwx 512 <date> c3750e-universalk9-mz.122-55.SE5
6 -rwx 1912 <date> config.text
7 -rwx 1932 <date> private-config.text
8 -rwx 3096 <date> multiple-fs
9 -rwx 2963 <date> config.text.backup
10 -rwx 1934 <date> private-config.text.backup
16779K bytes available (39541K bytes used)
switch:
コンフィグファイル名の変更
コンフィグレーションファイルの名前を変更
switch:rename flash:config.text flash:config.text.old
コンフィグファイル名の変更確認
コンフィグレーションファイルの名前が変更されていることを確認
switch:dir flash:
switch: dir flash:
Directory of flash:/
2 drwx 512 <date> c3750e-universalk9-mz.152-4.E10
4 drwx 512 <date> c3750e-universalk9-mz.122-55.SE5
6 -rwx 1912 <date> config.text.old
7 -rwx 1932 <date> private-config.text
8 -rwx 3096 <date> multiple-fs
9 -rwx 2963 <date> config.text.backup
10 -rwx 1934 <date> private-config.text.backup
16779K bytes available (39541K bytes used)
switch:
パスワード再設定対象SWの再起動
以下のコマンドでSWを再起動
switch:boot
初期設定ダイアログの回避
再起動が完了すると以下の様になるのでnoを入力
--- System Configuration Dialog ---
Enable secret warning
----------------------------------
In order to access the device manager, an enable secret is required
If you enter the initial configuration dialog, you will be prompted for the enable secret
If you choose not to enter the intial configuration dialog, or if you exit setup without setting the enable secret,
please set an enable secret using the following CLI in configuration mode-
enable secret 0 <cleartext password>
----------------------------------
Would you like to enter the initial configuration dialog? [yes/no]:no
特権モードへの移行
特権モードへ移行
Switch>enable
Switch#
コンフィグファイル名を復元
コンフィグレーションファイルの名前を元に戻す
Switch#rename flash:config.text.old flash:config.text
Switch#rename flash:config.text.old flash:config.text
Destination filename [config.text]?
ファイル名に間違いがなければエンターキーを入力
コンフィグファイルをrunning-configへコピー
コンフィグレーションファイルの設定内容をrunning-configへコピー
Switch#copy flash:config.text system:running-config
Destination filename [running-config]?
ファイル名に間違いがなければエンターキーを入力
running-configにコピーされた内容が間違いないかを確認
Switch#show running-config
パスワードの上書き
パスワードを再設定
Switch#configure terminal
Switch(config)#enable secret 設定するパスワード
Switch(config)#exit
設定の保存
新たに設定したパスワードを保存
Switch#copy running-config startup-config
パスワード再設定対象SWの再起動
SWを再起動し、再起動後設定したパスワードでログインできることを確認
Switch#reload