本記事について
本記事では Cisco Catalyst 9000 シリーズスイッチ (C9200/C9300/C9400/C9500/C9600) にて、すべてのデータを削除する「# factory-reset all」コマンドを実行後の ROMmon 状態からの復旧方法について説明します。
動作確認環境
- C9200L-24T-4G
- System Bootstrap, Version 17.14.1r
- IOS-XE 17.12.05
【禁断】factory-reset all コマンドで何が起きるのか
「factory-reset all」は Catalyst 9000 シリーズスイッチ等の IOS-XE 搭載機器にて使用できる初期化コマンド「factory-reset」に「all」オプションを付けたコマンドです。
特権EXECモードにて「factory-reset all」コマンドを実行すると以下の処理が実行されます。
- 以下の内容がすべて削除され、システムが再起動する
- クラッシュ情報とログ
- ユーザデータ、startup-config 、および running-config
- 現在のブートイメージを含むすべての IOS イメージ
- オンボード障害ロギング(OBFL)ログ
- ユーザが追加した ROMmon 変数
- フィールド交換可能ユニット(USB/SSD/SATA)のデータ
上記の通り IOS イメージファイルがすべて削除されるため、「factory-reset all」コマンド実行後は IOS の起動ができなくなり ROMmon モードで起動します。
Switch#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]
Protection key not found
Chassis 1 reloading, reason - Factory Reset
(中略)
Factory reset successful. Rebooting...
Initializing Hardware...
NOTICE: Please reset the device for the new MAC_ADDR value to take effect.
System Bootstrap, Version 17.14.1r [FC1], RELEASE SOFTWARE (P)
Compiled Fri 12/15/2023 14:15:51 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:
上の実行例の通りコマンド実行後は再起動し、最終的に「switch:」のプロンプトが表示されます(つまり ROMmon モード)。
ROMmon モードからの復旧方法
復旧手順は以下の通りです。
- 機器外部の IOS イメージから起動する
- IOS 起動後、フラッシュ内にイメージファイルを格納しインストールする
「factory-reset all」コマンド実行後は機器内に IOS イメージが無い状態になっているため、機器の外部にある IOS イメージを読み込んで起動する必要があります。方法としては以下の2つがあります。
- TFTP サーバから IOS イメージを起動する
- USB メモリから IOS イメージを起動する
TFTP サーバを使用する場合で、TFTP サーバソフトとして Windows の「3CDaemon」「Serva」を使用した場合はエラーとなりイメージを起動できないことを確認しています。一方 CentOS Stream 9 の「tftp-server」を使用した場合はイメージの起動ができることを確認しています。
Catalyst 9000 シリーズスイッチがサポートしている USB メモリのファイルシステムは FAT32 です。
機器外部のイメージから起動する場合のイメージ起動モードはバンドルモードとなります。
TFTP サーバから IOS イメージを起動する場合の復旧手順
IOS イメージを Cisco のダウンロードサイトからダウンロードする方法については以下の記事を参照してください。なお C9200/9300 シリーズのイメージであれば権限不要で Cisco アカウントでログインさえすればダウンロード可能です。

