Does OpenWrt have custom scripts and scheduling like routerOS?

hello everyone, a complete newbie here.

My main interest for openWrt is making my own scripts for the router. for example:

  • automating a script to allow internet access for a specific group of mac addresses for limited time thru the day (say from 8am to 5pm) then for the rest of the day limiting internet for that group to specific websites only. (I need this to work automatically as soon as the user connects to the router)

  • logging all requests and traffic for a specific mac addresses.

  • blacklisting some website so no user can access them.

are these things possible with openWrt? I know it's possible on mikrotik routerboards, but I'm all in for open source so I'm trying to accomplish this with openWrt.

any help would be appreciated and thanks.

Yes, of course. RouterOS is shit firmware with stolen open-source Linux code.

To schedule tasks you should use cron

To filter traffic by mac you should use firewall

To filter traffic to specific websites you should use ipset

You can configure firewall in two ways: by iptables command, and by UCI-configuration. The last option is recommended.

2 Likes

Thanks for the information buddy but could you please give me some keywords or links to learn more scripting for openwrt and what programing language is used?

Also is it possible to make event based scripts? (like if a user conects to the router or usb is connected or such)

OK, sure, you should use hotplug

To see specific log messages you should use logread -f command (like tail -f).

It is UCI configuration system.

Please, write first step, I will try to perform it.

2 Likes

Or, or, you can use simple-adblock and luci-app-simple-adblock and remove all existing lists entries and just type up the domains to be blocked there or create your own list if you can host it somewhere accessible from your router or as a file on your router if using curl.

But if you don't want extra packages on the router and/or want to gain experience/understanding how it works, totally follow @ulmwind's advice.

4 Likes

this is a great idea @stangri
I'll try to learn both.