If possible through access list (MAC address) or firewall rules (IP Address)
This type of control can be achieved using the MikroTik Firewall functionalities together with the mangrove rules and access policies of the Wireless Access List. The idea is to create rules that allow or block access to the wireless network depending on the time of day. Here's a basic approach on how it could be configured:
Step 1: Create a Mangrove Rule to Mark Traffic
First, you will need to mark traffic coming from the wireless network so you can apply specific policies to that traffic.
- Access your MikroTik device through WinBox or the web interface.
- Go to IP > Firewall and select the tab Mangle.
- Create a new rule by clicking the plus sign (+).
- In the section General, select the wireless interface in “In. Interface".
- In the Action, choose “mark connection,” and assign a name to the mark (for example, “wireless-time-control”).
- Apply and save the rule.
Step 2: Create Filter Rules to Control Time-Based Access
Now, using the flag created, you can define filter rules that specify when traffic is allowed or blocked.
- Still in IP > Firewall, go to the tab Filter Rules.
- Create a new rule to block traffic outside of permitted hours.
- In the section General, choose the wireless interface in “In. Interface".
- In the section Advanced, in “Connection Mark”, select the mark created previously (e.g., “wireless-time-control”).
- In the Extras, sets the time in which the block will be active (outside the allowed hours). For example, to block everything except 12:00 to 14:00, you'll need two rules: one before 12:00 and one after 14:00.
- In the Action, select “drop” to block flagged traffic outside of permitted hours.
- Repeat the step to cover the time slots in which you want to restrict access.
Step 3: Adjust the Rule to Allow Traffic During the Specified Hours
It is not necessary to create a specific rule to allow traffic during allowed hours if the blocking rules have been configured correctly to cover all other hours. Unmarked or unblocked traffic will be allowed automatically.
Considerations
- This method controls traffic at the network level and affects all users connected to the specified wireless interface. For more granular control (per user or device), you could explore additional options such as MikroTik's “User Manager” to manage access based on user profiles.
- Be sure to adjust the rules based on your network context and perform tests to confirm that access control is working as expected.
Implementing time-limited access control on MikroTik wireless networks using the “Access List” functionality is another strategy that can be used, especially when seeking to apply restrictions to individual devices or specific groups of users. Although the Access List alone does not allow direct time-based configuration, you can combine it with scripts and schedulers to enable and disable access according to defined times.
We leave you a basic approach of how you could do it:
Step 1: Configure the Access List
- Access your MikroTik device via WinBox or the web interface.
- Navigate to wireless and select the tab Access List.
- Click the plus sign (+) to add a new entry.
- In the new entry, you can specify the MAC address of the device you want to restrict access to. You can leave the rest of the options at their default values or adjust them according to your specific needs.
- Make sure the option Disabled is marked as No. for the rule to be active.
Step 2: Create Scripts to Enable and Disable Access
You will need to create two scripts: one to disable the Access List rule (block access) and one to enable it (allow access).
- To disable access:
- Go to System > Scripts.
- Create a new script with a descriptive name, such as “DisableWiFiAccess.”
- In the countryside Source, type the command to disable the Access List rule, for example:
/interface wireless access-list set [find mac-address=XX:XX:XX:XX:XX:XX] disabled=yes
- Replace “XX:XX:XX:XX:XX:XX” with the MAC address of the corresponding device.
- To enable access:
- Repeat the process by creating another script called “EnableWiFiAccess”.
- In the countryside Source, uses:
/interface wireless access-list set [find mac-address=XX:XX:XX:XX:XX:XX] disabled=no
- Make sure you use the same MAC address as before.
Step 3: Configure the Scheduler to Run Scripts
To automate the execution of these scripts according to your desired schedule (for example, only allow access from 12:00 to 14:00), you will use the MikroTik Scheduler.
- Go to System > Scheduler.
- Create a new scheduler for to disable the access. Set the Start Time at the time you want to block access (for example, 14:00 p.m.) and at On Event, calls the “DisableWiFiAccess” script.
- Create another scheduler to enable the access. Set the Start Time at the time you want to allow access (for example, 12:00) and at On Event, calls the “EnableWiFiAccess” script.
This approach allows you to have more granular control over individual devices' access to your MikroTik Wi-Fi network, allowing or denying access at specific times. Remember that this method requires manual management of the MAC address for each device and the creation of scripts and schedulers for each access rule you want to control.
There are no tags for this post.