routeros-sniffer
RouterOS搭載機器でパケットをキャプチャし、TZSPを使ってリアルタイムにWiresharkなどに転送、プロトコルのデバッグやファイアウォール設定に役立て、pcap形式で保存するといった一連のパケット解析を支援するSkill。
📜 元の英語説明(参考)
RouterOS packet capture and TZSP streaming for protocol debugging. Use when: capturing packets on RouterOS, setting up /tool/sniffer, streaming live traffic via TZSP, using firewall mangle action=sniff-tzsp, debugging network protocols on MikroTik, receiving TZSP with Wireshark or tshark, saving pcap files from RouterOS, or when the user mentions packet sniffer, TZSP, sniff-tzsp, /tool/sniffer, or packet capture on RouterOS.
🇯🇵 日本人クリエイター向け解説
RouterOS搭載機器でパケットをキャプチャし、TZSPを使ってリアルタイムにWiresharkなどに転送、プロトコルのデバッグやファイアウォール設定に役立て、pcap形式で保存するといった一連のパケット解析を支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o routeros-sniffer.zip https://jpskill.com/download/20958.zip && unzip -o routeros-sniffer.zip && rm routeros-sniffer.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/20958.zip -OutFile "$d\routeros-sniffer.zip"; Expand-Archive "$d\routeros-sniffer.zip" -DestinationPath $d -Force; ri "$d\routeros-sniffer.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
routeros-sniffer.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
routeros-snifferフォルダができる - 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
- 同梱ファイル
- 2
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
RouterOS パケットキャプチャと TZSP ストリーミング
RouterOS には、パケットスニッファ (/tool/sniffer) と、トラフィックをミラーリングできるファイアウォールマングルアクションが組み込まれています。これらは、ルーター上のファイルに保存するか、TZSP (TaZmen Sniffer Protocol) を介してリモートホストにライブストリーミングすることができます。tcpdump のような標準ツールは存在しないため ( routeros-fundamentals スキルを参照)、これが RouterOS でパケットをキャプチャする主な方法です。
エージェントにとってこれが重要な理由
RouterOS 上でネットワークプロトコルの問題をデバッグする際、エージェントは以下のことができることを知っておくべきです。
- TZSP を介してルーターからホストマシンにライブパケットをストリーミングできます。CHR VM を使用している場合はハードウェアは不要です。
- ルーターのフラッシュに pcap/pcapng ファイルを保存し、分析のためにダウンロードできます。
- スニッファ設定に触れることなく、ファイアウォールマングルルールを使用して、外科的なフローごとのパケットミラーリングを行うことができます。
QEMU CHR インスタンス ( routeros-qemu-chr スキルを参照) と組み合わせることで、エージェントは物理ハードウェアなしで完全なパケットレベルのデバッグワークフローを実現できます。
方法 1: /tool/sniffer (完全なキャプチャツール)
組み込みのスニッファは、指定されたインターフェースで広範なフィルタリングを使用してパケットをキャプチャします。3つの独立した出力モードをサポートしており、これらを組み合わせることができます。
| 出力 | 設定 | 注記 |
|---|---|---|
| メモリバッファ | (常にオン) | quick、packet、protocol、host、connection サブメニューから表示可能。パケットは10分間利用可能 |
| フラッシュ上のファイル | file-name=capture.pcap |
RouterOS 7.20 以降は PCAPNG 形式 |
| TZSP ストリーム | streaming-enabled=yes |
streaming-server の streaming-port (デフォルト 37008) への UDP |
ライブ TZSP ストリーミング
# スニッファを TZSP 経由でリモートホストにストリーミングするように設定します
/tool/sniffer
set streaming-enabled=yes streaming-server=<RECEIVER-IP>:37008
# オプション: 特定のインターフェースまたはプロトコルにフィルタリングします
set filter-interface=ether1
set filter-ip-protocol=icmp
# キャプチャを開始します (停止されるかルーターが再起動するまで実行されます)
/tool/sniffer/start
# 完了したら停止します
/tool/sniffer/stop
受信ホストは Wireshark、tshark、またはその他の TZSP 対応ツールを実行します ( TZSP receivers reference を参照)。
ファイルベースのキャプチャ
# ルーターのフラッシュにファイルとしてキャプチャします
/tool/sniffer
set file-name=capture.pcap filter-interface=ether1
/tool/sniffer/start
# ... キャプチャさせます ...
/tool/sniffer/stop
# または、メモリバッファを手動でファイルに保存します
/tool/sniffer/save file-name=/flash/debug.pcap
# SCP または fetch でダウンロードします
# ホストから:
# scp admin@<ROUTER-IP>:/flash/debug.pcap .
ファイルとストリーミングは同時に実行できます。
/tool/sniffer
set file-name=capture.pcap streaming-enabled=yes streaming-server=<RECEIVER-IP>:37008
/tool/sniffer/start
クイックモード (インタラクティブ CLI)
ルーターコンソールで直接、簡単な一度限りの検査を行う場合:
# ether1 上の ICMP トラフィックをクイックキャプチャします
/tool/sniffer/quick ip-protocol=icmp interface=ether1
これは、ソース/宛先 MAC、IP、プロトコル、サイズを含むライブスクロールテーブルをコンソールに表示します。
スニッファフィルタプロパティ
/tool/sniffer/set の主要なフィルタオプション:
| プロパティ | 説明 |
|---|---|
filter-interface |
インターフェース名または all (デフォルト: all) |
filter-ip-address |
最大16個の IP/マスクエントリ |
filter-dst-ip-address |
最大16個の宛先 IP/マスクエントリ |
filter-src-ip-address |
最大16個の送信元 IP/マスクエントリ |
filter-port |
最大16個のポート (! 否定をサポート) |
filter-ip-protocol |
最大16個のプロトコル (tcp, udp, icmp など) |
filter-mac-protocol |
最大16個の MAC プロトコル (ip, arp, ipv6, vlan など) |
filter-direction |
any、rx、または tx |
filter-stream |
yes/no — スニッファ自身の TZSP パケットをキャプチャから除外します (デフォルト: yes) |
filter-vlan |
最大16個の VLAN ID |
memory-limit |
メモリバッファサイズ (デフォルト: 100 KiB) |
file-limit |
最大ファイルサイズ (デフォルト: 1000 KiB) |
only-headers |
パケットヘッダのみを保存し、完全なペイロードは保存しません |
重要: filter-stream=yes (デフォルト) は、スニッファ自身の TZSP ストリームパケットをキャプチャから除外します。フィードバックループを避けるために、これをオンのままにしておいてください。
方法 2: ファイアウォールマングル (ターゲットミラーリング)
ファイアウォールマングルルールは、完全なファイアウォールマッチャーを使用してきめ細かなフローごとのミラーリングを提供します。スニッファ関連のアクションは2つあります。
action=sniff-tzsp (リモート TZSP レシーバーへのストリーム)
一致するパケットを TZSP としてリモートホストにミラーリングします。ファイアウォールの完全なマッチングエンジン (送信元/宛先アドレス、プロトコル、ポート、接続状態、インターフェースなど) を使用します。
# すべての転送された ICMP を TZSP レシーバーにミラーリングします
/ip/firewall/mangle
add action=sniff-tzsp chain=forward protocol=icmp \
sniff-target=<RECEIVER-IP> sniff-target-port=37008 \
comment="TZSP mirror ICMP to Wireshark"
# 特定のホストからのトラフィックをミラーリングします
/ip/firewall/mangle
add action=sniff-tzsp chain=forward src-address=192.168.88.100 \
sniff-target=<RECEIVER-IP> sniff-target-port=37008
# DNS クエリをミラーリングします
/ip/firewall/mangle
add action=sniff-tzsp chain=forward protocol=udp dst-port=53 \
sniff-target=<RECEIVER-IP> sniff-target-port=37008
sniff-tzsp のプロパティ:
sniff-target(IP) — TZSP UDP パケットの宛先 IPsniff-target-port(ポート、デフォルト 37008) — 宛先 UDP ポートsniff-id— オプションの識別子タグ
主要な動作: sniff-tzsp は passthrough のように動作します。一致後、パケットは次のマングルルールに進みます。元のパケットは変更または破棄されず、コピーのみが TZSP として送信されます。
マングル vs /tool/sniffer: どちらをいつ使用するか
| シナリオ | 使用 |
|---|---|
| インターフェース上のすべてのトラフィックをキャプチャする | /tool/sniffer |
| 特定のフロー (IP、ポート、プロトコル別) をミラーリングする | マングル sniff-tzsp |
| ルーターのフラッシュに pcap ファイルを保存する | file-name を指定した /tool/sniffer |
| Wireshark/tshark にライブストリームする | どちらでも — streaming-enabled を指定した /tool/sniffer またはマングル sniff-tzsp |
| 異なるレシーバーへの複数の独立したミラーリング | マングルルール (ターゲットごとに1つ) |
| クイックなインタラクティブ CLI 表示 | /tool/sniffer/quick |
TZSP プロトコル概要
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
RouterOS Packet Capture & TZSP Streaming
RouterOS has a built-in packet sniffer (/tool/sniffer) and firewall mangle actions that can mirror traffic — either saving to a file on the router or streaming live to a remote host via TZSP (TaZmen Sniffer Protocol). This is the primary way to capture packets on RouterOS since standard tools like tcpdump do not exist (see routeros-fundamentals skill).
Why This Matters for Agents
When debugging any network protocol issue on RouterOS, agents should know they can:
- Stream live packets from the router to the host machine via TZSP — no hardware needed if using a CHR VM
- Save pcap/pcapng files on the router's flash and download them for analysis
- Use firewall mangle rules for surgical, per-flow packet mirroring without touching the sniffer config
Combined with a QEMU CHR instance (see routeros-qemu-chr skill), this gives agents a complete packet-level debugging workflow with zero physical hardware.
Method 1: /tool/sniffer (Full Capture Tool)
The built-in sniffer captures packets on specified interfaces with extensive filtering. It supports three independent output modes that can be combined:
| Output | Setting | Notes |
|---|---|---|
| Memory buffer | (always on) | Viewable via quick, packet, protocol, host, connection submenus. Packets available for 10 minutes |
| File on flash | file-name=capture.pcap |
PCAPNG format since RouterOS 7.20 |
| TZSP stream | streaming-enabled=yes |
UDP to streaming-server on streaming-port (default 37008) |
Live TZSP Streaming
# Configure sniffer to stream via TZSP to a remote host
/tool/sniffer
set streaming-enabled=yes streaming-server=<RECEIVER-IP>:37008
# Optional: filter to a specific interface or protocol
set filter-interface=ether1
set filter-ip-protocol=icmp
# Start capture (runs until stopped or router reboots)
/tool/sniffer/start
# Stop when done
/tool/sniffer/stop
The receiver host runs Wireshark, tshark, or another TZSP-capable tool (see TZSP receivers reference).
File-Based Capture
# Capture to file on router flash
/tool/sniffer
set file-name=capture.pcap filter-interface=ether1
/tool/sniffer/start
# ... let it capture ...
/tool/sniffer/stop
# Or save the memory buffer to a file manually
/tool/sniffer/save file-name=/flash/debug.pcap
# Download via SCP or fetch
# From the host:
# scp admin@<ROUTER-IP>:/flash/debug.pcap .
File + streaming can run simultaneously:
/tool/sniffer
set file-name=capture.pcap streaming-enabled=yes streaming-server=<RECEIVER-IP>:37008
/tool/sniffer/start
Quick Mode (Interactive CLI)
For quick one-off inspection directly on the router console:
# Quick-capture ICMP traffic on ether1
/tool/sniffer/quick ip-protocol=icmp interface=ether1
This shows a live scrolling table on the console with source/dest MAC, IP, protocol, and size.
Sniffer Filter Properties
Key filter options for /tool/sniffer/set:
| Property | Description |
|---|---|
filter-interface |
Interface name or all (default: all) |
filter-ip-address |
Up to 16 IP/mask entries |
filter-dst-ip-address |
Up to 16 destination IP/mask entries |
filter-src-ip-address |
Up to 16 source IP/mask entries |
filter-port |
Up to 16 ports (supports ! negation) |
filter-ip-protocol |
Up to 16 protocols (tcp, udp, icmp, etc.) |
filter-mac-protocol |
Up to 16 MAC protocols (ip, arp, ipv6, vlan, etc.) |
filter-direction |
any, rx, or tx |
filter-stream |
yes/no — filter out sniffer's own TZSP packets (default: yes) |
filter-vlan |
Up to 16 VLAN IDs |
memory-limit |
Memory buffer size (default: 100 KiB) |
file-limit |
Max file size (default: 1000 KiB) |
only-headers |
Save only packet headers, not full payload |
Important: filter-stream=yes (default) excludes the sniffer's own TZSP stream packets from the capture — leave this on to avoid feedback loops.
Method 2: Firewall Mangle (Targeted Mirroring)
Firewall mangle rules offer granular per-flow mirroring using the full firewall matcher. Two sniff-related actions exist:
action=sniff-tzsp (Stream to Remote TZSP Receiver)
Mirrors matching packets as TZSP to a remote host. Uses the firewall's full matching engine (src/dst address, protocol, port, connection state, interface, etc.):
# Mirror all forwarded ICMP to a TZSP receiver
/ip/firewall/mangle
add action=sniff-tzsp chain=forward protocol=icmp \
sniff-target=<RECEIVER-IP> sniff-target-port=37008 \
comment="TZSP mirror ICMP to Wireshark"
# Mirror traffic from a specific host
/ip/firewall/mangle
add action=sniff-tzsp chain=forward src-address=192.168.88.100 \
sniff-target=<RECEIVER-IP> sniff-target-port=37008
# Mirror DNS queries
/ip/firewall/mangle
add action=sniff-tzsp chain=forward protocol=udp dst-port=53 \
sniff-target=<RECEIVER-IP> sniff-target-port=37008
Properties for sniff-tzsp:
sniff-target(IP) — destination IP for the TZSP UDP packetssniff-target-port(port, default 37008) — destination UDP portsniff-id— optional identifier tag
Key behavior: sniff-tzsp acts like passthrough — after matching, the packet continues to the next mangle rule. The original packet is NOT modified or dropped; only a copy is sent as TZSP.
Mangle vs /tool/sniffer: When to Use Which
| Scenario | Use |
|---|---|
| Capture all traffic on an interface | /tool/sniffer |
| Mirror specific flows (by IP, port, protocol) | Mangle sniff-tzsp |
| Save pcap file on router flash | /tool/sniffer with file-name |
| Stream live to Wireshark/tshark | Either — /tool/sniffer with streaming-enabled or mangle sniff-tzsp |
| Multiple independent mirrors to different receivers | Mangle rules (one per target) |
| Quick interactive CLI view | /tool/sniffer/quick |
TZSP Protocol Overview
TZSP is a simple UDP encapsulation — the router wraps the original Ethernet frame in a TZSP header and sends it as a UDP datagram:
UDP (port 37008) → TZSP header (4 bytes) → tags (variable) → TAG_END → original Ethernet frame
- Default port: 37008 (
0x9090) — not IANA-registered but the RouterOS/Wireshark standard - Encapsulation: Typically Ethernet (type 1); 802.11 for wireless captures
- Tags: Optional metadata (WLAN signal strength, channel, etc.); Ethernet captures usually have no tags
- Keepalives: Type 4 (Null) packets sent periodically — no inner frame, filter these when processing
CHR Testing Pattern
A QEMU CHR instance provides a complete packet capture lab with zero hardware. The free CHR license has a 1 Mbps speed limit but this is sufficient for protocol debugging and sniffer testing.
# 1. Boot a CHR instance with port forwarding for REST API and SSH
qemu-system-x86_64 -M q35 -m 256 \
-drive file=chr.img,format=raw,if=virtio \
-netdev user,id=net0,hostfwd=tcp::9180-:80,hostfwd=tcp::9122-:22 \
-device virtio-net-pci,netdev=net0 \
-display none -serial stdio
# 2. Configure sniffer via REST API once booted
curl -u admin: -X POST http://<router-ip>/rest/tool/sniffer/set \
-H 'Content-Type: application/json' \
-d '{"streaming-enabled":"yes","streaming-server":"10.0.2.2:37008"}'
# 3. Start capture
curl -u admin: -X POST http://<router-ip>/rest/tool/sniffer/start
# 4. Listen for TZSP on the host
tshark -i any -f "udp port 37008" -O tzsp
# 5. Generate test traffic (e.g., ping from the CHR)
curl -u admin: -X POST http://<router-ip>/rest/ping \
-H 'Content-Type: application/json' \
-d '{"address":"8.8.8.8","count":"3"}'
QEMU user-mode networking note: The CHR's default gateway (10.0.2.2) is the host. Use this IP as streaming-server when using QEMU -netdev user. The host must listen on all interfaces (or 10.0.2.2 specifically) to receive the TZSP packets.
For full QEMU setup details, see the routeros-qemu-chr skill. For CHR licensing details (free tier, 60-day trial, speed limits), see CHR licensing.
Gotchas
- Hardware-offloaded bridge traffic is NOT visible to the sniffer — only flooded packets (unknown unicast, broadcast, multicast) may appear
- Wireless client-to-client unicast with forwarding enabled is NOT visible
- Sniffed packets in memory expire after 10 minutes — save to file or use streaming for persistent capture
- PCAPNG format (RouterOS 7.20+) is the default for saved files — older tools may need PCAP
filter-stream=yes(default) is important — without it, the sniffer captures its own TZSP stream packets, creating a feedback loop- 1 Mbps CHR speed limit may cause "slow" captures — this is the free license limit, not a sniffer issue. See CHR licensing
file-limitshould not exceed free memory — the router may crash or behave unexpectedly
Cleanup
Always clean up sniffer config and mangle rules after debugging:
# Stop sniffer
/tool/sniffer/stop
# Reset sniffer config to defaults
/tool/sniffer
set streaming-enabled=no streaming-server=0.0.0.0 file-name=""
# Remove mangle rules (find by comment)
/ip/firewall/mangle/remove [find comment~"TZSP"]
Additional Resources
Reference files:
- For TZSP receiver setup (Wireshark, tshark, tcpdump): see TZSP receivers reference
Related skills:
- For QEMU CHR setup and boot patterns: see
routeros-qemu-chrskill - For CHR licensing (free tier, 60-day trial, speed limits): see
routeros-qemu-chrskill - For RouterOS CLI/REST basics: see
routeros-fundamentalsskill - For the
/console/inspectcommand tree: seerouteros-command-treeskill
MCP tools:
- For RouterOS docs lookup: use the
rosettaMCP server tools (routeros_search,routeros_get_page)
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (10,494 bytes)
- 📎 references/tzsp-receivers.md (4,517 bytes)