Community discussions

MikroTik App
 
eduardosilva
just joined
Topic Author
Posts: 24
Joined: Tue Dec 13, 2011 11:33 pm

[solved] Moving Heavy users to secondary internet link

Thu Mar 27, 2014 12:00 am

Greetings,

I have a 2 internet links connected to my mikrotik, both are 10mbps. The main uplink have monthly traffic limitation, and the secondary link is unlimited but with a very inferior quality.

Today, when I find someone using a lot of bandwidth, I manually create a mangle rule to apply the secondary internet routing mark to his IP address.
Any ideas/suggestions of how to do this automatically for ips that downloaded/uploaded more than 500mb in the last 24 hours?

Thank you!
Last edited by eduardosilva on Sat Apr 05, 2014 1:19 am, edited 1 time in total.
 
ffernandes
Member Candidate
Member Candidate
Posts: 148
Joined: Mon Jun 23, 2008 11:20 pm

Re: Moving Heavy users to secondary internet link

Thu Mar 27, 2014 12:19 am

Greetings,

I have a 2 internet links connected to my mikrotik, both are 10mbps. The main uplink have monthly traffic limitation, and the secondary link is unlimited but with a very inferior quality.

Today, when I find someone using a lot of bandwidth, I manually create a mangle rule to apply the secondary internet routing mark to his IP address.
Any ideas/suggestions of how to do this automatically for ips that downloaded/uploaded more than 500mb in the last 24 hours?

Thank you!

if they have static ips try going into ip-routes....rules and insert the ip select wan u want and ... should work
 
eduardosilva
just joined
Topic Author
Posts: 24
Joined: Tue Dec 13, 2011 11:33 pm

Re: Moving Heavy users to secondary internet link

Thu Mar 27, 2014 12:25 am

Hello ffernandes,

They do not have static ips. It's a "public" network without any hotspot, just dhcp.

Thank you
 
eduardosilva
just joined
Topic Author
Posts: 24
Joined: Tue Dec 13, 2011 11:33 pm

Re: Moving Heavy users to secondary internet link

Sat Apr 05, 2014 1:18 am

Just as an update and for future reference, I solved this writing a custom script (my first script);
/ip firewall filter add action=passthrough chain=monitor dst-address=192.168.10.2
/ip firewall filter add action=passthrough chain=monitor dst-address=192.168.10.3
/ip firewall filter add action=passthrough chain=monitor dst-address=192.168.10.4
(...)
/ip firewall filter add action=passthrough chain=monitor dst-address=192.168.10.249
Wrote the monitoring script (schedule every 00:30)
:global subnet "192.168.10."
:global maxbytes 305044184

:for i from=2 to 249 do={
:delay 2
:local bytes [/ip firewall filter get [find chain=monitor dst-address="$subnet$i"] bytes];
:if ( $bytes > $maxbytes ) do={
:local count 0
foreach X in=[ /ip firewall mangle find where src-address="$subnet$i" ]  do={:set count 1 } 
:if ( count = 0 ) do={ 
/ip firewall mangle add action=mark-routing chain=high-usage-users comment="Regra Automatica" new-routing-mark=adsl passthrough=no src-address="$subnet$i" } 
}
}
And the cleanup script schedule to run once a day:
/ip firewall filter reset-counters [find chain=monitor] 
/ip firewall mangle remove [find chain=high-usage-users ]

Who is online

Users browsing this forum: Josephny and 56 guests