0

There are 2 sources of traffic

The first one of them shouldn't be impeded in any way, it should be able to draw as much available traffic as it wants.

The second one, on the other hand, should be limited in such way that both of them together cannot exceed a certain limit. That is, they can exceed it, but it shouldn't be the "fault" of the second source - in this case all of the traffic is drawn by the first.

Is it possible to do this with tc?

Right now there's a solution that limits traffic for both:

tc qdisc add dev eth0 root handle 1: htb default 101
tc qdisc add dev eth1 root handle 1: htb default 101

tc class add dev eth0 parent 1: classid 1:1 htb rate 50000kbit
tc class add dev eth1 parent 1: classid 1:1 htb rate 50000kbit

tc class add dev eth0 parent 1:1 classid 1:101 htb rate 49500kbit ceil 50000kbit prio 0 quantum 16000
tc qdisc add dev eth0 parent 1:101 handle 101: sfq perturb 10
tc filter add dev eth0 parent 1:0 protocol ip prio 0 handle 1 fw classid 1:101

tc class add dev eth1 parent 1:1 classid 1:101 htb rate 49500kbit ceil 50000kbit prio 0 quantum 16000
tc qdisc add dev eth1 parent 1:101 handle 101: sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 0 handle 1 fw classid 1:101

tc class add dev eth0 parent 1:1 classid 1:102 htb rate 500kbit ceil 50000kbit prio 1 quantum 16000
tc qdisc add dev eth0 parent 1:102 handle 102: sfq perturb 10
tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 2 fw classid 1:102

tc class add dev eth1 parent 1:1 classid 1:102 htb rate 500kbit ceil 50000kbit prio 1 quantum 16000
tc qdisc add dev eth1 parent 1:102 handle 102: sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 1 handle 2 fw classid 1:102
Michael Ivko
  • 151
  • 7

1 Answers1

0

Removing the ceil parameter of the first class should do the trick. Without it, there won't be any hard limit for your first source of traffic.

setenforce 1
  • 1,200
  • 6
  • 10