I have the following for iptables & tc but it limits the upload speed to 2Mbits once the quota of 1GB has been hit.
iptables -t mangle -A POSTROUTING -o eth0 -p tcp -m owner --uid-owner aaron -m quota --quota 1073741824 -j ACCEPT
iptables -t mangle -A POSTROUTING -o eth0 -p tcp -m owner --uid-owner aaron -j CLASSIFY --set-class 1:11
tc qdisc add dev eth0 root handle 1:0 htb default 99
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 1024Mbit ceil 1024Mbit
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 2Mbit ceil 2Mbit prio 2
tc qdisc add dev eth0 parent 1:11 handle 10: sfq perturb 10
It works perfectly well but after searching a lot and trying to setup proper rules I've failed miserably.
I simply need it to limit BOTH the upload & download combined. So regardless of the usage on each one, I need it to assign both the upload and download as one quota combined. Whether it be 1GB of download or 1GB of upload of 500MB each, I need it to have the quota at 1GB. And once the total of 1GB has been used, it should limit both the download and upload speed to 2Mbit.
The difficulty comes with handling the different packets as a combined total (PREROUTING & POSTROUTING).
Should I use iptables -N and use a chain of rules then assign that the quota?
Please help!