Page 1 of 1

Disable interface after a certain amount of data transferred?

Posted: Sun Feb 14, 2016 9:52 pm
by therfman
Hello,

First post here, but I've been using a RB2011 for over a year and understand most concepts well. I am currently playing with a setup that has two outbound internet connections. One is very fast and unlimited, the other is slower and has a monthly data cap and is mostly used as a backup. Through the use of Mangle rules, I am also able to force certain devices to use a specific outbound connection. I tend to route low-bandwidth, latency-sensitive traffic to the slower connection since it mostly sits idle and is never overloaded.

I was wondering if there is a way I can tell RouterOS to stop using the second connection once it has reached its monthly data cap, like Android phones can do. I want to have that connection as a backup, but not to the point that I start incurring extra data charges if I exceed the cap.

There are many ways I can limit the throughput of that connection, but that's not really want I want. I am looking for a way to tell it to use the interface as it would normally, and once X GB of data has been router though it, disable the interface.
I would also need a way to reset the counter on a certain date, but that's likely easier to do.

Thanks in advance for the help!

Luc

Re: Disable interface after a certain amount of data transferred?

Posted: Sun Feb 14, 2016 10:38 pm
by BartoszP
What about script scheduled every eg. 10 minutes with sth. like this:
:if ( [/interface ethernet get 0 driver-rx-byte ] > mylimit ) do={
 /interface ethernet disable 0
 } 
I assume that WAN is on ethernet 0 and you are checking only RX bytes. If you want more detailed limit then you maybe should sum RX and TX values ?

Re: Disable interface after a certain amount of data transferred?

Posted: Mon Oct 03, 2016 8:10 pm
by marinxy
Hello,

I am looking for the exact same thing :) Have you discovered how to do it?

Was the submitted script of any help?

Care to share the info?:)

Cheers!

Re: Disable interface after a certain amount of data transferred?

Posted: Tue Oct 04, 2016 2:13 pm
by haik01
Run a test on a free port. And then put a NAS or other PC on that port, and start downloading files between the NAS and your computer. See if the script will kick in.

Do not forget to re enable the port once the month is over. Use scheduler for this.