ROMmon からネットワーク接続する際は MGMT ポートが使用されます。よって MGMT ポートに TFTP サーバを接続します。
※何らかのネットワークを介する場合は MGMT ポートをネットワークに接続します
C9200/C9300 シリーズの場合 MGMT ポートは機器背面のコンソールポートの下に搭載されています。
対象機器の ROMmon モードにてネットワーク通信用の IP アドレスを設定します。
- IP アドレスの設定
- set IP_ADDRESS <IPアドレス>
- サブネットマスクの設定
- set IP_SUBNET_MASK <サブネットマスク>
- デフォルトゲートウェイの設定 (必要な場合)
- set DEFAULT_GATEWAY <ゲートウェイアドレス>
switch: set IP_ADDRESS 192.168.45.1
switch: set IP_SUBNET_MASK 255.255.255.0
switch: set DEFAULT_GATEWAY 192.168.45.254
設定後、ping で TFTP サーバと疎通ができることを確認します。
switch: ping 192.168.45.12
Pinging 192.168.45.12
!!!!
192.168.45.12 is alive!
以下コマンドを実行して TFTP サーバ内の IOS イメージを使用して起動します。
- boot tftp://<TFTPサーバアドレス>/<IOSパス>
switch: boot tftp://192.168.45.12/cat9k_lite_iosxe.17.12.05.SPA.bin
boot: attempting to boot from [tftp://192.168.45.12/cat9k_lite_iosxe.17.12.05.SPA.bin]
Filename : /cat9k_lite_iosxe.17.12.05.SPA.bin
IpAddress : 192.168.45.1
TftpServer : 192.168.45.12
TftpBlkSize : 1468
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
コンフィギュレーションダイアログに入るか確認があるため「no」と入力してキャンセルします。
--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: no
enable パスワードの設定を求められるため、一旦「Admin12345」を2回入力します。(この後この内容は破棄するためパスワード要件を満たす任意の文字列でOK)
The enable secret is a password used to protect
access to privileged EXEC and configuration modes.
This password, after entered, becomes encrypted in
the configuration.
-------------------------------------------------
secret should be of minimum 10 characters and maximum 32 characters with
at least 1 upper case, 1 lower case, 1 digit and
should not contain [cisco]
-------------------------------------------------
Enter enable secret: **********
Confirm enable secret: **********
The following configuration command script was created:
enable secret 9 $9$HxdB4UxRSWM4/k$0DIFx9wbUE0gf7ICBM.MsbTLX9AevDmVTD/x0U5KmmM
!
end
enableパスワード設定を保存するか聞かれるため「0」を入力して保存せずに CLI に移行します。
[0] Go to the IOS command prompt without saving this config.
[1] Return back to the setup without saving this config.
[2] Save this configuration to nvram and exit.
Enter your selection [2]: 0
% You can enter the setup, by typing setup at IOS command prompt
Press RETURN to get started!
TFTP サーバからイメージファイルをコピーします。そのためにまず MGMT ポートに IP アドレスを設定します。
本記事の環境の C9200L-24T-4G の場合は GigabitEthernet0/0 が MGMT ポートのため GigabitEthernet0/0 に IP アドレスを設定し、no shutdown を投入します。設定後、TFTP サーバ宛に Ping が通ることを確認します。なお MGMT インターフェースは VRF「Mgmt-vrf」に所属しているため ping コマンドでは vrf オプションを指定する必要があります。
Switch#conf t
Switch(config)#interface GigabitEthernet0/0
Switch(config-if)#ip address 192.168.45.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#end
Switch#
Switch#ping vrf Mgmt-vrf 192.168.45.12
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.45.12, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Switch#
その後 TFTP サーバからフラッシュ内に IOS イメージをコピーします。
- # copy tftp://<TFTPサーバアドレス>/<IOSパス> flash: vrf Mgmt-vrf
Switch#copy tftp://192.168.45.12/cat9k_lite_iosxe.17.12.05.SPA.bin flash: vrf Mgmt-vrf
Destination filename [cat9k_lite_iosxe.17.12.05.SPA.bin]?
Accessing tftp://192.168.45.12/cat9k_lite_iosxe.17.12.05.SPA.bin...
Loading cat9k_lite_iosxe.17.12.05.SPA.bin from 192.168.45.12 (via GigabitEthernet0/0): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 470819491 bytes]
470819491 bytes copied in 65.372 secs (7202158 bytes/sec)
コピー完了後「# dir | inc bin」コマンドを実行してフラッシュ内にコピーされたことを確認します。
Switch#dir | inc bin
97282 -rw- 470819491 Jul 12 2025 08:10:29 +00:00 cat9k_lite_iosxe.17.12.05.SPA.bin
次回以降の再起動時はローカルの IOS イメージから起動できるよう IOS をインストールします。
インストールコマンド実行時に未保存の設定があるとエラーになるため「# write memry」を実行して設定を保存します。
Switch#write memory
Building configuration...
[OK]
その後以下コマンドを実行して IOS をインストールします。
- # install add file flash:<OSファイル名> activate commit
Switch#install add file flash:cat9k_lite_iosxe.17.12.05.SPA.bin activate commit
install_add_activate_commit: START Sat Jul 12 08:19:49 UTC 2025
その後しばらく待つと、以下のメッセージ (「再起動が必要となるが続行するか?」) が表示されるため「y」を押下して続行します。
This operation may require a reload of the system. Do you want to proceed? [y/n]
インストール処理中は機器の再起動が発生します。再起動が完了し CLI 操作が可能になればインストールは完了です。
「# show version」コマンドを実行しインストールしたバージョンで起動していることを確認します。
Switch#show version
Cisco IOS XE Software, Version 17.12.05
Cisco IOS Software [Dublin], Catalyst L3 Switch Software (CAT9K_LITE_IOSXE), Version 17.12.5, RELEASE SOFTWARE (fc5)
--- 中略 ---
Switch Ports Model SW Version SW Image Mode
------ ----- ----- ---------- ---------- ----
* 1 28 C9200L-24T-4G 17.12.05 CAT9K_LITE_IOSXE INSTALL
Configuration register is 0x102
「# show install summary」コマンドを実行し、State (St) が C であることを確認します。
Switch#show install summary
[ Switch 1 ] Installed Package(s) Information:
State (St): I - Inactive, U - Activated & Uncommitted,
C - Activated & Committed, D - Deactivated & Uncommitted
--------------------------------------------------------------------------------
Type St Filename/Version
--------------------------------------------------------------------------------
IMG C 17.12.05.0.6246
--------------------------------------------------------------------------------
Auto abort timer: inactive
--------------------------------------------------------------------------------
「# dir」コマンドを実行し、IOS パッケージファイルが保存されていることを確認します。
Switch#dir
Directory of flash:/
--- 中略 ---
8120 -rw- 4905 Jun 29 2025 13:57:51 +00:00 cat9k_lite_iosxe.17.12.05.SPA.conf
8126 -rw- 44408459 Jun 29 2025 13:57:47 +00:00 cat9k_lite-rpboot.17.12.05.SPA.pkg
8125 -rw- 11780096 Jun 29 2025 13:56:12 +00:00 cat9k_lite-webui.17.12.05.SPA.pkg
8124 -rw- 6463488 Jun 29 2025 13:56:12 +00:00 cat9k_lite-srdriver.17.12.05.SPA.pkg
8123 -rw- 408608768 Jun 29 2025 13:56:12 +00:00 cat9k_lite-rpbase.17.12.05.SPA.pkg
8117 drwx 4096 Jun 29 2025 13:54:00 +00:00 .images
8116 -rw- 470819491 Jun 29 2025 13:37:31 +00:00 cat9k_lite_iosxe.17.12.05.SPA.bin
--- 中略 ---
1956839424 bytes total (433037312 bytes free)
「# show boot」を実行してブート変数を確認します。「BOOT variable = flash:packages.conf;」「Manual Boot = no」となっていることを確認します。
Switch#show boot
---------------------------
Switch 1
---------------------------
Current Boot Variables:
BOOT variable = flash:packages.conf;
Boot Variables on next reload:
BOOT variable = flash:packages.conf;
Manual Boot = no
Enable Break = no
Boot Mode = DEVICE
iPXE Timeout = 0
インストールに使用した IOS の「.bin」ファイルは不要になるため「# install remove inactive」コマンドで削除します。
Switch#install remove inactive
*Jul 12 08:38:28.751: %INSTALL-5-INSTALL_START_INFO: Switch 1 R0/0: install_mgr: Started install removeinstall_remove: START Sat Jul 12 08:38:28 UTC 2025
install_remove: Removing IMG
Cleaning up unnecessary package files
No path specified, will use booted path /flash/packages.conf
Cleaning /flash
Scanning boot directory for packages ... done.
Preparing packages list to delete ...
[R0]: /flash/packages.conf File is in use, will not delete.
[R0]: /flash/cat9k_lite-rpbase.17.12.05.SPA.pkg File is in use, will not delete.
[R0]: /flash/cat9k_lite-rpboot.17.12.05.SPA.pkg File is in use, will not delete.
[R0]: /flash/cat9k_lite-srdriver.17.12.05.SPA.pkg File is in use, will not delete.
[R0]: /flash/cat9k_lite-webui.17.12.05.SPA.pkg File is in use, will not delete.
The following files will be deleted:
[R0]: /flash/cat9k_lite_iosxe.17.12.05.SPA.bin
「Do you want to remove the above files? [y/n]」と表示されたら「y」を押下します。
Do you want to remove the above files? [y/n]y
Deleting file /flash/cat9k_lite_iosxe.17.12.05.SPA.bin ... done.
SUCCESS: Files deleted.
--- Starting Post_Remove_Cleanup ---
Performing REMOVE_POSTCHECK on all members
Finished Post_Remove_Cleanup
SUCCESS: install_remove Sat Jul 12 08:38:35 UTC 2025
USB メモリから IOS イメージを起動する場合の復旧手順
IOS イメージを Cisco のダウンロードサイトからダウンロードする方法については以下の記事を参照してください。なお C9200/9300 シリーズのイメージであれば権限不要で Cisco アカウントでログインさえすればダウンロード可能です。

