雑記帳@こけし

せっかくやったことを書き留めてるだけのブログ

cisco 841Mの初期化が詰んだ話(ユーザとパスワード忘れてしまった編)

久しぶりに触ったら

社会人になりたての頃、従来のciscoルータよりも安価な製品をということで
cisco startsが登場した(多分そんな理由だった気がする。
新社会人の私でも比較的購入しやすかったため、買ってすぐにいろいろ触って遊んだ記憶から早2年。

家のメインのルータをciscoに変えるかーと思って触ったら、そもそもルータに入れない状態にぶち当たり
いろいろ詰んだの経緯を書きなぐっておきます。
(ちゃんと触ったciscoなんで1841とかが最後だったので、実はこの手順が最近主流とだったら恥ずかしい限りですが。)

ワンタイムパスワード

ユーザを作った記憶が微塵もなかったので
初期パスワードで入れると思ったのですが入れない…。

よくよくbannerの部分を読んでいると、ciscoのユーザは1回だけログインできるような記載が・・・。 調べて見るとcisco starsから初期ユーザがワンタイムパスワードになってしまったようです。

yourname con0 is now available

Press RETURN to get started.
-----------------------------------------------------------------------
Cisco Configuration Professional (Cisco CP) is installed on this device.
This feature requires the one-time use of the username "cisco" with the
password "cisco". These default credentials have a privilege level of 15.

YOU MUST USE CISCO CP or the CISCO IOS CLI TO CHANGE THESE
PUBLICLY-KNOWN CREDENTIALS

Here are the Cisco IOS commands.

username <myuser>  privilege 15 secret 0 <mypassword>
no username cisco

Replace <myuser> and <mypassword> with the username and password you want
to use.

IF YOU DO NOT CHANGE THE PUBLICLY-KNOWN CREDENTIALS, YOU WILL
NOT BE ABLE TO LOG INTO THE DEVICE AGAIN AFTER YOU HAVE LOGGED OFF.

For more information about Cisco CP please follow the instructions in the
QUICK START GUIDE for your router or go to http://www.cisco.com/go/ciscocp
-----------------------------------------------------------------------


User Access Verification

Username: cisco
Password:
% Login invalid

リセットボタンも簡単には使えない

なるほど(´-`) めんどくさいから、リセットボタンで初期化したろって思ったんですが configが無いよーって怒られる…はて…(゚A゚;)

Username:
% No valid customer configuration file found

% Aborting loading of customer configuration

ちゃんとciscoのサイトに情報公開されていた

ユーザーとパスワード回復の仕方、工場出荷時の戻し方が掲載されてました。 リセットボタンで初期化するときは、USBに初期のConfigをいれてからボタンを押す必要があるようでふね。
できる人はリンク先を見ていただければわかるとおもいますが、一応作業結果を以降に記載しておこうと思います。

https://community.cisco.com/t5/cisco-start-%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88/c841m-%E3%83%AA%E3%82%AB%E3%83%90%E3%83%AA-%E5%88%9D%E6%9C%9F%E5%8C%96%E3%82%AC%E3%82%A4%E3%83%89/ta-p/3156931

ユーザとパスワードの回復作業

teratermで作業しています。
■コンソールケーブルで接続した状態でルータを再起動し、 直後に「Alt+B」を押下(ブレーク信号を送る)。rommonモードに入れました。

System Bootstrap, Version 15.5(1r)T1, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2014 by cisco Systems, Inc.

Total memory size = 512 MB
C841M-4X-JSEC/K9 platform with 524288 Kbytes of main memory
Main memory is configured to 32 bit mode

Readonly ROMMON initialized

monitor: command "boot" aborted due to user interrupt
rommon 1 >

■rommonモードに入ったところで手順には「confreg 0x2142」を入れるとのこと。 入力すると再起動か電源を入れなおすと、新しいコンフィグを取得できるよーって出てきました。 「reset」を投入して再起動します。

rommon 2 > confreg 0x2142

You must reset or power cycle for new config to take effect
rommon 3 > reset

■いつもは「no」を入れるのですが、手順書には「Ctrl+C」を押下と書かれていたのでそのように…。

Installed image archive
Cisco C841M-4X-JSEC/K9 (revision 1.0) with 496716K/27571K bytes of memory.
Processor board ID FGL201122WS
6 Gigabit Ethernet interfaces
1 Virtual Private Network (VPN) Module
DRAM configuration is 32 bits wide
255K bytes of non-volatile configuration memory.
1916928K bytes of SD Flash sdflash (Read/Write)


         --- System Configuration Dialog ---

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

■起動した・・・・!

*Sep 24 05:46:08.807: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/3, changed state to down
*Sep 24 05:46:14.087: %SYS-5-RESTART: System restarted --
Cisco IOS Software, C800M Software (C800M-UNIVERSALK9-M), Version 15.5(3)M, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2015 by Cisco Systems, Inc.
Compiled Thu 23-Jul-15 03:45 by prod_rel_team
Router>
Router>

■ひとまず、何かしらきっと設定していたであろうstartup-configをrunnining-configに読み込みます。

Router>
Router>en

Router#copy startup-config ru
Router#copy startup-config running-config
Destination filename [running-config]?
3734 bytes copied in 0.648 secs (5762 bytes/sec)

yourname#
*Sep 24 05:48:40.547: %SYS-5-LOG_CONFIG_CHANGE: Buffer logging: level warnings, xml disabled, filtering disabled, size (51200)
yourname#

■設定していたであろう、ユーザの情報を見てみます。
はい、何も設定せずに電源切ってますね2年前の自分。 パスワードを忘れたわけではなく、ワンタイムパスワードで入ったきり何も設定しなかったのが原因ですね。
もし、パスワードを忘れた場合はここで該当ユーザを無効にする手順が入ります。

yourname#show run | i username
and it provides the default username "cisco" for  one-time use. If you have
already used the username "cisco" to login to the router and your IOS image
supports the "one-time" user option, then this username has already expired.
You will not be able to login to the router with this username after you exit
It is strongly suggested that you create a new username with a privilege level
username <myuser> privilege 15 secret 0 <mypassword>
Replace <myuser> and <mypassword> with the username and password you
This feature requires the one-time use of the username "cisco" with the
username <myuser>  privilege 15 secret 0 <mypassword>
no username cisco
Replace <myuser> and <mypassword> with the username and password you want
yourname#

■configure terminalモードでおニューのアカウントを設定します

yourname(config)#username admin privilege 15 secret 0 [PWを任意で]
yourname(config)#exit
yourname#
*Sep 24 05:56:20.795: %SYS-5-CONFIG_I: Configured from console by console
yourname#

■起動の設定をもとに戻します。

yourname(config)#config-register 0x2102
yourname(config)#

■次回起動時の設定が「0x2102」になっていることを確認して、wrします。

yourname#show ver | i Config
Configuration register is 0x2142 (will be 0x2102 at next reload)
yourname#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
yourname#
yourname#

とりあえずルータには入れるようになりました(゚A゚;) しかし、自分が以前なんの設定を入れてるか微塵も記憶にないので工場出荷時に戻そうと思います。 そちらも一応まとめれたらと思います。