ちくわ

ちくわにきゅうりを入れるとうまい

パスワード不明の Cisco Catalyst2950 を、config 確認(パスワードリカバリ)と初期化した時の手順メモ

パスワード不明の catalyst を config クリアしたのでその手順をメモします。

ついでに設定も抜き出しました(パスワード以外の設定確認)。

電源断が許されればパスワードリカバリは可能のようです。

※設定削除を伴う作業のため、十分注意が必要。対象機器を間違えるとかは事件です。

以下手順はあくまで個人的な作業メモであり、責任は持てません。

● catalyst2950 パスワードリカバリ手順(設定確認)

・catalyst2950 の電源を一旦落とす(電源ケーブルを抜く)

・コンソールで接続しておく

・全面(interface がたくさんある方)左側にある「MODE」ボタンを押しながら電源ケーブルを挿入する

・STAT LED が点滅し、5秒経過後、SYST LED が橙/緑と交互に点滅しだすのを確認し、「MODE」ボタンを離す。以下の様なメッセージがコンソールに流れる。

C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1)

Compiled Mon 22-Jul-02 17:18 by antonino

WS-C2950-24 starting...

Base ethernet MAC Address: 00:15:62:fa:96:40

Xmodem file system is available.

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

load_helper

boot

switch:

flash_init と入力。フラッシュファイルシステムを初期化する。具体的になにやってるかはよくわからずw

ちなみに、ここで config 設定が消える(初期化される)と言うことはありません。

switch: flash_init

Initializing Flash...

flashfs[0]: 359 files, 4 directories

flashfs[0]: 0 orphaned files, 0 orphaned directories

flashfs[0]: Total bytes: 7741440

flashfs[0]: Bytes used: 4667392

flashfs[0]: Bytes available: 3074048

flashfs[0]: flashfs fsck took 7 seconds.

...done initializing flash.

Boot Sector Filesystem (bs:) installed, fsid: 3

Parameter Block Filesystem (pb:) installed, fsid: 4

・load_helper と入力し、ヘルパーファイルをロードする。特に何も表示がなかった。ロードされたファイルは無かったってこと?ちょっと調べたけどわからず。

switch: load_helper

switch:

・dir flash: と入力。flash の中を確認してみる。(確認のみ)

switch: dir flash:

Directory of flash:/

2 -rwx 109 info

3 -rwx 269 env_vars

4 -rwx 616 vlan.dat

6 -rwx 4349 config.text

7 -rwx 3097872 c2950-i6q4l2-mz.121-22.EA4.bin

8 drwx 4032 html

362 -rwx 109 info.ver

363 -rwx 25 private-config.text

364 -rwx 1048 multiple-fs

3074048 bytes available (4667392 bytes used)

switch:

・rename flash:config.text flash:config.old と入力し、コンフィグレーションファイルの名前を変更する。一時的な退避なので変更後の名前はわかりやすければなんでもOKだと思う。あとで戻すのでメモって置くと吉(あとで確認は出来る)。

switch: rename flash:config.text flash:config.old

switch:

・再度 dir flash: と入力、リネームされた事を確認する

switch: dir flash:

Directory of flash:/

2 -rwx 109 info

3 -rwx 269 env_vars

4 -rwx 616 vlan.dat

6 -rwx 4349 config.old ★

7 -rwx 3097872 c2950-i6q4l2-mz.121-22.EA4.bin

8 drwx 4032 html

362 -rwx 109 info.ver

363 -rwx 25 private-config.text

364 -rwx 1048 multiple-fs

3074048 bytes available (4667392 bytes used)

switch:

・boot と入力し、起動する。セットアップモードは Ctrl + c か no と入力し、スキップする

switch: boot

Loading "flash:/c2950-i6q4l2-mz.121-22.EA4.bin"...###########################################################################################################################################################################################################

<略>

--- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]:

Press RETURN to get started!

Switch>

・enable で特権モードに入る

Switch>en

Switch#

