OpenWrt Forum Archive

Topic: limit traffic with openwrt

The content of this topic has been archived on 17 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

hello,

i have following problem, how to solve it with openwrt?

as i do not have unlimited internet (i only have 50 GB per month) i want to limit my wlan guestnet.

the guestnet is only used by my children and as they look a lot of video, sometimes 50 GB internet is used up after half of the month. i want that the children have free internet access up to a usage of e.g. 35 GB and then the router shall limit bandwith dramatically, so that they can use whatsapp, email and so on, but no more videos.

so i want to have a kind of traffic counter or a kind of tool that automatically slows down internet after the usage of e.g.  35 GB.


can you help me?

thanks!

the problem is, that "wonder shaper" always limits bandwith, but i want to limit it after reaching a monthly download amount of e.g. 35 GB

is there for instance a kind of traffic counter, that blocks download/upload at all after reaching a limit of eg 35 GB

The only thing I can think of off the top of my head is to use "ifconfig". ifconfig will show RX and TX since last time the router was powered up. So maybe create a script that constantly runs ifconfig (parse to only get the bytes, with grep or something). Then you can compare the byte count with your limit, finally use wonder shaper to re-write the config file once the limit has been reached.

Kinda complicated now that I think about it, but I can't think of any packages that can make this any easier. You would also need to check if 30 days have passed before removing the bandwitdth limit.

Even more, make sure your kids don't restart the router...or periodically save the byte count. Good luck!

(Last edited by supergeen on 16 Mar 2017, 22:13)

>so i want to have a kind of traffic counter or a kind of tool that automatically slows down internet after the usage of e.g.  35 GB.<
Typical task for chilli+freeradius+mysql. However, this needs a lot of work for implementation, in case you are not familar with these packages. And needs separate server for the accounting DB.

In case, you want a very simple, unprecise accounting of traffic, you might search for 'iptables accounting' and issuing pre-assigned IPs to your client PCs. Another possibility running squid, and using a log analyzer.

However, I just finished the firmware for a commercial product, implementing what you want. So, just wait and buy :-)

The discussion might have continued from here.