How to set different speed for different terminals?
In my case:
- Total bandwidth is 100Mbits/s.
- No more than 100 terminals.
- I want each terminal use no more than 2Mbits/s or 3Mbits/s bindwidth
I tried like this:
- for init setup
sudo tc qdisc add dev eth0 root handle 1: htb default 10
sudo tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit
sudo tc class add dev eth0 parent 1:1 classid 1:10 htb rate 1mbit
- for each terminal
sudo tc class add dev eth0 parent 1:1 classid 1:x htb rate 2mbit
sudo tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dst 192.168.0.x flowid 1:x
or
sudo tc class add dev eth0 parent 1:1 classid 1:x htb rate 3mbit
sudo tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dst 192.168.0.y flowid 1:y
So I need one class and one filter for each terminal. However if there are 1000 or even more terminals, I need to setup more classes and filters. Is there any better way?