I am trying to limit the bandwidth between a simple iperf server and client, using a third, passive machine acting as a bridge. With no interference, iperf returns a bandwidth of ~90 Mbits/sec. My goal is to create a root qdisc that sends all unclassified traffic (everything) to a child HTB class, where my bandwidth is set, which then routes to a leaf qdisc, where additional tc parameters will be set once I get this working. My implementation is brief:
sudo tc qdisc add dev $interface root handle 1: htb default 10
sudo tc class add dev $interface parent 1:0 classid 1:10 htb rate $bandwidth burst $burst
sudo tc qdisc add dev $interface parent 1:10 handle 10:0 netem #other stuff goes here
When this bash script is implemented on the bridge with $interface = eth1
, $bandwidth = 500kbps
, $burst = 15k
, I see a decrease in the iperf bandwidth, but not nearly the mandated value (usually ~5Mbps).
Is there an error in my script? Am I misusing the burst variable? Please help.
UPDATE: After further investigation, I have found that this traffic control works fine when applied to the ethernet card that interfaces with the SERVER, but the problem occurs when the same commands are applied to the CLIENT side. This holds true when the whole setup is reversed.