Asus AiMesh Node Auto-Reboot

I have several Asus routers running their AiMesh networking. AiMesh was perfect for me because when it came out, I already had a couple of routers that supported it and I wanted to expand my network and use MESH anyhow. The expense was only one additional router.

It has worked very well, except on rare occasion, my MESH node that is furthest out in the garage will lose its association and require a reboot to reconnect. It is really on the edge of signal range that I’d consider reliable.  Since these Asus routers are unix-based, a little scripting magic will save me a run out to power-cycle it.

We’ll create a script that pings an address on my LAN every 15 minutes. If unable to ping that address, it will wait 4 minutes longer and then reboot the node. Why 4 minutes? If the nearest node it is speaking to is getting a firmware upgrade or reboot, it will have time to complete and return a ping.

Log-in to your router, switch to the jffs directory, make a scripts folder and go into it as shown below:

Create the following scripts:

You will want to change the IP address above to something on your LAN. Save it, I called mine

Make a script called services-start that will include a cron job to run this script at 15 minute intervals:

Then, make sure both are executable.

Asus routers do not retain cron tasks when rebooted, to do this we add our services-start script to run at boot which adds the task. Technically, when the jffs directory is mounted this nvram variable runs the script. Add it by issuing the following commands:

You can test it right away by just issuing a reboot, waiting for it to come back on line, when it does, log back in and check the cron. You would see something like this with the following command:

Of note, the jffs directory is a semi-permanent user storage on the router. It is a good place to put these scripts. However, it is possible that a firmware update or a factory reset of your router will wipe them. It is a good idea to backup these scripts so that they can easily be re-added.

Optional thought: I have a drawer full of old USB flash drives of fairly useless sizes given the progress of technology. As mentioned above, the jffs directory and the scripts could be removed during a firmware update/reset. It should be possible to put these scripts onto one of those small drives and use the script_usbmount= nvram setting to run the services-start and scripts from the flash drive utilizing the USB port on the routers.

I will have to weigh how often Asus publishes firmware that wipe that directory to see if the extra time is worth it. Copy/pasting from even this blog post to recreate the scripts isn’t that difficult or time consuming.

Leave a Reply

Your email address will not be published. Required fields are marked *