I have a couple of SXT’s that I like to setup with a certain configuration. I’ve found a topic on this forum that describes this as possible through netinstall (http://forum.mikrotik.com/t/customize-default-configuration-script/25002/1). I’ve written an custom configuration that works when pasting it in the terminal and gets executed, I’m able to use this configuration from Netinstall as well.
However, as I understood from the previous mentioned topic, this would also mean this custom configuration gets deployed when preforming a system reset using the physical button. But this isn’t the case in my test scenario, after doing a netinstall my custom configuration script runs and deploys all settings. But after preforming a reset the configuration completely disappears.
I’ve also done some test with uploading my configuration on the device and selecting it to run after a system reset, but that doesn’t work either. However when running my script as a script or pasting the configuration in the terminal it works as well.
I’m using the latest versions of Netinstall and RouterOS. If you need additional information, let me know. I will add it to my post then.
I’ve also done some test with uploading my configuration on the device and selecting it to run after a system reset, but that doesn’t work either. However when running my script as a script or pasting the configuration in the terminal it works as well.
This leads me to think the script is failing when it’s being loaded early in the boot sequence.
Two tips:
1.- Try adding a
/delay 20
At the beggining of the script. Rationale: it could be wireless driver isn’t loaded at the time the script tries to set wlanX devices (no wlanX devices in the system at that point). This gives the OS time to load and initialize interfaces.
2.- Insert /beep commands with different frequencies along the script, that way you will know how far is reaching in the script.
Here is the configuration I have used. I’ve replaced my wpa-key with stars but it’s an actual value in the real script of course.
When using this configuration as a script it works, when pasting it in the terminal it works, when preforming a first installation using netinstall it works.
@Puttika, thnx for your suggestion. I will definitely try that!
Wireless drivers take some time to load. Default script can be executed faster than wireless drivers are loaded.
Best method in this case is to add loop to wait for wireless interfaces to appear at the beginning of your script.
I can confirm that it was indeed related to wireless drivers and fixed using a loop. I’ve taken a look at the MikroTik default configuration and used the loop element found in there.