routeros-netinstall
RouterOSデバイスの自動初期化ツール、netinstall-cliを使い、スクリプト作成、ツール開発、プロトコル理解、パッケージ操作、初期設定自動化など、RouterOSデバイスのファームウェアを自動で書き換える作業を効率化するSkill。
📜 元の英語説明(参考)
MikroTik netinstall-cli for automated RouterOS device flashing. Use when: automating netinstall, writing scripts that invoke netinstall-cli, building netinstall tooling, understanding etherboot/BOOTP/TFTP protocols, working with RouterOS package files (.npk), using modescript or configure script, or when the user mentions netinstall, etherboot, or device flashing.
🇯🇵 日本人クリエイター向け解説
RouterOSデバイスの自動初期化ツール、netinstall-cliを使い、スクリプト作成、ツール開発、プロトコル理解、パッケージ操作、初期設定自動化など、RouterOSデバイスのファームウェアを自動で書き換える作業を効率化するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o routeros-netinstall.zip https://jpskill.com/download/20956.zip && unzip -o routeros-netinstall.zip && rm routeros-netinstall.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/20956.zip -OutFile "$d\routeros-netinstall.zip"; Expand-Archive "$d\routeros-netinstall.zip" -DestinationPath $d -Force; ri "$d\routeros-netinstall.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
routeros-netinstall.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
routeros-netinstallフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[スキル名] routeros-netinstall
RouterOS Netinstall
このスキルは公式の Netinstall / netinstall-cli の動作に焦点を当てています。tikoci/netinstall は便利なラッパーであり、具体的な例のソースでもありますが、それはツールを操作する一つの方法に過ぎません。
netinstall-cli の機能
Netinstall は、etherboot モードで起動したデバイスに RouterOS を再インストールします。Linux ツールである netinstall-cli は、BOOTP リクエストをリッスンし、RouterOS のブートイメージと選択された .npk パッケージを送信します。
MikroTik のドキュメントに基づく具体的な動作は以下の通りです。
- Netinstall はシステムドライブを再フォーマットします。
- RouterOS のライセンスキーは消去しません。
- RouterBOOT の設定はリセットしません。
- BOOTP/DHCP ポートと TFTP を使用して、直接的なレイヤー2パスで動作します。
- root / sudo 権限が必要です。
netinstall-cli は Linux のコマンドライン版です。Windows GUI もほぼ同じ主要オプションを提供しています。
コマンド構文
netinstall-cli [-r] [-e] [-b] [-m [-o]] [-f] [-v] [-c]
[-k <keyfile>] [-s <userscript>] [-sm <modescript>]
[--mac <mac>] {-i <interface> | -a <client-ip>} [PACKAGES...]
フラグ
| フラグ | 意味 |
|---|---|
-r |
再インストールし、デフォルト設定ステージを適用します。 |
-e |
空の設定で再インストールします。 |
-b |
現在インストールされているブランディングパッケージを破棄します。 |
-m |
1回の実行で繰り返しインストールを有効にします。 |
-o |
-m と共に使用すると、指定された MAC アドレスへの再インストールを1回の実行につき1回のみ行います。単独で使用すると、通常の単一インストールのように動作します。 |
-f |
ストレージサイズのチェックを無視します。 |
-v |
詳細な出力を表示します。 |
-c |
同じホストで複数の Netinstall インスタンスを許可します。 |
-k <keyfile> |
ライセンスキー (.KEY) をインストールします。 |
-s <userscript> |
RouterOS が提供するデフォルト設定スクリプトを置き換える、永続的な設定スクリプトをインストールします。 |
-sm <modescript> |
インストール後の最初の起動時に1回だけ実行されるモードスクリプトをインストールします。 |
--mac <mac> |
この MAC アドレスにのみ応答します。 |
-i <interface> |
特定のインターフェースにバインドします。 |
-a <client-ip> |
特定のクライアント IP を割り当てます。-i が使用されている場合、サーバー IP は自動検出されます。 |
厳格なルール
- システムパッケージは最初にリストする必要があります。 パッケージリストの最初に
routeros-...npkを配置してください。 - root 権限が必要です。 Netinstall は特権のある BOOTP/TFTP ポートを使用します。
- マルチアーキテクチャパッケージセットが許可されています。 Netinstall はデバイスのアーキテクチャを検出し、一致するパッケージのみを使用します。
-rも-eも指定しない場合、「古い設定を保持する」ことを意味します。 Netinstall は現在の設定データベースをダウンロードし、デバイスを再フォーマットし、その設定をアップロードし直します。これはユーザーファイルや Dude や User Manager などのデータベースを保持しません。
インストールワークフローとスクリプトの順序
公式のワークフローは以下の通りです。
- デバイスを etherboot モードにします。
- 目的のパッケージとオプションのスクリプトを指定して Netinstall を実行します。
- 次の起動時に、RouterOS は初期設定の手順を実行します。
Linux の netinstall-cli の場合、最初の起動時の重要な順序は以下の通りです。
- モードスクリプト (
-sm) が最初に実行されます。 - その後にカスタム/デフォルト設定が実行されます。
- モードスクリプトが device-mode を変更した場合、モードスクリプトの完了後、デバイスは直ちに再起動します。
この順序は重要です。デフォルトまたはカスタム設定の前に実行する必要がある最初の起動状態、特に /system/device-mode と protected-routerboot には -sm を使用してください。
設定スクリプト vs モードスクリプト
ドキュメントでは、永続的な -s スクリプトに対して、設定スクリプト、初期設定、および以下の場所で表示されるカスタムデフォルト設定スクリプトなど、いくつかの名前を使用しています。
/system/default-configuration/custom-script/print
これら2つのスクリプトタイプは異なります。
| 機能 | 設定スクリプト (-s) |
モードスクリプト (-sm) |
|---|---|---|
| 目的 | RouterOS が提供するデフォルト設定スクリプトを置き換える | 設定スクリプトの前に、最初の起動時に1回だけ実行されるアクション |
| 実行タイミング | デバイスのデフォルト設定ステージとして | インストール後の最初の起動時、カスタム/デフォルト設定の前に |
| 永続性 | デバイスに保存される | 実行後に自動的に削除される |
| アップグレード後も残るか | はい | いいえ |
後で /system reset-configuration を実行した場合 |
リセット後に再度実行される | 後続のリセットでは永続しない |
| バージョン要件 | RouterOS 7.x ドキュメントで利用可能 | RouterOS 7.22+ および netinstall-cli 7.22+ が必要 |
| タイムアウト | 120秒 | 120秒 |
| ファイル形式 | 通常の RouterOS インポートファイル (.rsc) |
通常の RouterOS インポートファイル (.rsc) |
追加の具体的な詳細は以下の通りです。
- 設定スクリプトは、RouterOS 7.10beta8 以降で
$defconfPasswordと$defconfWifiPasswordを読み取ることができます。 - MikroTik のドキュメントでは、設定スクリプトの実行前に遅延を導入することを明示的に推奨しています。
- ルーターが設定スクリプトで Netinstall された場合、後で
/system reset-configurationを実行すると、そのスクリプトが再度実行されます。これは、スクリプトなしでデバイスが再 Netinstall されるまで続きます。
パッケージの URL と命名
通常の RouterOS ダウンロードツリーを使用してください。
https://download.mikrotik.com/routeros/{version}/routeros-{version}-{arch}.npk
https://download.mikrotik.com/routeros/{version}/all_packages-{arch}-{version}.zip
https://download.mikrotik.com/routeros/{version}/netinstall-{version}.tar.gz
すべてのリリースチャネルで、まず download.mikrotik.com を使用してください。cdn.mikrotik.com はフォールバックのミラー/キャッシュとして扱い、主要なバージョンルールとは見なさないでください。
アーキテクチャのサフィックス
| アーキテクチャ | パッケージ形式 |
|---|---|
arm |
routeros-7.22-arm.npk |
arm64 |
routeros-7.22-arm64.npk |
mipsbe |
routeros-7.22-mipsbe.npk |
mmips |
routeros-7.22-mmips.npk |
smips |
routeros-7.22-smips.npk |
ppc |
routeros-7.22-ppc.npk |
tile |
routeros-7.22-tile.npk |
x86 |
routeros-7.22.npk |
x86 は命名の例外です。 パッケージのファイル名にはアーキテクチャのサフィックスが省略されますが、すべてのパッケージを含む ZIP ファイルでは x86 が使用されます。例えば、all_packages-x86-7.22.zip のようになります。
ダウンロードと実行
公式の Linux クイックスタートパターンは以下の通りです。
wget https://download.mikrotik.com/routeros/7.22/netinstall-7.22.tar.gz
tar -xzf netinstall-7.22.tar.gz
sudo ./netinstall-cli -r -i 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
RouterOS Netinstall
This skill focuses on official Netinstall / netinstall-cli behavior. tikoci/netinstall is a useful wrapper and source of grounded examples, but it is only one way to drive the tool.
What netinstall-cli Does
Netinstall reinstalls RouterOS onto a device that has booted into etherboot mode. The Linux tool, netinstall-cli, listens for BOOTP requests and then sends the RouterOS boot image and selected .npk packages.
Grounded behavior from MikroTik docs:
- Netinstall re-formats the system drive
- It does not erase the RouterOS license key
- It does not reset RouterBOOT settings
- It works over a direct Layer 2 path using BOOTP/DHCP ports and TFTP
- It requires root / sudo
netinstall-cli is the Linux command-line variant. The Windows GUI exposes nearly the same core options.
Command Syntax
netinstall-cli [-r] [-e] [-b] [-m [-o]] [-f] [-v] [-c]
[-k <keyfile>] [-s <userscript>] [-sm <modescript>]
[--mac <mac>] {-i <interface> | -a <client-ip>} [PACKAGES...]
Flags
| Flag | Meaning |
|---|---|
-r |
Reinstall and apply the default-configuration stage |
-e |
Reinstall with empty configuration |
-b |
Discard the currently installed branding package |
-m |
Enable repeated installs in one run |
-o |
With -m, only reinstall a given MAC once per run; by itself it behaves like a normal single install |
-f |
Ignore storage-size checks |
-v |
Verbose output |
-c |
Allow multiple netinstall instances on the same host |
-k <keyfile> |
Install a license key (.KEY) |
-s <userscript> |
Install a persistent configure script that replaces the RouterOS-supplied default configuration script |
-sm <modescript> |
Install a one-time mode script for the first boot after install |
--mac <mac> |
Only respond to this MAC address |
-i <interface> |
Bind to a specific interface |
-a <client-ip> |
Assign a specific client IP; if -i is used, server IP is auto-detected |
Hard Rules
- The system package must be listed first. Put
routeros-...npkfirst in the package list. - Root privileges are required. Netinstall uses privileged BOOTP/TFTP ports.
- Multi-arch package sets are allowed. Netinstall detects the device architecture and only uses matching packages.
- No
-rand no-emeans "keep old configuration". Netinstall downloads the current configuration database, reformats the device, and uploads that configuration back. This does not preserve user files or databases such as Dude or User Manager.
Install Workflow and Script Order
The official workflow is:
- Put the device into etherboot
- Run Netinstall with the desired packages and optional scripts
- On the next boot, RouterOS runs the initial-configuration steps
For Linux netinstall-cli, the important first-boot order is:
- Mode script (
-sm) runs first - Custom/default configuration runs after that
- If the mode script changes device-mode, the device reboots immediately after the mode script completes
That ordering matters: use -sm for first-boot state that must happen before default or custom configuration, especially /system/device-mode and protected-routerboot.
Configure Script vs Mode Script
The docs use several names for the persistent -s script: configure script, initial configuration, and the custom default configuration script visible at:
/system/default-configuration/custom-script/print
These two script types are different:
| Feature | Configure script (-s) |
Mode script (-sm) |
|---|---|---|
| Purpose | Replace RouterOS-supplied default config script | One-time first-boot actions before config scripts |
| When it runs | As the device's default-configuration stage | On first boot after install, before custom/default config |
| Persistence | Stored on device | Auto-removed after execution |
| Survives upgrades | Yes | No |
Later /system reset-configuration |
Runs again after reset | Does not persist for later resets |
| Version requirement | Available in RouterOS 7.x docs | Requires RouterOS 7.22+ and netinstall-cli 7.22+ |
| Timeout | 120 seconds | 120 seconds |
| File format | Regular RouterOS import file (.rsc) |
Regular RouterOS import file (.rsc) |
Additional grounded details:
- Configure scripts can read
$defconfPasswordand$defconfWifiPasswordstarting with RouterOS 7.10beta8 - MikroTik docs explicitly suggest introducing a delay before configure-script execution
- If a router was netinstalled with a configure script, later
/system reset-configurationruns that same script again until the device is re-netinstalled without it
Package URLs and Naming
Use the normal RouterOS download tree:
https://download.mikrotik.com/routeros/{version}/routeros-{version}-{arch}.npk
https://download.mikrotik.com/routeros/{version}/all_packages-{arch}-{version}.zip
https://download.mikrotik.com/routeros/{version}/netinstall-{version}.tar.gz
Use download.mikrotik.com first for all release channels. Treat cdn.mikrotik.com as a fallback mirror/cache, not the primary version rule.
Architecture suffixes
| Architecture | Package form |
|---|---|
arm |
routeros-7.22-arm.npk |
arm64 |
routeros-7.22-arm64.npk |
mipsbe |
routeros-7.22-mipsbe.npk |
mmips |
routeros-7.22-mmips.npk |
smips |
routeros-7.22-smips.npk |
ppc |
routeros-7.22-ppc.npk |
tile |
routeros-7.22-tile.npk |
x86 |
routeros-7.22.npk |
x86 is the naming exception: the package filename omits the architecture suffix, but the all-packages ZIP still uses x86, for example all_packages-x86-7.22.zip.
Download and Run
Official Linux quick-start pattern:
wget https://download.mikrotik.com/routeros/7.22/netinstall-7.22.tar.gz
tar -xzf netinstall-7.22.tar.gz
sudo ./netinstall-cli -r -i eth0 \
routeros-7.22-arm64.npk \
container-7.22-arm64.npk
Static IP on the netinstall host is strongly recommended, for example:
sudo ifconfig eth0 192.168.88.2/24
Common Scripted Cases
Empty config
sudo ./netinstall-cli -e -b -i eth0 \
routeros-7.22-arm64.npk
Keep old configuration
sudo ./netinstall-cli -i eth0 \
routeros-7.22-arm64.npk
This keeps the configuration database only; it does not preserve files stored on the device.
First-boot mode script
/system/device-mode update mode=advanced container=yes
sudo ./netinstall-cli -r -sm modescript.rsc -i eth0 \
routeros-7.22-arm64.npk \
container-7.22-arm64.npk
This is the main documented use for -sm: set device mode during the first boot without requiring a later manual confirmation flow.
Etherboot Notes
Devices must be in etherboot mode before Netinstall can see them. Common entry methods:
- reset button
- serial console (
Ctrl+E) - RouterOS setting
boot-device=try-ethernet-once-then-nand
Netinstall uses BOOTP/DHCP ports, so avoid other DHCP sources on the same segment. The docs also call out two common failure cases:
- some USB Ethernet adapters create an extra link flap and the device is missed
- DHCP snooping can block the packets unless the Netinstall-facing port is trusted
Non-x86 Hosts
netinstall-cli is a Linux i386 ELF binary.
| Host | Practical approach |
|---|---|
| x86_64 Linux | Run it directly |
| ARM/ARM64 Linux | Use QEMU user-mode (qemu-i386-static or qemu-i386) |
| macOS | Run Linux in a VM with bridged networking |
This is where tikoci/netinstall is useful as a reference wrapper: it automates package download, QEMU-on-ARM, and macOS VM execution, but the underlying Netinstall behavior is still the same netinstall-cli flow documented above.
Related References
- Official docs: https://help.mikrotik.com/docs/spaces/ROS/pages/24805390/Netinstall
- Reset behavior for persistent configure scripts: https://help.mikrotik.com/docs/spaces/ROS/pages/328155/Configuration%2BManagement#ConfigurationManagement-ConfigurationReset
- Version/channel and URL patterns:
routeros-fundamentals/references/version-parsing.md - Wrapper/example project: https://github.com/tikoci/netinstall