I work for an ISP. When customers cancel their service, I receive their routers, wipe the config, and replace it with the latest config we are using. Currently, I have to plug into each router individually and send the files over. I'm using FTP with an auto.rsc file to run a script that wipes the router and then does "run after reset=". What I would like to do is provision them all with one click. The issue is that until now I have not been able to write a script that accomplishes this because all of the routers have the same default private IP address of 192.168.88.1. I was pretty sure I had figured out how to get around this today but I can't seem to get it to work.
My setup:
I am currently using an hAP with 4 other hAPs connected via ethernet. I have all the ether interfaces disabled except for one. This way when I send a file to 192.168.88.1 there will only be one pathway and the file will go to the hAP that I want.
Method:
I am attempting to write a simple script that will send a file from one MikroTik router to another using FTP. Once the file is sent it should disable the interface it used and enable the next interface making this new interface the only route to 192.168.88.1. The problem I am having is that after the file is sent through FTP it seems that the rest of the script is not executed. The issue seems to have something to do with the FTP part of the script because when I run it sending a different command like ping it runs through the whole script with no problem.
Code: Select all
/tool/fetch address=192.168.88.1 upload=yes dst-path=/flash/HapConfigFTP.rsc src-path=/flash/HapConfigFTP.rsc mode=ftp user=*** password=***
/tool/fetch address=192.168.88.1 upload=yes dst-path=/flash/ResetHAPConfig.auto.rsc src-path=/flash/ResetHAPConfig.auto.rsc mode=ftp user= *** password=***
/interface disable ether2
/interface enable ether3
/ip arp remove [find]
ping 192.168.88.1 count=15
/tool/fetch address=192.168.88.1 upload=yes dst-path=/flash/HapConfigFTP.rsc src-path=/flash/HapConfigFTP.rsc mode=ftp user=*** password=***
/tool/fetch address=192.168.88.1 upload=yes dst-path=/flash/ResetHAPConfig.auto.rsc src-path=/flash/ResetHAPConfig.auto.rsc mode=ftp user= *** password=***
/interface disable ether3
/interface enable ether4
/ip arp remove [find]
ping 192.168.88.1 count=15
/tool/fetch address=192.168.88.1 upload=yes dst-path=/flash/HapConfigFTP.rsc src-path=/flash/HapConfigFTP.rsc mode=ftp user=*** password=***
/tool/fetch address=192.168.88.1 upload=yes dst-path=/flash/ResetHAPConfig.auto.rsc src-path=/flash/ResetHAPConfig.auto.rsc mode=ftp user= *** password=***
/interface disable ether4
/interface enable ether5
/ip arp remove [find]
ping 192.168.88.1 count=15
/tool/fetch address=192.168.88.1 upload=yes dst-path=/flash/HapConfigFTP.rsc src-path=/flash/HapConfigFTP.rsc mode=ftp user=*** password=***
/tool/fetch address=192.168.88.1 upload=yes dst-path=/flash/ResetHAPConfig.auto.rsc src-path=/flash/ResetHAPConfig.auto.rsc mode=ftp user= *** password=***
/interface disable ether5
/interface enable ether2
If I run this script all the step are followed.
Code: Select all
/interface disable ether2
/interface enable ether3
/ip arp remove [find]
ping 192.168.88.1 count=15
/interface disable ether3
/interface enable ether4
/ip arp remove [find]
ping 192.168.88.1 count=15
/interface disable ether4
/interface enable ether5
/ip arp remove [find]
ping 192.168.88.1 count=15
/interface disable ether5
/interface enable ether2
The router I am using to run the script is running ROS v7.5
Can someone please explain why the code execution stops after the files are sent?
Thank you!