Skip to content
Claude edited this page Jul 13, 2026 · 6 revisions

The MikroTik Neighbor Discovery Protocol

Supported by tik4net (no open connection needed) via MndpHelper in the tik4net.Mndp namespace.

Discover all routers on the local network

using tik4net.Mndp;

var items = MndpHelper.Discover();   // waits up to 60 s
foreach (var item in items)
{
    Console.WriteLine($"{item.IPv4}  {item.Mac}  {item.Identity}  {item.Version}");
}

You can control the timeout and stop as soon as the first router is found:

var items = MndpHelper.Discover(
    timeout: TimeSpan.FromSeconds(5),
    encoding: System.Text.Encoding.GetEncoding("iso-8859-1"),
    stopWhenFirstFound: true);

Look up a router's MAC address by IP

FindMacByHost is a convenience helper used internally by MacTelnetConnection to resolve the router MAC needed for Layer-2 transport. It returns the MAC as a 6-byte array, or null if the router is not found within the timeout (default 5 s).

using tik4net.Mndp;

byte[] mac = MndpHelper.FindMacByHost("192.168.4.1");
if (mac != null)
    Console.WriteLine(string.Join(":", mac.Select(b => b.ToString("X2"))));
else
    Console.WriteLine("Router not found via MNDP");

Custom timeout:

byte[] mac = MndpHelper.FindMacByHost("192.168.4.1", TimeSpan.FromSeconds(10));

TikInstanceDescriptor fields

Property Description
Identity Router identity string
IPv4 IPv4 address (IPAddress)
Mac MAC address as "AA:BB:CC:DD:EE:FF"
Version RouterOS version string
Platform Platform/board type
BoardName Board name
SoftwareId RouterOS software ID
IPv6 IPv6 address string (when announced)
Unpack Unpack/compression flag announced by the router
InterfaceName Interface from which the MNDP reply was sent
Uptime Router uptime (TimeSpan)

Clone this wiki locally