Cisco9200(IOS-XE)の初期化、ROMmonモードからの復旧手順

CiscoのCatalyst 9200Lを初期化(リセット)しようとしたところ、従来機の2960Xと方法が変わっていました。

これはおそらくOSがIOSからIOS-XEに変更された影響だと考えています。そのためIOS-XEであれば、他の機器でも同様の手順で初期化できるのではと考えています(未確認))

スタートアップコンフィグを削除する場合

従来のような初期化(設定の初期化)であればこの方法になると思います。
IOSでの「write erase」「erase startup-config」に相当する、スタートアップコンフィグを削除するコマンドは「factory-reset config」になります。

「factory-reset config」を実行し、スタートアップコンフィグを削除します。

SW01#factory-reset config
The factory reset operation is irreversible for erasing configuration. Are you sure? [confirm]
 Cleaning the config files
 Configs successfuly removed
SW01#

VLANをVTPのクライアントモードまたはサーバモードで作成している場合、VLAN情報はフラッシュメモリ内の「vlan.dat」に保存されているため、これを削除します。
※トランスペアレントモードで動作している場合は、VLANはスタートアップコンフィグに保存されているため不要です

SW01#show flash: | inc vlan
 62      10132 Nov 07 2022 16:46:37.0000000000 +00:00 vlan.dat

SW01#delete flash:vlan.dat
Delete filename [vlan.dat]?
Delete flash:/vlan.dat? [confirm] 

SWを再起動します

SW01#reload

Reload command is being issued on Active unit, this will reload the whole stack
Proceed with reload? [confirm]

再起動が完了すると、コンフィグが削除された状態(初期コンフィグ)で起動します

         --- System Configuration Dialog ---

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

Would you like to terminate autoinstall? [yes]: no



Press RETURN to get started!



Switch>

完全初期化を行う場合

完全初期化を行う場合は「factory-reset all」を実行します。
このコマンドを実行すると以下が削除され、再起動後、ROMmonモード(IOSの読み込みを行わないで起動するモード)で起動します。

  • NVRAMのすべての内容
  • 現在のブートイメージ
  • ブート変数
  • 起動コンフィギュレーションのデータ
  • 実行コンフィギュレーションのデータ
  • ユーザデータを含む全てのCisco IOSイメージ
注意点

Ciscoのマニュアルには「このオプションを使用することを推奨します。」とあるのですが、このコマンドを実行すると フラッシュメモリ上のIOSイメージを全て削除するため、完全初期化後にROMmonモードからの復旧(IOSのダウンロード、IOSインストール)が必要になり、復旧に時間と手間がかかるので注意が必要です。またIOSイメージファイルを本コマンドを実行する前に、用意しておく必要があります。

「factory-reset all」を実行し、完全初期化を行います(実行後、自動的に再起動が発生します)

SW01#factory-reset all
The factory reset operation is irreversible for all operations. Are you sure? [confirm]
 The following will be deleted as a part of factory reset:
 1: Crash info and logs
 2: User data, startup and running configuration
 3: All IOS images, including the current boot image
 4: OBFL logs
 5: User added rommon variables
 6: Data on Field Replaceable Units(USB/SSD/SATA)
 The system will reload to perform factory reset.
 It will take some time to complete and bring it to rommon.
 You will need to load IOS image using USB/TFTP from rommon after
 this operation is completed.
 DO NOT UNPLUG THE POWER OR INTERRUPT THE OPERATION
 Are you sure you want to continue? [confirm]
Successfully removed non factory default boot variables in rommon
 Protection key not found
SW01#
Chassis 1 reloading, reason - System requested reload
reload fp action requested

再起動後、ROMmonモードで起動します

watchdog watchdog0: watchdog did not stop!
reboot: Restarting system

Initializing Hardware...

System Bootstrap, Version 17.3.1r [FC3], RELEASE SOFTWARE (P)
Compiled Mon 05/18/2020 11:59:59 by rel

Current ROMMON image : Primary
C9200L-24T-4G platform with 2097152 Kbytes of main memory

NOTICE: Please reset the device for the new MAC_ADDR value to take effect.
WARNING: Bootable URL's in BOOT variable not found or exhausted.
         Please check the ROMMON configuration or boot command usage.
switch:

フラッシュメモリの内容を確認します(全て削除されているため空になっています)

dir flash:
Attributes        Size         Name
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ROMmonモードからの復旧

「factory-reset all」を実行するとフラッシュメモリ内のIOSイメージも削除されてしまうため、ROMmonモードでしか起動することができなくなります。そのため、フラッシュメモリにIOSイメージをダウンロードし、フラッシュメモリ内のIOSイメージを使用して起動するようにしてあげる必要があります。

ROMmonモードでIOSイメージをダウンロードする方法は複数ありますが、今回は以下のように作業しています。

  1. TFTPサーバに配置したIOSイメージから起動する
  2. 起動後、TFTPサーバからIOSイメージをフラッシュメモリにダウンロードする
  3. フラッシュメモリ内のIOSイメージからIOSをインストール、フラッシュメモリ内のIOSで起動する
  4. 起動後、恒久的にフラッシュメモリ内のIOSで起動するように設定する

