Score:0

Traffic control on an interface for all sessions

in flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.