Hi all, I am looking for a way to automate setting an IP address to RouterOS devices, in case they don’t have one.
To do this, my best guess was to use the old terminal.exe tool that enables MAC Telnet, then send to its window default username and password and then the shell command to set an IP address on the network adapter I need.
In principle it works, but terminal.exe works only sometimes, most of the times it shows “connection timeout” and closes itself. Instead, Winbox can connect with my device all the times. The device I am using mounts RouterOS 6.39.2.
The reason may be my terminal.exe is a very old tool and it doesn’t work with newer RouterOS versions? However I can’t figure out why sometimes It does work indeed.
I would have no problem in using Winbox, however I’d like the procedure to be automated (no user intervention, if possible not even output!) and Winbox always starts up with the scan window…
Does anyone know if it is still possible to use terminal.exe to consistently connect via MAC-Telnet to a device or there are reasons why this won’t work so the only available option is using Winbox (or compiling another working Mac Telnet client for Windows, which I also tried but I didn’t succeed at)?
Is there any way to MAC Telnet a MikroTik 6.3X device on Windows other than using WInbox??? I’m looking for a SW library or even a command line or GUI tool that can be automated…
Ok, I did some Wiresharking and I think I figured out the problem: terminal.exe fails because it chooses to use the wrong network adapter.
I have just two adpaters enabled, an ethernet (connected to the MikroTik device) and a wlan.
In the packets sent by the MikroTik device I can see that it supposes to talk with an interface that has the MAC of my wlan, rather than of my ethernet. Therefore authentication fails and it refuses connection. If I disable all network interfaces but the ethernet, it seems to work consistently.
I tried to assign a priority to my network interfaces so ethernet has the highest (https://www.windowscentral.com/how-change-priority-order-network-adapters-windows-10) but I’m not sure yet it solves the problem (disabling all interfaces but one isn’t such a great solution).
I will have to play with it a bit, but I think now I’m on the right track and I can figure out the proper solution.
It seems there is no safe way to tell terminal.exe what network adapter to use. So I ended up writing my own MAC-Telnet C# implementation, converting the Linux C code found here: https://github.com/haakonnessjoen/MAC-Telnet
It wasn’t easy, but it seems to work fine, and I finally have full control on what’s being done. So far, so good… Until Mikrotik modifies the protocol