Community discussions

MikroTik App
 
User avatar
Dragonmen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 72
Joined: Thu Jun 16, 2005 6:20 pm
Location: Sabac, Serbia
Contact:

Disconnecting the users with bad signal [2.9.X - 3.0.X]

Sat Dec 08, 2007 12:07 pm

YOU WANT IT - YOU GOT IT 8)

Small manual:
Install - click system->scripts, click "+", enter in the name whatevery you want (like signallimiter), click ok, done!
Image

You must have sheduler if you don't want to manually run the rule. Just make new system->shedule rule and put the name of the script you already defined (signallimiter or whatver name you defined) and choose time. I defined to be every 5 minutes.
Image

How it works:
The settings "minthreshold" is minimum signal and "maxthreashold" is maximum signal that will get blocked.
This means if minthreshold is 75 and maxthreshold is 90, the clients with signals between -70 and -90 will get blocked.
If you put maxthreshold to 95 or more, the new conected/idle clients will get banned for no reason!
Settings "removeadded" if 1 will remove the clients with bad signal from access lists and try to see if their signal got better, and if 0 the clients stay there permanently.
Settings "aldisabled" if "yes" will add the clients to access-list disabled (this is for testing), and if "no" they will be enabled.
:log info "Signal limiting..."
:local minthreshold 75
:local maxthreshold 90
:local removeadded 1
:local aldisabled "no"
:if ($removeadded=1) do={
:log info "Removing from wifi access-list"
:foreach i in=[/interface wireless access-list find comment="badsignal"] do={ /interface wireless access-list remove $i }
}
:local cntr 0
:log info "Adding to wifi access-list"
:foreach i in=[/interface wireless registration-table find] do = {
:local csig [/interface wireless registration-table get $i signal-strength]
:local cmac [/interface wireless registration-table get $i mac-address]
:local cint [/interface wireless registration-table get $i interface]
:local csigform [:pick $csig 1 3]
:if ($csigform<$maxthreshold && $csigform>$minthreshold) do={
/interface wireless access-list add mac-address=$cmac interface=$cint disabled=$aldisabled authentication="no" comment="badsignal"
:set cntr ($cntr+1)
}
}
Here's scheduler:
/ system scheduler add name="do_siglimit" on-event=siglimit start-date=jan/01/1970 start-time=00:00:00 interval=5m comment="signal limiter" disabled=no
Replace do_siglimit with your script name and interval=5m with interval you wish to run the script (if it's set to 5min then every 5 mins the clients will get blocked/released).
Last edited by Dragonmen on Sat Oct 25, 2008 4:01 pm, edited 3 times in total.
 
xakou
newbie
Posts: 30
Joined: Fri Jun 15, 2007 11:25 am

Re: Disconnecting the users with bad signal [2.9.X]

Sun Apr 06, 2008 11:23 am

YOU WANT IT - YOU GOT IT 8)

Small manual:
Install - click system->scripts, click "+", enter in the name whatevery you want (like signallimiter), click ok, done!
Image

Change 75 in ":local wifithreshold 75" to whatever number you want to be minimum signal allowed (75 is -75, change it to 80 or whatever you wish).
If you want just to test how system works, change :local aldisabled "no" to :local aldisabled "yes" and you will get disabled client deauth rule in access list.
You must have sheduler if you don't want to manually run the rule. Just make new system->shedule rule and put the name of the script you already defined (signallimiter or whatver name you defined) and choose time. I defined to be every 5 minutes.
Image

Notice that the system will behave like this:
If some client is having an bad signal he's beign disconnected for 5 minutes. After 5 minutes he's beign released from "block" for next 5 minutes. When next 5 minutes passed he's checked again for signal.
*TODO* Gotta do some delay of few seconds after deleting the client from access list and checking them again so they won't have 5 minutes of working before checked again.

I could also rewrite the script if someone needs it to work differently.

"Bare script"
:log info "Signal limiting..."
:local wifithreshold 75
:local aldisabled "no"
:log info "Removing disabled clients"; :foreach i in=[/interface wireless access-list find comment="badsignal"] do={ /interface wireless access-list remove $i }
:local cntr 0
:foreach i in=[/interface wireless registration-table find] do = {
:local csig [/interface wireless registration-table get $i signal-strength]
:local cmac [/interface wireless registration-table get $i mac-address]
:local cint [/interface wireless registration-table get $i interface]
:local csigform [:pick $csig 1 3]
:if ($csigform>$wifithreshold) do={
/interface wireless access-list add mac-address=$cmac interface=$cint disabled=$aldisabled authentication="no" comment="badsignal"
:set cntr ($cntr+1)
}
}
nice job, i will try it.
what can i do if i dont want to remove the bad-signal-clients from the black list?
i mean, i want to have them pernament block.
 
ropebih
Member Candidate
Member Candidate
Posts: 113
Joined: Tue May 22, 2007 5:35 pm

Re: Disconnecting the users with bad signal [2.9.X]

Sun May 11, 2008 11:53 am