IOS イメージを格納した USB メモリを対象機器に接続します。USB ポートが複数ある場合はどちらに接続しても問題ありません。
C9200/C9300 シリーズの場合、前面左上のあたりに USB ポートが搭載されています。
ROMmon プロンプトで「dir」コマンドを実行すると USB メモリの内容を確認できます。どの USB ポートに接続したかによって以下のどちらかのコマンドで確認できます。
- dir usbflash0:
- dir usbflash1:
switch: dir usbflash0:
Attributes Size Name
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
D-HS- 0 System Volume Information
----A 470819491 cat9k_lite_iosxe.17.12.05.SPA.bin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
どの USB ポートに接続したかによって以下のどちらかのコマンドを実行して USB メモリ内の IOS イメージを使用して起動します。
- boot usbflash0:<IOSパス>
- boot usbflash1:<IOSパス>
switch: boot usbflash0:cat9k_lite_iosxe.17.12.05.SPA.bin
boot: attempting to boot from [usbflash0:cat9k_lite_iosxe.17.12.05.SPA.bin]
boot: reading file cat9k_lite_iosxe.17.12.05.SPA.bin
######################
コンフィギュレーションダイアログに入るか確認があるため「no」と入力してキャンセルします。
--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: no
enable パスワードの設定を求められるため、一旦「Admin12345」を2回入力します。(この後この内容は破棄するためパスワード要件を満たす任意の文字列でOK)
The enable secret is a password used to protect
access to privileged EXEC and configuration modes.
This password, after entered, becomes encrypted in
the configuration.
-------------------------------------------------
secret should be of minimum 10 characters and maximum 32 characters with
at least 1 upper case, 1 lower case, 1 digit and
should not contain [cisco]
-------------------------------------------------
Enter enable secret: **********
Confirm enable secret: **********
The following configuration command script was created:
enable secret 9 $9$HxdB4UxRSWM4/k$0DIFx9wbUE0gf7ICBM.MsbTLX9AevDmVTD/x0U5KmmM
!
end
enableパスワード設定を保存するか聞かれるため「0」を入力して保存せずに CLI に移行します。
[0] Go to the IOS command prompt without saving this config.
[1] Return back to the setup without saving this config.
[2] Save this configuration to nvram and exit.
Enter your selection [2]: 0
% You can enter the setup, by typing setup at IOS command prompt
Press RETURN to get started!
どの USB ポートに接続したかによって以下コマンドの何れかを実行して USB メモリからフラッシュ内にイメージファイルをコピーします。
- # copy usbflash0:<IOSパス> flash:
- # copy usbflash1:<IOSパス> flash:
Switch#copy usbflash0:cat9k_lite_iosxe.17.12.05.SPA.bin flash:
Destination filename [cat9k_lite_iosxe.17.12.05.SPA.bin]?
Copy in progress...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
470819491 bytes copied in 46.560 secs (10112102 bytes/sec)
コピー完了後「# dir | inc bin」コマンドを実行してフラッシュ内にコピーされたことを確認します。
Switch#dir | inc bin
97282 -rw- 470819491 Jul 12 2025 08:10:29 +00:00 cat9k_lite_iosxe.17.12.05.SPA.bin
次回以降の再起動時はローカルの IOS イメージから起動できるよう IOS をインストールします。
インストールコマンド実行時に未保存の設定があるとエラーになるため「# write memry」を実行して設定を保存します。
Switch#write memory
Building configuration...
[OK]
その後以下コマンドを実行して IOS をインストールします。
- # install add file flash:<OSファイル名> activate commit
Switch#install add file flash:cat9k_lite_iosxe.17.12.05.SPA.bin activate commit
install_add_activate_commit: START Sat Jul 12 08:19:49 UTC 2025
その後しばらく待つと、以下のメッセージ (「再起動が必要となるが続行するか?」) が表示されるため「y」を押下して続行します。
This operation may require a reload of the system. Do you want to proceed? [y/n]
インストール処理中は機器の再起動が発生します。再起動が完了し CLI 操作が可能になればインストールは完了です。
「# show version」コマンドを実行しインストールしたバージョンで起動していることを確認します。
Switch#show version
Cisco IOS XE Software, Version 17.12.05
Cisco IOS Software [Dublin], Catalyst L3 Switch Software (CAT9K_LITE_IOSXE), Version 17.12.5, RELEASE SOFTWARE (fc5)
--- 中略 ---
Switch Ports Model SW Version SW Image Mode
------ ----- ----- ---------- ---------- ----
* 1 28 C9200L-24T-4G 17.12.05 CAT9K_LITE_IOSXE INSTALL
Configuration register is 0x102
「# show install summary」コマンドを実行し、State (St) が C であることを確認します。
Switch#show install summary
[ Switch 1 ] Installed Package(s) Information:
State (St): I - Inactive, U - Activated & Uncommitted,
C - Activated & Committed, D - Deactivated & Uncommitted
--------------------------------------------------------------------------------
Type St Filename/Version
--------------------------------------------------------------------------------
IMG C 17.12.05.0.6246
--------------------------------------------------------------------------------
Auto abort timer: inactive
--------------------------------------------------------------------------------
「# dir」コマンドを実行し、IOS パッケージファイルが保存されていることを確認します。
Switch#dir
Directory of flash:/
--- 中略 ---
8120 -rw- 4905 Jun 29 2025 13:57:51 +00:00 cat9k_lite_iosxe.17.12.05.SPA.conf
8126 -rw- 44408459 Jun 29 2025 13:57:47 +00:00 cat9k_lite-rpboot.17.12.05.SPA.pkg
8125 -rw- 11780096 Jun 29 2025 13:56:12 +00:00 cat9k_lite-webui.17.12.05.SPA.pkg
8124 -rw- 6463488 Jun 29 2025 13:56:12 +00:00 cat9k_lite-srdriver.17.12.05.SPA.pkg
8123 -rw- 408608768 Jun 29 2025 13:56:12 +00:00 cat9k_lite-rpbase.17.12.05.SPA.pkg
8117 drwx 4096 Jun 29 2025 13:54:00 +00:00 .images
8116 -rw- 470819491 Jun 29 2025 13:37:31 +00:00 cat9k_lite_iosxe.17.12.05.SPA.bin
--- 中略 ---
1956839424 bytes total (433037312 bytes free)
「# show boot」を実行してブート変数を確認します。「BOOT variable = flash:packages.conf;」「Manual Boot = no」となっていることを確認します。
Switch#show boot
---------------------------
Switch 1
---------------------------
Current Boot Variables:
BOOT variable = flash:packages.conf;
Boot Variables on next reload:
BOOT variable = flash:packages.conf;
Manual Boot = no
Enable Break = no
Boot Mode = DEVICE
iPXE Timeout = 0
インストールに使用した IOS の「.bin」ファイルは不要になるため「# install remove inactive」コマンドで削除します。
Switch#install remove inactive
*Jul 12 08:38:28.751: %INSTALL-5-INSTALL_START_INFO: Switch 1 R0/0: install_mgr: Started install removeinstall_remove: START Sat Jul 12 08:38:28 UTC 2025
install_remove: Removing IMG
Cleaning up unnecessary package files
No path specified, will use booted path /flash/packages.conf
Cleaning /flash
Scanning boot directory for packages ... done.
Preparing packages list to delete ...
[R0]: /flash/packages.conf File is in use, will not delete.
[R0]: /flash/cat9k_lite-rpbase.17.12.05.SPA.pkg File is in use, will not delete.
[R0]: /flash/cat9k_lite-rpboot.17.12.05.SPA.pkg File is in use, will not delete.
[R0]: /flash/cat9k_lite-srdriver.17.12.05.SPA.pkg File is in use, will not delete.
[R0]: /flash/cat9k_lite-webui.17.12.05.SPA.pkg File is in use, will not delete.
The following files will be deleted:
[R0]: /flash/cat9k_lite_iosxe.17.12.05.SPA.bin
「Do you want to remove the above files? [y/n]」と表示されたら「y」を押下します。
Do you want to remove the above files? [y/n]y
Deleting file /flash/cat9k_lite_iosxe.17.12.05.SPA.bin ... done.
SUCCESS: Files deleted.
--- Starting Post_Remove_Cleanup ---
Performing REMOVE_POSTCHECK on all members
Finished Post_Remove_Cleanup
SUCCESS: install_remove Sat Jul 12 08:38:35 UTC 2025
参考資料
- https://www.cisco.com/c/ja_jp/td/docs/switches/lan/catalyst9200/software/release/17-2/configuration_guide/sys_mgmt/b_172_sys_mgmt_9200_cg/simplified_factory_reset.html
- https://www.cisco.com/c/ja_jp/td/docs/switches/lan/catalyst9200/software/release/17-6/command_reference/b_176_9200_cr/system_management_commands.html#wp9284882360
- https://www.cisco.com/c/ja_jp/support/docs/switches/catalyst-9300-series-switches/216944-troubleshoot-bootloader-rommon-and-pas.html
- https://www.cisco.com/c/ja_jp/support/docs/switches/catalyst-9300-series-switches/216231-upgrade-guide-for-cisco-catalyst-9000-sw.html
Cisco Catalyst 9000 シリーズスイッチ関連記事一覧
Amazon で買えるおすすめアイテム
以下は Amazon アフィリエイトリンクです。ネットワーク作業向けにそこそこおすすめなアイテムです。
コメント