ROMmonモードの状態でTFTPサーバからIOSイメージをダウンロードする手順としては「tftpdnld」がよく紹介されているのですが、9200Lではこのコマンドは使えませんでした。以下によるとどうやらIOS-XEではこのコマンドは使えないようです。そのため、上記のようなちょっと面倒な手順となっています。

TFTPサーバに配置したIOSイメージから起動する

TFTPを行うために必要な環境変数を設定します

set IP_ADDRESS=172.30.10.2
set IP_SUBNET_MASK=255.255.255.0
set DEFAULT_GATEWAY=172.30.10.1
set TFTP_SERVER=172.30.10.1
set TFTP_FILE=cat9k_lite_iosxe.17.03.05.SPA.bin

TFTPサーバをGi0/0(マネジメントポート)に接続します
(最初、Gi1/0/1とか普通のポートに接続して通信できなくて🤔?という感じでした(笑))

TFTPサーバと通信できることを確認します

switch: ping 172.30.10.1

Pinging 172.30.10.1

!!!!

172.30.10.1 is alive!

TFTPサーバのIOSイメージから起動します

switch: boot tftp://172.30.10.1/cat9k_lite_iosxe.17.03.05.SPA.bin

boot: attempting to boot from [tftp://172.30.10.1/cat9k_lite_iosxe.17.03.05.SPA.bin]

Filename     : /cat9k_lite_iosxe.17.03.05.SPA.bin

IpAddress    : 172.30.10.2

TftpServer   : 172.30.10.1

TftpBlkSize  : 1468 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*

File Size    : 483131849

IOSが起動します

         --- System Configuration Dialog ---

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

Would you like to terminate autoinstall? [yes]: no

Press RETURN to get started!

Switch>

TFTPサーバからIOSイメージをフラッシュメモリにダウンロードする

IOSが起動したので、「copy tftp」コマンドが使えるようになりました。
ここから、「copy tftp」でTFTPサーバからIOSイメージをダウンロードするためにネットワークまわりを設定していきます。

Gi1/0/1をルーテッドポートに設定し、IPアドレスを設定します。

Switch#conf t
Switch(config)#interface gigabitEthernet 1/0/1
Switch(config-if)#no switchport
Switch(config-if)#ip address 172.30.10.2 255.255.255.0
Switch(config-if)#end

Gi1/0/1にTFTPサーバを接続します。

TFTPサーバからIOSイメージをフラッシュメモリにダウンロードします。

Switch#copy tftp://172.30.10.1/cat9k_lite_iosxe.17.03.05.SPA.bin flash:
Address or name of remote host [172.30.10.1]? 
Source filename [cat9k_lite_iosxe.17.03.05.SPA.bin]? 
Destination filename [cat9k_lite_iosxe.17.03.05.SPA.bin]? 
Accessing tftp://172.30.10.1/cat9k_lite_iosxe.17.03.05.SPA.bin...
Loading cat9k_lite_iosxe.17.03.05.SPA.bin from 172.30.10.1 (via GigabitEthernet1/0/1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!O!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[OK - 483131849 bytes]

フラッシュメモリにIOSイメージがダウンロードされたことを確認します。

Switch#dir flash:
Directory of flash:/

105250  drwx             4096   Nov 7 2022 09:51:57 +00:00  .installer
105322  -rw-        483131849   Nov 7 2022 09:51:36 +00:00  cat9k_lite_iosxe.17.03.05.SPA.bin ★
105319  drwx             4096   Nov 7 2022 09:37:55 +00:00  pnp-tech
105318  -rw-          2097152   Nov 7 2022 09:34:48 +00:00  nvram_config_bkup
105316  -rw-          2097152   Nov 7 2022 09:34:48 +00:00  nvram_config
105314  drwx             4096   Nov 7 2022 09:34:43 +00:00  license_evlog
105255  drwx             4096   Nov 7 2022 09:34:43 +00:00  core
105312  drwx             4096   Nov 7 2022 09:34:22 +00:00  onep
105311  drwx             4096   Nov 7 2022 09:34:22 +00:00  pnp-info
105310  -rw-                0   Nov 7 2022 09:34:21 +00:00  dope_hist
105308  -rw-            15088   Nov 7 2022 09:34:21 +00:00  rdope_out.txt
105309  -rw-               89   Nov 7 2022 09:34:18 +00:00  rdope.log
105306  drwx             4096   Nov 7 2022 09:33:50 +00:00  .dbpersist
105292  -rw-           134458   Nov 7 2022 09:33:11 +00:00  memleak.tcl
105303  -rw-             2130   Nov 7 2022 09:32:55 +00:00  boothelper.log
105285  drwx             4096   Nov 7 2022 09:32:53 +00:00  dc_profile_dir
105254  -rw-               74   Nov 7 2022 09:32:35 +00:00  bootloader_evt_handle.log
105287  -rw-             3300   Nov 7 2022 09:09:47 +00:00  boothelper.log.old
105293  drwx             4096   Nov 7 2022 09:09:45 +00:00  Tbot

フラッシュメモリ内のIOSイメージからIOSをインストール、フラッシュメモリ内のIOSで起動する

IOSをインストールします。

Switch#install add file flash:cat9k_lite_iosxe.17.03.05.SPA.bin activate commit

install_add_activate_commit: START Mon Nov  7 09:53:40 UTC 2022
System configuration has been modified.
Press Yes(y) to save the configuration and proceed.
Press No(n) for proceeding without saving the configuration.

コンフィグを保存するか聞かれるので、「n」を入力する

Press Quit(q) to exit, you may save configuration and re-enter the command. [y/n/q]n

「packages.conf」からブートするか聞かれるので、「y」を入力する

Please confirm you have changed boot config to flash:packages.conf [y/n]y

再起動してもよいか聞かれるので、「y」を入力する

This operation may require a reload of the system. Do you want to proceed? [y/n]y

再起動後、ROMmonモードで起動します

watchdog: watchdog0: watchdog did not stop!
reboot: Restarting system

Initializing Hardware...

System Bootstrap, Version 17.5.1r [FC4], RELEASE SOFTWARE (P) 
Compiled Wed 01/06/2021 17:07:29 by rel
Current ROMMON image : Primary

C9200L-24T-4G platform with 2097152 Kbytes of main memory
WARNING: Bootable URL's in BOOT variable not found or exhausted.

         Please check the ROMMON configuration or boot command usage.

switch: 

フラッシュメモリに「packages.conf」が作成されていることを確認します

switch: dir flash:
Attributes        Size         Name
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
drwxr-xr-x        4096   .installer
drwxr-xr-x        4096   .rollback_timer
-rw-r--r--          74   bootloader_evt_handle.log
drwxr-xr-x        4096   core
drwxrwxrwx        4096   .prst_sync
-rw-r--r--     5242880   ssd
drwxr-xr-x        4096   ss_disc
drwxr-xr-x        4096   tech_support
drwxr-xr-x        4096   dc_profile_dir
-rw-r--r--        2130   boothelper.log
drwxr-xr-x        4096   sys_report
drwxr-xr-x        4096   .USWAP
drwxr-xr-x        4096   .CRFT
-rw-r--r--      134458   memleak.tcl
drwxr-xr-x        4096   Tbot
lrwxrwxrwx          13   NVRAM -> /flash1/NVRAM
-rw-r--r--        3300   boothelper.log.old
drwxr-xr-x        4096   .dbpersist
-rw-r--r--       15088   rdope_out.txt
-rw-r--r--          89   rdope.log
-rw-------           0   dope_hist
drwxr-xr-x        4096   pnp-info
drwxr-xr-x        4096   onep
drwxr-xr-x        4096   license_evlog
-rw-r--r--     2097152   nvram_config
-rw-r--r--     2097152   nvram_config_bkup
drwxr-xr-x        4096   pnp-tech
-rw-rw-rw-   483131849   cat9k_lite_iosxe.17.03.05.SPA.bin
-rw-rw-rw-        4920   packages.conf ★
-rw-rw-rw-   427349016   cat9k_lite-rpbase.17.03.05.SPA.pkg
-rw-rw-rw-    40713581   cat9k_lite-rpboot.17.03.05.SPA.pkg
-rw-rw-rw-     4367384   cat9k_lite-srdriver.17.03.05.SPA.pkg
-rw-rw-rw-    11043860   cat9k_lite-webui.17.03.05.SPA.pkg

起動時に「packages.conf」を読み込んでインストールモードで起動します(自動的に再起動します)
(Ciscoの9000シリーズの起動モードはバンドルモードとインストールモードの2種類があり、推奨はインストールモードのようです。詳しくは以下に記載されています)

switch: boot flash:packages.conf
boot: attempting to boot from [flash:packages.conf]
boot: reading file packages.conf

#############

IOSが起動します。

         --- System Configuration Dialog ---

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

Would you like to terminate autoinstall? [yes]: no


Press RETURN to get started!

恒久的にフラッシュメモリ内のIOSで起動するように設定する

このままだと再起動時にROMmonモードで起動してくるので、恒久的に「packages.conf」を読み込んでインストールモードで起動するように設定を行い、再起動します。

Switch>enable
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#no boot system
Switch(config)#boot system switch all flash:packages.conf
Switch(config)#end

Switch#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
Switch#reload

再起動後、IOSが起動します。 「show version」でインストールモードで起動していることが確認できます。

Switch>enable
Switch#show version
Cisco IOS XE Software, Version 17.03.05
~省略~

Switch Ports Model              SW Version        SW Image              Mode
------ ----- -----              ----------        ----------            ----
*    1 28    C9200L-24T-4G      17.03.05          CAT9K_LITE_IOSXE      INSTALL★

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA