In latest version of their airOS firmware for airMax devices Ubiquiti networks dropped support for Dynamic DNS services. This left me out in the dark, unable to update the dynamic DNS corresponding to my devices. After a lot of crawling around the support forums I eventually came to a working solution based on crontab.

I use services from Hurricane Electric for my dynamic DNS needs. Updating boils down to fetching a special URL using either wget or curl. My idea was to do this every 30 minutes using cron jobs. This would have been done within a couple of minutes on a regular Linux system but turned out to be less straight forward on Ubiquiti device.

The airOS system ships with crond, however it is looking for its crontabs files into /etc/crontabs and it is not started on boot. What we will do is create custom scripts to run crond on boot and use our own crontabs directory.

Prerequisites

  • An airMAX Ubiquiti device running a Custom Scripts capable firmware. Get it from here. I am using version 8.7.1
  • SSH access to the device
  • Know-how on editing files using vi editor (there are plenty of vi tutorials on the internet)
  • Familiar with cron jobs

Getting it done

Create or edit the poststart script using vi editor. This script will be run after the system has started.

Below is the content of the rc.poststart script. It basically only starts crond telling it to look into our own (not yet created) crontabs directory.

Make the rc.poststart script executable and create the directory where our crontabs will be stored.

Edit our cronjobs

This is how my cron job to update my dns looks like (it is anonymized here).

Save everything between reboots !

Once done and on every change, in order to apply your changes you need run the following commands. This will save the changes (actually all that is contained in /etc/persistent plus other config stuff) and reboot the system.

Sources

Here are the partial information (not exhaustive list) I collected to achieve this :

https://community.ui.com/questions/Do-you-use-custom-rc-X-scripts-on-airOS-devices/3042d465-a508-4bb0-9eb8-f7f2be109b8f#answer/b0f6ba92-7c39-4a9e-bde3-4abb15ee7e1c

https://community.ui.com/questions/Trouble-getting-rc-poststart-to-execute/e9166419-857f-4244-a257-b6d52e7f63e7

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.