hi guys i have a hotspot set up and i want a script that runs every hour to check active users usage and removes the host of any user that exceeded 1gb is that possible?
I think most folks use queues to limit downloading to discourage hogging of the internet connection.
If one is not able to monitor usage in such a way as to provide, it sounds like a functionality improvement suggestion.
Hopefully there is a relatively easy way to script this, if the information is available.
Have you considered the available HOTSPOT functionality and customisation.
It appears there is a built-in capability to limit bytes in both directions…
https://help.mikrotik.com/docs/display/ROS/Hotspot+customisation
The Hotspot functionality anav linked to might work.
Otherwise, you can use mangle to mark connections exceeding a set number of bytes and queue them so that the bandwidth limit available will discourage any heavy downloading. This method is detailed in the QoS thread - in reality, you can not only set a bulk priority for this traffic, but a hard limit on it as well. Few people will wait 16 hours to finish a download.
AFAIK, simple queues are used for accounting, but there’s no way to limit data usage per user this way.
well my problem is if i set lets say 10gb to a user and the user used 9gb of them then the next time he opens the internet if he used the remaining 1 gb it wont automatically cut him off the internet it’ll wait until he logs out or the host is removed somehow
Well, since I can now assume that you are selling vouchers with set limits, you should probably pay someone qualified to answer your question. My examples would work in a free access coffee shop scenario, where one would want to stop users from abusing the free service. User accounting and billing is something else.
+10
Using “serious” Captive Portal software on the router, i.g. “coova-chilli” (CP) on openwrt(OS), your functionality is no problem. It is implemented in coop between coova and freeradius, which does the traffic accounting and signals the drop of connection, in case traffic limit exceeded. One of the reasons, I abandoned mikrotiks hotspot many years ago, because too limited for “above basic” usage.
You can run openwrt plus coova on various mikrotiks, BTW.
However, “coova-chilli”, used in various big money hotspot softwares, has a steep learning curve because of its large set of functions.
MAY_BE you can do similar on mikrotiks hotspot stuff, because it also can be configured using radius.
No need script, just use Mikrotik Hotspot with RADUS-UserManager, can do that limit via User-Manager Mikrotik Attribute “Mikrotik-Total-Limit” or simple using User-Manager>Limitation (since v7.5 ).
Limit reached, user will be disconnect without can connect again, except you set newly activated User-Manager User-Profile.
Yes, you can just use HotSpot with RADIUS CoA feature, to forcedly disconnect the user, when amount of X Gigabytes is exceeded. You will have to use a RADIUS server to keep your users. And it must have the CoA feature supported.
+1