tikoci/routeros-skills/routeros-mndp
Claude Code and agent skill by tikoci/routeros-skills
- community
Checking that the SKILL.md file is still in the repository.
MNDP (MikroTik Neighbor Discovery Protocol) wire format, behavior, and RouterOS /ip/neighbor integration. Use when: implementing MNDP discovery, parsing MNDP packets, working with /ip/neighbor, understanding WinBox device discovery, debugging why a router doesn't appear in neighbor lists, or when the user mentions MNDP, neighbor discovery, WinBox discovery, or /ip/neighbor.
Install
npx vskill@latest install tikoci/routeros-skills/routeros-mndpSKILL.md
MNDP — MikroTik Neighbor Discovery Protocol
MNDP is the UDP broadcast/multicast protocol that RouterOS uses for automatic device discovery on the local network. It is the same protocol WinBox uses to find routers. Every RouterOS device participates by default.
Why This Matters for Agents
- `/ip/neighbor` on RouterOS is the CLI/REST surface for MNDP results
- WinBox's "Neighbors" tab is an MNDP listener
- Any agent implementing device discovery for MikroTik equipment needs MNDP
- The protocol is simple enough to implement from scratch — no library needed
Protocol Basics
| Property | Value | |
|---|---|---|
| Transport | UDP | |
| Port | 5678 | |
| IPv4 | Broadcast to 255.255.255.255:5678 | |
| IPv6 | Multicast to ff02::1 (all-nodes link-local) | |
| Direction | Bidirectional — same port for send and receive | |
| Authentication | None — read-only discovery, no credentials | |
| Scope | Layer 2 broadcast domain (does not cross routers) |
How Discovery Works
- Listener sends a refresh packet — a small UDP datagram to 255.255.255.255:5678 (MAC-Telnet sends a minimal 4-byte zeroed header; a 9-byte form also works — see below)
- All RouterOS devices on the LAN reply — each sends a TLV-encoded announcement with identity, version, board, MAC, IP, uptime, etc.
- Replies arrive asynchronously — devices respond within milliseconds to seconds depending on network conditions
- RouterOS devices also announce periodically (~60s cycle) without being prompted — passive listening works but is slow to populate
Refresh Packet (Discovery Request)
A short packet that triggers immediate replies from all RouterOS devices on the broadcast domain. The minimal form is just a zeroed 4-byte header — this is exactly what MAC-Telnet sends (unsigned int message = 0;):
As raw bytes (minimal): 00 00 00 00
Some implementations append an explicit refresh TLV (type 6, length 0). The complete header + empty-TLV form is 8 bytes (00 00 00 00 00 06 00 00); some implementations add a trailing zero byte (non-semantic padding), giving 9 bytes. RouterOS accepts all forms:
As raw bytes (9-byte form): 00 00 00 00 00 06 00 00 00
Response Packet
The first 4 bytes are a fixed header; parsers skip the first 2 bytes and read the sequence number as a big-endian uint16, then iterate TLVs from offset 4.
TLV Format
Each TLV (Type-Length-Value) record in the response:
Byte order: TLV type and length are big-endian (network byte order — ntohs). This is confirmed by the canonical reference implementations: MAC-Telnet's protocol.c (type = ntohs(type); len = ntohs(len);) and the official Wireshark MNDP dissector (packet-mndp.c, which reads both with ENC_BIG_ENDIAN).
Value encoding varies by type and is the most common footgun: string TLVs are UTF-8, IPv4/IPv6/MAC are raw network-order bytes, but TLV 10 (uptime) is a little-endian uint32 — the only little-endian value in the entire protocol. Everything else multi-byte is big-endian/raw.
TLV Type Reference
| Type | Hex | Name | Value Format | Notes | |
|---|---|---|---|---|---|
| 1 | 0x0001 | MAC Address | 6 raw bytes (network order) | Per-interface MAC, not chassis MAC | |
| 5 | 0x0005 | Identity | UTF-8 string | Hostname — same across all interfaces | |
| 7 | 0x0007 | Version | UTF-8 string | e.g. 7.18 (stable), 7.22rc1 | |
| 8 | 0x0008 | Platform | UTF-8 string | Usually MikroTik | |
| 10 | 0x000a | Uptime | 4 bytes LE uint32 | Seconds since boot — the only little-endian value | |
| 11 | 0x000b | Software ID | UTF-8 string | License identifier | |
| 12 | 0x000c | Board | UTF-8 string | e.g. RB4011iGS+5HacQ2HnD, CHR | |
| 14 | 0x000e | Unpack | 1 byte | Neighbor's /ip/packing unpacking setting, shown as unpack= in /ip/neighbor[^packing]; byte values not grounded[^m2ir-mndp] | |
| 15 | 0x000f | IPv6 Address | 16 raw bytes | Link-local or global IPv6 | |
| 16 | 0x0010 | Interface Name | UTF-8 string | Sending interface on the router (e.g. ether1) | |
| 17 | 0x0011 | IPv4 Address | 4 raw bytes (network order) | IP of the sending interface |
Source of truth: these type IDs match the canonical MAC-Telnet protocol.c (MT_MNDPTYPE_* enum) and the Wireshark MNDP dissector value table exactly. Note in particular that uptime is type 10, software-id is type 11, and board is type 12 — a common mistake is to off-by-one these (uptime=11/board=13), which silently misparses real RouterOS packets.
Unknown values: header bytes 0–1, the TLV 14 byte mapping, and any type not listed above are not grounded here. Skip unknown types by length, preserve their bytes when logging, and report observations to m2ir.[^m2ir-mndp]
Multi-Interface Behavior
A RouterOS device with N active interfaces sends N separate MNDP announcements — one per interface. Each announcement has:
- A different MAC address (the interface's own MAC)
- A different interface name (TLV 16)
- A different IP address (if assigned)
- The same identity (hostname)
This is expected behavior, not a bug. When displaying results, group by identity to avoid showing the same router N times. Use MAC address to disambiguate when the identity is the factory default (MikroTik).
Timing and Reliability
| Scenario | Expected Response Time | |
|---|---|---|
| Local LAN (wired) | 1-3 seconds | |
| WiFi / congested network | 3-10 seconds | |
| ZeroTier / tunnel overlay | 5-20 seconds | |
| Satellite / high-latency | 10-30 seconds |
Best practice: Send multiple refresh packets during the listen window (every 5 seconds, matching WinBox behavior). Devices that miss the first broadcast due to packet loss, WiFi power-save, or tunnel relay latency will respond to subsequent refreshes.
Never interpret missing devices as offline. A short scan window produces partial results. Increase the timeout before concluding a device is unreachable.
RouterOS /ip/neighbor
/ip/neighbor is the RouterOS-side view of MNDP (and CDP/LLDP) discovery results. It shows what the router has heard from other devices on its directly-connected networks.
/ip/neighbor/discovery-settings
Controls which interfaces participate in neighbor discovery:
REST API Access
Security Considerations
- MNDP has no authentication — any device on the broadcast domain can discover routers
- Disable MNDP on untrusted interfaces (public-facing, guest networks)
- RouterOS defaults to discovery on all interfaces — review and restrict
- MNDP reveals: identity (hostname), version, board model, IPs, MACs, uptime
- This information is useful for attackers — treat MNDP like an open SNMP community
Socket Implementation Notes
Port Sharing (SO_REUSEPORT)
MNDP uses the same port (5678) for both sending and receiving. If another process (e.g., WinBox) already has UDP/5678 bound, your listener needs SO_REUSEPORT to coexist:
Platform note: SO_REUSEPORT works on macOS and Linux. On Windows, SO_REUSEADDR alone may be sufficient. In Bun, reusePort: true requires Bun >= 1.3.11 (earlier versions silently ignored it on macOS).
Self-Echo Filtering
When you send a broadcast to 255.255.255.255:5678, the OS delivers a copy back to your own socket. Filter out packets from your own IP addresses to avoid processing your own refresh as a neighbor response. The looped-back packet will have no MNDP TLVs (it's your 9-byte refresh, not a device announcement).
IPv6 Multicast
IPv6 MNDP uses ff02::1 (all-nodes multicast). Less commonly used than IPv4 broadcast but supported:
IPv6 link-local addresses include a zone ID (e.g., fe80::1%en0) that identifies the receiving interface — useful topology information not available in IPv4.
Parsing Example (TypeScript)
Reference Implementations
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingrouteros-mndp/SKILL.md
Popularity
- Repository stars
- 83
- Repository forks
- 18
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tikoci/routeros-skills/routeros-mndp)