I am working on a bash utility that will use several aspects of the tc Linux command line utility to emulate various network conditions. I have successfully constructed several qdisc hierarchies, one each for HTB bandwidth control, NetEM delay and packet manipulation, and TBF rate control, as well as combined handlers for HTB-NetEM, and TBF-NetEM Where I am struggling is in combining the three into a single structure, for cases in which I need to control all of these factors on a single connection. This is what I have so far:
sudo tc qdisc add dev $interface root handle 1:0 htb
sudo tc class add dev $interface parent 1:0 classid 1:1 htb #htb args
sudo tc qdisc add dev $interface parent 1:1 handle 10:0 tbf #tbf args
sudo tc qdisc add dev $interface parent 10:1 handle 101:0 netem #netem args
Because of my smaller scope cases, I know that the problem does not lie in the syntax of my inputs, but likely in the structure of my tc qdiscs and classes. When I attempt to run these commands together with rate and bandwidth shaping arguments (10 and 15 Mbit/s respectively) in both ethernet ports of my bridge, no change to the bandwidth of an iperf test is shown, in TCP or UDP. Any advice would be appreciated.
Here are my other working compound structures, in case they might help:
HTB and NetEM:
sudo tc qdisc add dev $interface root handle 1: htb
sudo tc class add dev $interface parent 1:0 classid 1:1 htb #htb args
sudo tc qdisc add dev $interface parent 1:1 handle 10:0 netem #netem args
TBF and NetEM:
sudo tc qdisc add dev $interface root handle 1:0 tbf #tbf args
sudo tc qdisc add dev $interface parent 1:1 handle 10:0 netem #netem args