Community discussions

MikroTik App
 
ip9studio
just joined
Topic Author
Posts: 4
Joined: Tue Jun 12, 2018 12:51 pm
Location: Ukraine

Determining the speed of data transmission in the subnet by means of scripts or rules

Tue Jun 12, 2018 1:11 pm

Hello! Sorry for my bad english. The question is: Is it possible for Microtics (scripts and / or rules) to determine that a specific IP address on the local network is currently loading data from the WAN, for example, at a speed of 50Mbps and write this src-ip in the address list. The task is to monitor the connection speed of each ip address to the subnet and when it reaches the threshold value of the download speed, place it in a special addressist for several minutes. Strictly speaking, this is not necessary to limit its speed, but to redirect it to WAN2, thus freeing WAN1 from the load. Waiting for clarifying questions.
P.S. maybe I can use Torch?
 
User avatar
dasiu
Trainer
Trainer
Posts: 231
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: Determining the speed of data transmission in the subnet by means of scripts or rules

Wed Jun 13, 2018 7:14 pm

You can't use torch with scripts (i.e. can't read the torch readings from a script).
What you can do is to have a /queue simple - one entry for each IP from LAN. Then your script can just get the "rate" parameter for each queue entry and check upload or download (need some parsing to split up/down and separate bps/kbps/Mbps unit from the number)
 
ip9studio
just joined
Topic Author
Posts: 4
Joined: Tue Jun 12, 2018 12:51 pm
Location: Ukraine

Re: Determining the speed of data transmission in the subnet by means of scripts or rules

Wed Jun 13, 2018 8:18 pm

You can't use torch with scripts (i.e. can't read the torch readings from a script).
What you can do is to have a /queue simple - one entry for each IP from LAN. Then your script can just get the "rate" parameter for each queue entry and check upload or download (need some parsing to split up/down and separate bps/kbps/Mbps unit from the number)
Thank you! Now it is clear where to start.
 
ip9studio
just joined
Topic Author
Posts: 4
Joined: Tue Jun 12, 2018 12:51 pm
Location: Ukraine

Re: Determining the speed of data transmission in the subnet by means of scripts or rules  [SOLVED]

Wed May 01, 2019 8:43 pm

Code: Select all

/ip firewall address-list remove [/ip firewall address-list find list=OwerSpeed];
:foreach i in=[/queue simple find] do={
:local comm;
:local speed [/queue simple get $i rate];
:if ($speed != "0bps/0bps") do={
:local ipaddress [:tostr [/queue simple get $i target]];
:set $ipaddress [:pick $ipaddress 0 [:find $ipaddress "/"]];
:set $speed [:pick $speed ([:find $speed "/"]+1) [:len $speed]];
:local post [:pick $speed ([:find $speed "."]+2) [:len $speed]];
:set $speed [:pick $speed 0 [:find $speed "."]];
:set $comm ($speed.$post);
:if ($post = "Mbps") do={
:if ($speed >= 30) do={/ip firewall address-list add address=$ipaddress list=OwerSpeed comment=$comm}
}
}
}

Who is online

Users browsing this forum: No registered users and 25 guests