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

YOU WANT IT - YOU GOT IT :sunglasses:

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

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.

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).

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.

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?

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 }

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).

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).

This works on 3.10?

can’t you do that already with access list ???
2009-02-05_1503.png

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.