Precise Radio Scheduling with DD WRT

As many people know, the DD WRT firmware can turn your standard Linksys/Buffalo router into a powerful networking device. One of the advantages of running a Linux based firmware on your device is the ability to take advantage of the many programs that are provided in a Linux environment. The cron service will allow you to schedule the operation of the wireless radio with more options than the effective yet limited GUI system. The GUI system only allows you to turn the radio on and off on the hour, rather than 15 minutes to, or 10 minutes after. We can use the cron service to make up for this lack of granularity:

Step 1: Disable the web GUI’s radio scheduling (Wireless -> Advanced Settings -> Radio Time Restrictions)

wireless

Step 2: Next, move over to the Administration -> Commands tab, and paste your cron schedule into the text box. This configuration creates a schedule that turns the radio on and off at different times depending on the day of the week. From Monday to Thursday, the radio is active from 9:30AM to 8:45PM. On Fridays, it is active from 9:30AM to 5:45PM, on Saturdays it is active from 9:30AM to 4:45PM; it remains off on Sundays. This is useful for a public hotspot that you would like to restrict access to off hours. Note, this command ‘echoes’ the actual cron table into the cron directory. You must click the “Save Startup” button so these commands run everytime your router boots, otherwise the /tmp/ directory will be cleared out on every reboot and no crontab will exist.

echo '30 09 * * 1-4 root /usr/sbin/wl radio on' > /tmp/cron.d/wlanonoff
echo '45 20 * * 1-4 root /usr/sbin/wl radio off' >> /tmp/cron.d/wlanonoff
echo '30 09 * * 5 root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff
echo '45 17 * * 5 root /usr/sbin/wl radio off' >> /tmp/cron.d/wlanonoff
echo '30 09 * * 6 root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff
echo '45 16 * * 6 root /usr/sbin/wl radio off' >> /tmp/cron.d/wlanonoff

It seems necessary to power off the router for about 30 seconds and then reboot it, otherwise unexpected results may occur.

For more information on Cron and the DDWRT firmware, check out the DDWRT wiki’s cron article. For a list of available wireless radio commands, look here.