Stefan Monnier
2018-04-16 17:40:24 UTC
I'm trying to limit bandwidth usage of a particular set of hosts.
After reading various manpages and webpages about tc, qdisc, classes and
whatnot, I believe I mostly know what I'd like to do and how, but the
final details still elude me:
Basically, I want to pass traffic destined to a particular set of local
hosts (say 192.168.1.16/29) through the `tbf` traffic shaping scheduler.
Now if these hosts were connected to their own network interfaces,
I believe I could just do something like
tc qdisc add dev $IF root tbf burst 1mb rate 100kbps
but since these are connected to the same network interface as several
other machines (for which I do not want to do any particular traffic
shaping), I have to do it differently:
iptables -t mangle -A POSTROUTING -j CLASSIFY \
--dst 192.168.1.16/29 --set-class 1:10
supposedly sets a "class 1:10" on each package destined to one of those
hosts, and I "just" need to setup my $IF such that packets of this class
go through the tbf scheduler.
But that's where I'm stumped, because `tbf` is a classless scheduler, so
I need to set a classful scheduler on $IF which divides the traffic
between 2 classes one of which goes through the tbf scheduler.
And I haven't been able to figure out how to do that. Any help?
Stefan
After reading various manpages and webpages about tc, qdisc, classes and
whatnot, I believe I mostly know what I'd like to do and how, but the
final details still elude me:
Basically, I want to pass traffic destined to a particular set of local
hosts (say 192.168.1.16/29) through the `tbf` traffic shaping scheduler.
Now if these hosts were connected to their own network interfaces,
I believe I could just do something like
tc qdisc add dev $IF root tbf burst 1mb rate 100kbps
but since these are connected to the same network interface as several
other machines (for which I do not want to do any particular traffic
shaping), I have to do it differently:
iptables -t mangle -A POSTROUTING -j CLASSIFY \
--dst 192.168.1.16/29 --set-class 1:10
supposedly sets a "class 1:10" on each package destined to one of those
hosts, and I "just" need to setup my $IF such that packets of this class
go through the tbf scheduler.
But that's where I'm stumped, because `tbf` is a classless scheduler, so
I need to set a classful scheduler on $IF which divides the traffic
between 2 classes one of which goes through the tbf scheduler.
And I haven't been able to figure out how to do that. Any help?
Stefan