I need to control WiFi connected clients, to have internet connection for an hour, and after that time to not to have internet connection for an hour.
For that, a lease script is not sufficient. No problem to add
timeout=1h to the
/ip firewall address-list add ... in the lease script, but doing so would just limit access for the first hour after getting the address; once that hour expires, the lease script will not re-add the address to the list until the dhcp lease expires and gets assigned (
not renewed) again. So you need three lists:
- one to store the addresses currently leased
- a "permit" one where the users which enjoy their active hour are placed
- a "deny" one where the users which suffer their gap hour are placed
So the lease script will add the address to the first two lists
if it doesn't find it at the first one, to the first one for a week and to the second one for an hour. A scheduled script running every minute will move the addresses between the permit and deny lists each time the timeout of a given address on its current list is below 2 minutes.
The lease duration needs to be at least two hours - if another device would get the same IP which is still on the first list, it might fall into the deny period; if you cleared the first list at lease expiration, it would be enough to switch the WiFi client off for the lease time, so after its expiration, the whole cycle would start from scratch (the permit hour).
But people are creative, so be prepared that they will use a second mobile to stay online all the time