Wireless whitelist from the command line

So, I have googled, and I know about the wifi up|down command, and I have seen threads like: [Solved]Wireless Network - MAC-Filter - command line SETUP - #9 by Fperuso and Wireless security via the command line - #3 by ZebraOnPC but they have not answered my question.

I know I can edit /etc/config/wireless by hand, but I don't want to do that. I want to be able to enable/disable whitelisting via the command line, most likely from cron.

So, basically what I'm looking for is a CLI version of Network -> Wirless -> [Wireless Network -> Edit] -> MAC-Filter -> Allow listed only and then add MAC addresses.

Then, of course, to be able to switch the MAC address filter to disable to allow everybody.

Is there a way I can do that from the command line? I know I could grep/sed the config file, but that would be very fragile and I'd rather not do that.

Any tips, techniques or ideas are welcome!

Thanks!

You would use uci set commands. It would make most sense to create a script which accepts a MAC address as input and runs the 2-3 commands required to add it to the whitelist, rather than stringing these together into a long cron entry.

If you add a whitelist entry in luci and then click Pending Changes in the top right corner it will show you the necessary uci commands as a start.

Yes. I'll most likely make a script with the config in it, or a script that iterates over a config file.

Nice! I never knew that. That is FANTASTIC! :slight_smile: Thank you.

Just to follow up, I had to run the command wifi reload to activate the settings.

1 Like