Community discussions

MikroTik App
 
therfman
just joined
Topic Author
Posts: 2
Joined: Sun Feb 14, 2016 8:44 pm

Disable interface after a certain amount of data transferred?

Sun Feb 14, 2016 9:52 pm

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
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 3096
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

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

Sun Feb 14, 2016 10:38 pm

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 ?
 
marinxy
just joined
Posts: 6
Joined: Tue Aug 02, 2016 9:33 am

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

Mon Oct 03, 2016 8:10 pm

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!
 
haik01
Member
Member
Posts: 404
Joined: Sat Mar 23, 2013 10:25 am
Location: Netherlands

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

Tue Oct 04, 2016 2:13 pm

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.