I run an OpenVPN server with a 1 Gbps bandwidth and I need to limit it to 5 Mbps per user.
Searching the internet I've come up to this bash script:
$U32 = "tc filter add dev tun0 protocol ip parent 1:0 prio 1 u32" tc qdisc add dev tun0 root handle 1: htb default 30 tc class add dev tun0 parent 1: classid 1:1 htb rate 5mbit tc class add dev tun0 parent 1: classid 1:2 htb rate 5mbit $U32 match ip dst 10.8.0.0/16 flowid 1:1 $U32 match ip src 10.8.0.0/16 flowid 1:2
I tried it, but it limits the entire interface down to 5Mbps and not the single IPs and since I don't know how to use tc, i couldn't go further.
Does any one of you know how to modify this to limit each ip in the range to 5Mbps max?
Bonus question: do you know of any good online resource to learn more about tc?