Detect all Mikrotik Routerboards

Hello,

is there any possibility to detect all Mikrotik Boards in the current network?
I mean something like WinBox does when clicking the tree dots beside of Connect To.

I have to connect to a new Routerboard with a clean configuration and do NOT want to do this by serial (which is working right now, but very limited).

In the end I want to determine a Routerboard in my Network (with an unkown IP) and connect to it somehow to enable API and do the rest.

Thanks,
xmanuw

you can either use the Dude, or also you can use neighbor viewer http://www.mikrotik.com/download/neighbour.zip

Yes, that programs do it.

My question is now how they do it. Because I need to autodetect the boards in my own application.
I don’t now if this is an open standard or something internal like winbox protocol.
If there is any way to retrieve a list of boards with my own code, please let me know.

Thank You.

xmanuw

It uses 5678/udp - MikroTik Neighbor Discovery Protocol. The protocol is not documented.

Ok, thank You.

Then I have to search for another way to solve my problem.

xmanuw.

An example (run from terminal):

:foreach i in=[/ip neighbor find interface=an_interface_that_you_want] do={ :local mtaddress [/ip neighbor get $i address]; :local mtidentity [/ip neighbor get $i identity]; :put ($mtaddress . " - " . $mtidentity)}

I needed a way to find all routerboards without beeing connected with one up to that point.

Luckyly the protocol isn’t that hard to decipher so got it working now.

But thanks for Your post, though.

Hi,

I need to detect and connect to the Routerboards in VB.
Can you help me, please?
Is there any sample code?

Thanks in advance

I have no sample here for You right now, but it should not be that hard to figure out.

Just use wireshark and listen to all Broadcasts on Port 5678/udp.
Then use winbox click the button to search for routerboards.
It should not be so hard too figure out the structure of the responses (which also go to the broadcast).

The connecting if You got the ip should be easier. There are samples at http://wiki.mikrotik.com/wiki/API

Happy coding.

Greets,
xmanuw

I did something similar yesterday, listening with winsock:
http://forum.mikrotik.com/t/how-winbox-search-for-mikrotik/30249/1

Thanks

Ok, thanks a lot.

What I have to do with Winsock control is:
.SendData Chr(0) + Chr(0) + Chr(0) + Chr(0)

And then, the RouterOS sends its answer with all information.

Now, I only have to obtain the source mac address of the packet


Regards