・(確認)この時点で sh start しても無いと言われる。さっき config をリネームした為。

Switch#sh start

startup-config is not present

・rename flash:config.old flash:config.text と入力し、コンフィグレーションファイルを戻す

Switch#rename flash:config.old flash:config.text

Destination filename [config.text]?

・(確認)この時点で sh start すると設定ファイルが見える。↑の手順で戻した為。

Switch#sh start

<略>

・copy flash:config.text system:running-config と入力し、フラッシュメモリにある config.text を、DRAM にある running-config にコピーする

Switch#copy flash:config.text system:running-config

Destination filename [running-config]?

4349 bytes copied in 2.592 secs (1678 bytes/sec)

・show run 等をして設定ファイルが正しくロード(copy)されているか確認する

#show run

・以下はパスワードを再設定してそのまま使いたい場合

- パスワードを再設定する

- copy running-config startup-config して設定を保存し、必要に応じて no shutdown や reload をする

● catalyst2950 config clear 手順

・enable で特権モードに入る

Switch>en

Switch#

・erase startup-config または write erase でスイッチを工場出荷時のデフォルトにリセットする。

実行後に Continue? と聞かれる為、問題なければ y を押して続ける

Switch#write erase

Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]y[OK]

Erase of nvram: complete

・sh start として確かに設定が clear さている(ただの確認)。

Switch#sh start

startup-config is not present

・reload する。設定保存するか聞いてくるが n を押す。更に reload していいか確認してくるので Enter すれば進む。セットアップモードは Ctrl + c か no と入力し、スキップする

Switch#reload

System configuration has been modified. Save? [yes/no]: n

Proceed with reload? [confirm]

<略>

Would you like to enter the initial configuration dialog? [yes/no]:no

・enable して sh run などしても設定が load されていないことを確認する

・引き続き vlan.dat を削除する。write erase だけでは vlan 情報は削除されないみたい。試しに sh vlan しても設定情報が残っているのが確認できる

Switch#sh vlan

<略>

・dir flash: と入力し、flash 内のファイルを見てみる。確かに vlan.dat がある

Switch#dir flash:

Directory of flash:/

2 -rwx 109 Mar 01 1993 00:01:47 +00:00 info

3 -rwx 269 Jan 01 1970 00:01:46 +00:00 env_vars

4 -rwx 616 Mar 01 1993 00:00:17 +00:00 vlan.dat ★

7 -rwx 3097872 Mar 01 1993 00:03:17 +00:00 c2950-i6q4l2-mz.121-22.EA4.bin

8 drwx 4032 Mar 01 1993 00:03:47 +00:00 html

362 -rwx 109 Mar 01 1993 00:04:18 +00:00 info.ver

7741440 bytes total (3081216 bytes free)

・delete flash:vlan.dat と入力し、vlan.dat を削除する。確認が入るので Enter して続ける(消して良ければ)。

Switch#delete flash:vlan.dat

Delete filename [vlan.dat]?

Delete flash:vlan.dat? [confirm]

・再度 dir flash: で確認してみる。vlan.dat が消えていることを確認する。

Switch#dir flash:

Directory of flash:/

2 -rwx 109 Mar 01 1993 00:01:47 +00:00 info

3 -rwx 269 Jan 01 1970 00:01:46 +00:00 env_vars

7 -rwx 3097872 Mar 01 1993 00:03:17 +00:00 c2950-i6q4l2-mz.121-22.EA4.bin

8 drwx 4032 Mar 01 1993 00:03:47 +00:00 html

362 -rwx 109 Mar 01 1993 00:04:18 +00:00 info.ver

7741440 bytes total (3082240 bytes free)

・reload して再起動する

Switch#reload

Proceed with reload? [confirm]

・起動後に、enable で特権モードに入り、sh vlan などして設定が削除されたことを確認

Switch#sh vlan

<略>

ref. http://www.cisco.com/cisco/web/support/JP/100/1007/1007864_156-j.html

ref. http://www.infraexpert.com/study/ciscoios13.html