5

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.

Ian
  • 93
  • 1
  • 6
  • While the values you show don't contain any problematic characters, you should *always* quote variables to protect against them. Please show the lines in the script which assign values to the variables. Also, you don't say whether there is any error output or log entries that might be helpful. – Dennis Williamson Mar 16 '14 at 01:40
  • You're doing traffic control on both the interfaces of the bridge, right (i.e. you know that tc shapes only the outgoing traffic on the specified interface)? – skarap Mar 16 '14 at 07:36
  • I was not! But it looks like that was the problem. Thank you 0x534B41, I'm brand new to tc and I appreciate your help. – Ian Mar 16 '14 at 23:53

1 Answers1

2

HTB bandwidth control in tc only shapes outgoing traffic, so in order to limit the bandwidth between a server and client TCP connect, shaping must be applied to both bridge interfaces. (Thanks to 0x534B41)

Ian
  • 93
  • 1
  • 6