To many of my clients, who have AP in client mode (D-Link for example),mikrotik shows signal strength -95 even if the signal is about -50, -60. What coud I do? Is it possible to do an upgrade of script without disconnecting of those clients?
 
User avatar
Dragonmen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 72
Joined: Thu Jun 16, 2005 6:20 pm
Location: Sabac, Serbia
Contact:

Re: Disconnecting the users with bad signal [2.9.X]

Fri Jun 20, 2008 12:54 pm

Yes it is possible.
The scripts needs a few more line to be perfect!
If the people want it i will do it.

@xakou:
remove
:log info "Removing disabled clients"; :foreach i in=[/interface wireless access-list find comment="badsignal"] do={ /interface wireless access-list remove $i }
 
User avatar
Dragonmen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 72
Joined: Thu Jun 16, 2005 6:20 pm
Location: Sabac, Serbia
Contact:

Re: Disconnecting the users with bad signal [2.9.X]

Sat Oct 25, 2008 3:56 pm

Here's "enhanced" version (sorry for waiting so long):

How it works:
The settings "minthreshold" is minimum signal and "maxthreashold" is maximum signal that will get blocked.
This means if minthreshold is 75 and maxthreshold is 90, the clients with signals between -75 and -90 will get blocked.
If you put maxthreshold to 95 or more, the new conected/idle clients will get banned for no reason!
Settings "removeadded" if 1 will remove the clients with bad signal from access lists and try to see if their signal got better, and if 0 the clients stay there permanently.
Settings "aldisabled" if "yes" will add the clients to access-list disabled (this is for testing), and if "no" they will be enabled.
:log info "Signal limiting..."
:local minthreshold 75
:local maxthreshold 90
:local removeadded 1
:local aldisabled "no"
:if ($removeadded=1) do={
:log info "Removing from wifi access-list"
:foreach i in=[/interface wireless access-list find comment="badsignal"] do={ /interface wireless access-list remove $i }
}
:local cntr 0
:log info "Adding to wifi access-list"
:foreach i in=[/interface wireless registration-table find] do = {
:local csig [/interface wireless registration-table get $i signal-strength]
:local cmac [/interface wireless registration-table get $i mac-address]
:local cint [/interface wireless registration-table get $i interface]
:local csigform [:pick $csig 1 3]
:if ($csigform<$maxthreshold && $csigform>$minthreshold) do={
/interface wireless access-list add mac-address=$cmac interface=$cint disabled=$aldisabled authentication="no" comment="badsignal"
:set cntr ($cntr+1)
}
}
Here's scheduler:
/ system scheduler add name="do_siglimit" on-event=siglimit start-date=jan/01/1970 start-time=00:00:00 interval=5m comment="signal limiter" disabled=no
Replace do_siglimit with your script name and interval=5m with interval you wish to run the script (if it's set to 5min then every 5 mins the clients will get blocked/released).
Last edited by Dragonmen on Mon Oct 27, 2008 9:04 am, edited 1 time in total.
 
xakou
newbie
Posts: 30
Joined: Fri Jun 15, 2007 11:25 am

Re: Disconnecting the users with bad signal [2.9.X]

Sun Oct 26, 2008 9:45 pm

Here's "enhanced" version (sorry for waiting so long):

How it works:
This means if minthreshold is 75 and maxthreshold is 90, the clients with signals between -70 and -90 will get blocked.
Are you sure ?
That means nobody can be connected!
 
User avatar
Dragonmen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 72
Joined: Thu Jun 16, 2005 6:20 pm
Location: Sabac, Serbia
Contact:

Re: Disconnecting the users with bad signal [2.9.X]

Mon Oct 27, 2008 9:02 am

Here's "enhanced" version (sorry for waiting so long):

How it works:
This means if minthreshold is 75 and maxthreshold is 90, the clients with signals between -70 and -90 will get blocked.
Are you sure ?
That means nobody can be connected!
Yes i am sure and i tested it.
ONLY the signals between -75 (-70 was a typo) and -90 in above example (if you don't change the values) will be added to access-list and blocked. Other (better than -75) will be fine, and also clients that just have been connected (-95).
 
apo
just joined
Posts: 19
Joined: Mon Dec 08, 2008 4:21 am

Re: Disconnecting the users with bad signal [2.9.X - 3.0.X]

Thu Feb 05, 2009 12:44 am

This works on 3.10?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26379
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Disconnecting the users with bad signal [2.9.X - 3.0.X]

Thu Feb 05, 2009 3:04 pm

can't you do that already with access list ???
2009-02-05_1503.png
You do not have the required permissions to view the files attached to this post.
 
User avatar
Dragonmen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 72
Joined: Thu Jun 16, 2005 6:20 pm
Location: Sabac, Serbia
Contact:

Re: Disconnecting the users with bad signal [2.9.X - 3.0.X]

Mon Mar 09, 2009 9:42 pm

The script works differently than that rule.
The user with bad signal experience something like this:
5 minutes of blocking the wireless with deny packet, then 5 minutes of working wireless.
You can always see in the access list the clients that have been rejected becouse of the bad signal.

Who is online

Users browsing this forum: No registered users and 34 guests