You are not logged in.

#1 2009-10-02 01:53:06

Sorjak
Member
Registered: 2009-10-02
Posts: 2

Stopping uploads after set amount?

Is there a way to get something to monitor my upload bandwidth, cutting it completely off after a set amount per day?

For example, stop any sort of uploads after 5gb of upload traffic per day.

I'm trying to set up a headless server running Arch, but I start getting mean letters if I go over that limit, so any help would be appreciated smile

Offline

#2 2009-10-02 02:59:20

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: Stopping uploads after set amount?

man iptables and look at the 'quota' match option.

Something like this might work for you:

iptables -A OUTPUT -m quota --quota 5368709120 -j ACCEPT
iptables -A OUTPUT -j REJECT

Remember the counter will be reset on reboot, or reloading the iptables rules! You'll need to reset the quota each night too of course.

Last edited by fukawi2 (2009-10-02 03:02:16)

Offline

#3 2009-10-02 03:16:46

Sorjak
Member
Registered: 2009-10-02
Posts: 2

Re: Stopping uploads after set amount?

So I would just run these commands in my rc.local or something, and they would keep the quota below 5gb per day, or until the server is rebooted?

Is there a way to keep what the quota byte total is in a text file or something so that the server can refresh it every day, and be proof against restarts?

Offline

#4 2009-10-02 04:23:18

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: Stopping uploads after set amount?

Have a look at iptables-save and iptables-restore for saving counters....

Offline

Board footer

Powered by FluxBB