Hi - I want to launch a script from Linux into RouterOS v6.40.5 and receive the answer back to do something with it.
In fact, I want to issue the commands “ip” then “neighbor” then “print”.
Can someone provide basic instructions on how to do that or somethins similar ?
Thanks.
SSH -p @ ‘mikrotik command’
Thanks for the starting point.
The next problem … is to provide the user and the password
And then, to send “ip”, then “neighbor” then “print” and finally to receive the output into a string I can work with.
next problem - I have this script :
C:\> ssh xarxa@10.139.130.65 'ip ; neighbor ; print'
xarxa@10.139.130.65's password:
# INTERFACE ADDRESS MAC-ADDRESS
0 ether2 10.139.130.69 00:15:6D:3A:54:C2
1 ether2 10.139.130.71 04:18:D6:2A:E0:99
2 ether2 172.25.33.9 E4:8D:8C:0A:3D:93
3 ether2 172.25.66.1 E4:8D:8C:1F:47:2E
4 ether4 10.139.238.195 00:15:6D:82:7C:74
5 ether4 10.139.238.196 00:27:22:C6:94:79
6 ether5 10.139.130.69 00:15:6D:3A:54:C2
7 ether5 10.139.130.71 04:18:D6:2A:E0:99
8 ether6 10.139.238.36 00:15:6D:B0:2B:70
9 ether7 10.139.130.99 80:2A:A8:74:43:92
10 ether7 10.139.130.102 00:27:22:70:01:6A
11 ether7 10.139.130.103
2 big problems :
a) every line is much longer, with important data there (as Identity)
b) there are 16 lines, not 11
What am I doing wrong ?
Don’t use username and password. Make use of a SSH key instead. The public key of your generated key pair should be imported into the Mikrotik router. Ensure that you’re using the right version of such a key pair. I suppose that Mikrotik just supports RSA keys. But that might be an misunderstanding. Ensure that you’ve read the Mikrotik wiki article in advance.