Community discussions

MikroTik App
 
User avatar
Sinan
Trainer
Trainer
Topic Author
Posts: 129
Joined: Tue Sep 01, 2015 7:00 am

Lock hotspot user to more than one MAC-address / Lock user to MAC address in user-manager

Wed Jun 01, 2016 8:13 am

Lock the user of the hotspot on more than one MAC Address:
for sure it is safer to lock the username with the MAC address but unfortunately it is only allowed to lock the user to one MAC address and sometimes the user uses more than one deive (laptop, phone , pad ...) so we need to lock that user to all these devices (perhaps 2 or more MAC addresses) so this is a tutorial on how to do that .
1-on my computer type this
ftp://192.168.95.1 (change it to the ip of your routerboard , you may be need to login before that) then it will ask for username and password which is the same of that for winbox , now create a folder and name it users
2-inside this file create txt file for each user you want to lock more than one MAC address to it (each file in this form username.txt) and inside this file put the allowed MAC address as much as you wanna.
3-In winbox go to:
ip>hotspot>user profile and choose the profile you want to apply this for and in script on-login tab put this script:
{
:delay 1
:local m $"mac-address"
:local f [/file get value-name=contents [find name="users/$username.txt"]]
:if ($f!="") do={
:if ([:len [find $f $m]]=0) do={
/ip hotspot active remove [find mac-address=$m]
}}}
apply this for all the profile you want to lock more than one MAC to the user, if you are using usermanager then apply this to default profile
i hope this is clear .. and please do not hesitate to ask any question ....... regards
Image
Image
Image
 
realight
just joined
Posts: 1
Joined: Wed Jul 27, 2016 1:29 pm

Re: Lock hotspot user to more than one MAC-address / Lock user to MAC address in user-manager

Wed Jul 27, 2016 1:33 pm

not working i tried with v6.35.4
 
mustdave
just joined
Posts: 2
Joined: Wed Jun 07, 2017 10:12 am

Re: Lock hotspot user to more than one MAC-address / Lock user to MAC address in user-manager

Wed Aug 02, 2017 12:36 pm

Its work. Its delete user from user active list.

Thx sir. Its helped me.

But, can this script do notification like if we did this by mikrotik menu, not script? The notif is "this username cant use with this mac address"

Thx.
 
mario7337
just joined
Posts: 5
Joined: Sat Apr 04, 2020 4:09 pm

Re: Lock hotspot user to more than one MAC-address / Lock user to MAC address in user-manager

Sat Apr 04, 2020 4:26 pm

Hi @sinan,

Is still working this script?
Is there another way with the latest version 6.46.4?
I need to solve this problem.
Thanks.
 
mario7337
just joined
Posts: 5
Joined: Sat Apr 04, 2020 4:09 pm

Re: Lock hotspot user to more than one MAC-address / Lock user to MAC address in user-manager

Tue Apr 20, 2021 12:58 pm

Its work. Its delete user from user active list.

Thx sir. Its helped me.

But, can this script do notification like if we did this by mikrotik menu, not script? The notif is "this username cant use with this mac address"

Thx.
Hello,

did you find a method to send back a notification like " you have reached the maximum number of devices"??

Who is online

Users browsing this forum: No registered users and 10 guests