Notification texts go here Contact Us Get It Now!

Script MikroTik RouterOS - Add a Data Limit To Trial Hotspot Users

Script MikroTik RouterOS - Add a Data Limit To Trial Hotspot Users
Add a Data Limit To Trial Hotspot Users


To add a data limit to trial Hotspot users in Mikrotik RouterOS, you can use the following steps:
  1. Go to the "Hotspot" menu and click on the "Users" tab.
  2. Click the "Add" button to create a new Hotspot user.
  3. In the "Profile" field, select the trial profile that you want to use for the user. This profile should have the desired data limit and other parameters configured.
  4. Enter the username and password for the user in the appropriate fields.
  5. Click the "Apply" button to save the new user.
You can also use the "Hotspot User" page in the WebFig web interface to add new Hotspot users.

Keep in mind that you will need to set up a trial profile with the desired data limit and other parameters before you can assign it to trial users. To do this, go to the "Hotspot" menu and click on the "Profiles" tab. Click the "Add" button to create a new profile, and then configure the desired data limit and other parameters. Once you have created the trial profile, you can assign it to trial users as described above.

The following script allows you to assign a data limit to trial hotspot users and
a) have them kicked offline upon reaching this limit
b) create a temporary local user to stop them from logging back in again This is a feature which is not available via the current hotspot settings, so I decided to script it into existence. Enjoy! 

Script to check users for those over the limit: Make a scheduler entry to run this every X minutes, I'd recommend every 5-10 minutes.

#Download limit in MB
:local downquotamb "50"
# Do not modify anything below this line #
:local downquota [$downquotamb * 1000]
:local counter
:local datadown
:local username
:local macaddress
:foreach counter in=[/ip hotspot active find ] do={
:set datadown [/ip hotspot active get $counter bytes-out]
:if ($datadown>$downquota) do={
:set username [/ip hotspot active get $counter user]
:set macaddress [/ip hotspot active get $counter mac-address]
/ip hotspot user remove [/ip hotspot user find where name=$username]
/ip hotspot user add name=$username limit-bytes-out=$downquota mac-address=$macaddress
/ip hotspot active remove $counter
:log info "Logged out $username - Reached download quota"
}}

Script to clear all manually created user accounts; this can be done hourly, daily or weekly depending on your requirements.

:foreach counter in=[/ip hotspot user find ] do={/ip hotspot user remove \$counter}

Notes:
You can modify how often you want each of the script

Posting Komentar

Selamat datang dan terima kasih atas kunjungan Anda di situs kami! Kami menghargai waktu yang Anda luangkan untuk mengeksplorasi konten dan layanan yang kami tawarkan. Di sini, kami berkomitmen untuk memberikan pengalaman yang bermakna dan relevan bagi pengguna kami. Pendapat dan pandangan Anda memiliki peran yang sangat penting dalam membantu kami meningkatkan kualitas layanan dan konten yang kami sediakan
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.