Let me introduce my first tools for autoconfigure mikrotik device.
I run this script on Linux Ubuntu 16.04 and python 2.7
I hope this tool useful for you who want to do the same configuration for many devices at once. For example you want to change / ip services or want to add the same firewall, etc. You can also use this tool to backup the router configuration.
For the algorithm, this script checks the ping first before executing directly to the device. If the ping is successful, it will be immediately executed to the device. If the ping test results are not successful, it will be skipped for the device and continued to the next device.
There is 3 files, autoceng.py configmikrotik.py and ipnya.py
configmikrotik.py : configuration contents to be executed to the device. Write your configuration inside cm variable or below #input config here
I run this script on Linux Ubuntu 16.04 and python 2.7
I hope this tool useful for you who want to do the same configuration for many devices at once. For example you want to change / ip services or want to add the same firewall, etc. You can also use this tool to backup the router configuration.
For the algorithm, this script checks the ping first before executing directly to the device. If the ping is successful, it will be immediately executed to the device. If the ping test results are not successful, it will be skipped for the device and continued to the next device.
There is 3 files, autoceng.py configmikrotik.py and ipnya.py
configmikrotik.py : configuration contents to be executed to the device. Write your configuration inside cm variable or below #input config here
ipnya : this file contains list router that will executed by autoceng. Fill this file with this format :
ipaddress|portssh|username|password
example :
172.26.153.130|22|admin|uhuy123
172.26.153.132|22|admin|uhuy123
autoceng.py : main file
How To Use :
[Default]
python autoceng.py
It will do the configuration in accordance with the configmikrotik.py file to all devices in the ip.py file
[Option1]
python autoceng.py withlog
It will do the configuration in accordance with the configmikrotik.py file to all devices in the ip.py file and save the output to log.
[Option2]
python autoceng.py single {ipaddress} {port} {username} {password}
ex : python autoceng.py single 172.26.122.1 6522 aceng kepo
It will do the configuration in accordance with the configmikrotik.py file to single host only.
[Option3]
python autoceng.py single withlog {ipaddress} {port} {username} {password}
ex : python autoceng.py single withlog 172.26.122.1 6522 aceng kepo
It will do the configuration in accordance with the configmikrotik.py file to single host only and save the output to log.
If you found error, see this.
[Error 1]
Cannot execute this device, make sure you have make the file according to the specified format!
Make sure you have write list device in ipnya according to the specified format
format : ipaddress|portssh|username|password
ex : 172.26.153.130|22|admin|uhuy123
[Error 2] :
Device Down. Skipping.....
Can't connected to router. Checked by icmp ping. If your router not permitted ping, you can edit file autoceng.py at line 126 to this :
before : verifdevice(dd[0],int(dd[1]),dd[2].strip(),dd[3].strip())
after : eksekusi(dd[0],int(dd[1]),dd[2].strip(),dd[3].strip())
[Error 3] :
Cant connect to device. Skipping.....
Can't SSH to router. It can be wrong password, wrong port, wrong username or maybe your router have access list for limited access ssh so ssh not permitted from your machine.
loading...
Comments
Post a Comment