0

On an interface that is connected to a 1G port I want to limit all users/sessions to have no more than 20Mbits download speed individually. I mean If two of them tried to use bandwidth at the same time each should be able to get 20Mbits.

I use this for different applications. One is Openvpn user management. So let's consider the interface is tun0. It seems that on a Ubuntu server machine the best approach is using tc on tun0 interface.

I tried to setup my shaping scenario like this:

tc qdisc add dev tun0 root handle 1:0 htb
tc class add dev tun0 parent 1:0 classid 1:1 htb rate 20Mbit ceil 20Mbit prio 1
iptables -t mangle -A POSTROUTING -o tun0 -p tcp -j CLASSIFY --set-class 1:1

After entering these lines, my shaping seems to start. When I connect from a user to my openvpn server and run an oakla speed test I roughly get 20Mbits download speed, without tc it could be 200Mbits. But the problem is that when I connect the second client and run a speed test at the same time it seems that 20Mbits is randomly shared between them. The sum always be roughly 20Mbits but none can individually reach even close to this limit.

I did not want to limit the total sum. I am supposed to limit individuals. Please help me find out which part did I do wrong. I am new to tc.

0

You must log in to answer this question.

Browse other questions tagged .